Skip to content

Commit 902d6cb

Browse files
committed
[Workflow] Added parameter typhint where possible
1 parent c10ad18 commit 902d6cb

20 files changed

+44
-78
lines changed

src/Symfony/Component/Workflow/DefinitionBuilder.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,19 @@ public function clear()
6161
}
6262

6363
/**
64-
* @param string $place
65-
*
6664
* @return $this
6765
*/
68-
public function setInitialPlace($place)
66+
public function setInitialPlace(string $place)
6967
{
7068
$this->initialPlace = $place;
7169

7270
return $this;
7371
}
7472

7573
/**
76-
* @param string $place
77-
*
7874
* @return $this
7975
*/
80-
public function addPlace($place)
76+
public function addPlace(string $place)
8177
{
8278
if (!$this->places) {
8379
$this->initialPlace = $place;

src/Symfony/Component/Workflow/Dumper/DumperInterface.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ interface DumperInterface
2525
/**
2626
* Dumps a workflow definition.
2727
*
28-
* @param Definition $definition A Definition instance
29-
* @param Marking|null $marking A Marking instance
30-
* @param array $options An array of options
31-
*
3228
* @return string The representation of the workflow
3329
*/
3430
public function dump(Definition $definition, Marking $marking = null, array $options = []);

src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,15 @@ protected function endDot()
236236
/**
237237
* @internal
238238
*/
239-
protected function dotize($id)
239+
protected function dotize(string $id)
240240
{
241241
return hash('sha1', $id);
242242
}
243243

244244
/**
245245
* @internal
246246
*/
247-
protected function escape($value): string
247+
protected function escape(string $value): string
248248
{
249249
return \is_bool($value) ? ($value ? '1' : '0') : addslashes($value);
250250
}

src/Symfony/Component/Workflow/Event/Event.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ class Event extends BaseEvent
2727
private $transition;
2828
private $workflow;
2929

30-
/**
31-
* @param object $subject
32-
*/
33-
public function __construct($subject, Marking $marking, Transition $transition = null, WorkflowInterface $workflow = null)
30+
public function __construct(object $subject, Marking $marking, Transition $transition = null, WorkflowInterface $workflow = null)
3431
{
3532
$this->subject = $subject;
3633
$this->marking = $marking;
@@ -63,7 +60,7 @@ public function getWorkflowName()
6360
return $this->workflow->getName();
6461
}
6562

66-
public function getMetadata(string $key, $subject)
63+
public function getMetadata(string $key, object $subject)
6764
{
6865
return $this->workflow->getMetadataStore()->getMetadata($key, $subject);
6966
}

src/Symfony/Component/Workflow/Event/GuardEvent.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Workflow\Transition;
1616
use Symfony\Component\Workflow\TransitionBlocker;
1717
use Symfony\Component\Workflow\TransitionBlockerList;
18+
use Symfony\Component\Workflow\WorkflowInterface;
1819

1920
/**
2021
* @author Fabien Potencier <fabien@symfony.com>
@@ -27,9 +28,9 @@ class GuardEvent extends Event
2728
/**
2829
* {@inheritdoc}
2930
*/
30-
public function __construct($subject, Marking $marking, Transition $transition, $workflowName = null)
31+
public function __construct(object $subject, Marking $marking, Transition $transition, WorkflowInterface $workflow = null)
3132
{
32-
parent::__construct($subject, $marking, $transition, $workflowName);
33+
parent::__construct($subject, $marking, $transition, $workflow);
3334

3435
$this->transitionBlockerList = new TransitionBlockerList();
3536
}

src/Symfony/Component/Workflow/EventListener/GuardExpression.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,9 @@
1616
class GuardExpression
1717
{
1818
private $transition;
19-
2019
private $expression;
2120

22-
/**
23-
* @param string $expression
24-
*/
25-
public function __construct(Transition $transition, $expression)
21+
public function __construct(Transition $transition, string $expression)
2622
{
2723
$this->transition = $transition;
2824
$this->expression = $expression;

src/Symfony/Component/Workflow/EventListener/GuardListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(array $configuration, ExpressionLanguage $expression
4444
$this->validator = $validator;
4545
}
4646

47-
public function onTransition(GuardEvent $event, $eventName)
47+
public function onTransition(GuardEvent $event, string $eventName)
4848
{
4949
if (!isset($this->configuration[$eventName])) {
5050
return;

src/Symfony/Component/Workflow/Exception/NotEnabledTransitionException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class NotEnabledTransitionException extends TransitionException
2323
{
2424
private $transitionBlockerList;
2525

26-
public function __construct($subject, string $transitionName, WorkflowInterface $workflow, TransitionBlockerList $transitionBlockerList)
26+
public function __construct(object $subject, string $transitionName, WorkflowInterface $workflow, TransitionBlockerList $transitionBlockerList)
2727
{
2828
parent::__construct($subject, $transitionName, $workflow, sprintf('Transition "%s" is not enabled for workflow "%s".', $transitionName, $workflow->getName()));
2929

src/Symfony/Component/Workflow/Exception/TransitionException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TransitionException extends LogicException
2323
private $transitionName;
2424
private $workflow;
2525

26-
public function __construct($subject, string $transitionName, WorkflowInterface $workflow, string $message)
26+
public function __construct(object $subject, string $transitionName, WorkflowInterface $workflow, string $message)
2727
{
2828
parent::__construct($message);
2929

src/Symfony/Component/Workflow/Exception/UndefinedTransitionException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class UndefinedTransitionException extends TransitionException
2222
{
23-
public function __construct($subject, string $transitionName, WorkflowInterface $workflow)
23+
public function __construct(object $subject, string $transitionName, WorkflowInterface $workflow)
2424
{
2525
parent::__construct($subject, $transitionName, $workflow, sprintf('Transition "%s" is not defined for workflow "%s".', $transitionName, $workflow->getName()));
2626
}

0 commit comments

Comments
 (0)