diff --git a/phpstan-deprecations.neon b/phpstan-deprecations.neon index bc372e96b..b41a746b9 100644 --- a/phpstan-deprecations.neon +++ b/phpstan-deprecations.neon @@ -927,15 +927,6 @@ parameters: count: 1 path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php - - - message: - """ - #^Parameter \\$trans of method Chill\\\\PersonBundle\\\\Controller\\\\AccompanyingCourseWorkController\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\: - since Symfony 4\\.2, use Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface instead$# - """ - count: 1 - path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php - - message: """ diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php index 247cdf552..876e095a8 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php @@ -167,6 +167,7 @@ class WorkflowController extends AbstractController $handler = $this->entityWorkflowManager->getHandler($entityWorkflow); $workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName()); + $errors = []; if (count($workflow->getEnabledTransitions($entityWorkflow)) > 0) { // possible transition @@ -245,7 +246,7 @@ class WorkflowController extends AbstractController 'handler_template_data' => $handler->getTemplateData($entityWorkflow), 'transition_form' => isset($transitionForm) ? $transitionForm->createView() : null, 'entity_workflow' => $entityWorkflow, - 'transition_form_errors' => $errors ?? [], + 'transition_form_errors' => $errors, //'comment_form' => $commentForm->createView(), ] ); diff --git a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php index ad1b21c79..e4f0aa45d 100644 --- a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php @@ -56,7 +56,7 @@ class EntityWorkflowStepRepository implements ObjectRepository public function getClassName() { - return EntityWorkflow::class; + return EntityWorkflowStep::class; } private function buildQueryByUser(User $user): QueryBuilder diff --git a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php index 41ffd63c2..aaac6b216 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php @@ -32,20 +32,20 @@ final class WorkflowByUserCounter implements NotificationCounterInterface, Event $this->cacheItemPool = $cacheItemPool; } - public function addNotification(UserInterface $user): int + public function addNotification(UserInterface $u): int { - if (!$user instanceof User) { + if (!$u instanceof User) { return 0; } - $key = self::generateCacheKeyWorkflowByUser($user); + $key = self::generateCacheKeyWorkflowByUser($u); $item = $this->cacheItemPool->getItem($key); if ($item->isHit()) { return $item->get(); } - $nb = $this->getCountUnreadByUser($user); + $nb = $this->getCountUnreadByUser($u); $item->set($nb) ->expiresAfter(60 * 15); diff --git a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php index 60b65020e..32f78a548 100644 --- a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php +++ b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php @@ -72,17 +72,18 @@ class MetadataExtractor foreach ($transitions as $transition) { if ($transition->getName() === $transitionName) { - break; + $metadata = $workflow->getMetadataStore()->getTransitionMetadata($transition); + + return [ + 'name' => $transition->getName(), + 'text' => array_key_exists('label', $metadata) ? + $this->translatableStringHelper->localize($metadata['label']) : $transition->getName(), + 'isForward' => $metadata['isForward'] ?? null, + ]; } } - $metadata = $workflow->getMetadataStore()->getTransitionMetadata($transition); - return [ - 'name' => $transition->getName(), - 'text' => array_key_exists('label', $metadata) ? - $this->translatableStringHelper->localize($metadata['label']) : $transition->getName(), - 'isForward' => $metadata['isForward'] ?? null, - ]; + return []; } public function buildArrayPresentationForWorkflow(WorkflowInterface $workflow): array