mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 11:03:50 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -12,17 +12,15 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Entity\Workflow;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
*
|
||||
* @ORM\Table("chill_main_workflow_entity_step")
|
||||
*/
|
||||
class EntityWorkflowStep
|
||||
@@ -34,7 +32,9 @@ class EntityWorkflowStep
|
||||
|
||||
/**
|
||||
* @var Collection<User>
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity=User::class)
|
||||
*
|
||||
* @ORM\JoinTable(name="chill_main_workflow_entity_step_cc_user")
|
||||
*/
|
||||
private Collection $ccUser;
|
||||
@@ -56,14 +56,18 @@ class EntityWorkflowStep
|
||||
|
||||
/**
|
||||
* @var Collection<User>
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity=User::class)
|
||||
*
|
||||
* @ORM\JoinTable(name="chill_main_workflow_entity_step_user")
|
||||
*/
|
||||
private Collection $destUser;
|
||||
|
||||
/**
|
||||
* @var Collection<User>
|
||||
*
|
||||
* @ORM\ManyToMany(targetEntity=User::class)
|
||||
*
|
||||
* @ORM\JoinTable(name="chill_main_workflow_entity_step_user_by_accesskey")
|
||||
*/
|
||||
private Collection $destUserByAccessKey;
|
||||
@@ -80,7 +84,9 @@ class EntityWorkflowStep
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
*
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private ?int $id = null;
|
||||
@@ -108,10 +114,11 @@ class EntityWorkflowStep
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null})
|
||||
*/
|
||||
private ?DateTimeImmutable $transitionAt = null;
|
||||
private ?\DateTimeImmutable $transitionAt = null;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private ?User $transitionBy = null;
|
||||
@@ -140,7 +147,7 @@ class EntityWorkflowStep
|
||||
|
||||
public function addDestEmail(string $email): self
|
||||
{
|
||||
if (!in_array($email, $this->destEmail, true)) {
|
||||
if (!\in_array($email, $this->destEmail, true)) {
|
||||
$this->destEmail[] = $email;
|
||||
}
|
||||
|
||||
@@ -247,7 +254,7 @@ class EntityWorkflowStep
|
||||
return $this->transitionAfter;
|
||||
}
|
||||
|
||||
public function getTransitionAt(): ?DateTimeImmutable
|
||||
public function getTransitionAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->transitionAt;
|
||||
}
|
||||
@@ -385,7 +392,7 @@ class EntityWorkflowStep
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setTransitionAt(?DateTimeImmutable $transitionAt): EntityWorkflowStep
|
||||
public function setTransitionAt(?\DateTimeImmutable $transitionAt): EntityWorkflowStep
|
||||
{
|
||||
$this->transitionAt = $transitionAt;
|
||||
|
||||
@@ -414,13 +421,13 @@ class EntityWorkflowStep
|
||||
return;
|
||||
|
||||
if ($this->isFinalizeAfter()) {
|
||||
if (0 !== count($this->getDestUser())) {
|
||||
if (0 !== \count($this->getDestUser())) {
|
||||
$context->buildViolation('workflow.No dest users when the workflow is finalized')
|
||||
->atPath('finalizeAfter')
|
||||
->addViolation();
|
||||
}
|
||||
} else {
|
||||
if (0 === count($this->getDestUser())) {
|
||||
if (0 === \count($this->getDestUser())) {
|
||||
$context->buildViolation('workflow.The next step must count at least one dest')
|
||||
->atPath('finalizeAfter')
|
||||
->addViolation();
|
||||
|
Reference in New Issue
Block a user