Skip to content

Commit f720444

Browse files
committed
minor symfony#19187 [Workflow] CS tweaks (ro0NL)
This PR was squashed before being merged into the 3.2-dev branch (closes symfony#19187). Discussion ---------- [Workflow] CS tweaks | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ Just a few minor tweaks/fixes after playing around with it. Some phpdoc should still be added imo, like missing `@throws`, right? Commits ------- 5428a92 [Workflow] CS tweaks
2 parents 764228f + 5428a92 commit f720444

File tree

13 files changed

+25
-36
lines changed

13 files changed

+25
-36
lines changed

src/Symfony/Component/Workflow/Definition.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
class Definition
2222
{
2323
private $places = array();
24-
2524
private $transitions = array();
26-
2725
private $initialPlace;
2826

2927
/**

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@
2222
class Event extends BaseEvent
2323
{
2424
private $subject;
25-
2625
private $marking;
27-
2826
private $transition;
2927

3028
/**
3129
* Event constructor.
3230
*
33-
* @param mixed $subject
31+
* @param object $subject
3432
* @param Marking $marking
3533
* @param Transition $transition
3634
*/

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ public function __construct(LoggerInterface $logger)
3030
public function onLeave(Event $event)
3131
{
3232
foreach ($event->getTransition()->getFroms() as $place) {
33-
$this->logger->info(sprintf('leaving "%s" for subject of class "%s"', $place, get_class($event->getSubject())));
33+
$this->logger->info(sprintf('Leaving "%s" for subject of class "%s".', $place, get_class($event->getSubject())));
3434
}
3535
}
3636

3737
public function onTransition(Event $event)
3838
{
39-
$this->logger->info(sprintf('transition "%s" for subject of class "%s"', $event->getTransition()->getName(), get_class($event->getSubject())));
39+
$this->logger->info(sprintf('Transition "%s" for subject of class "%s".', $event->getTransition()->getName(), get_class($event->getSubject())));
4040
}
4141

4242
public function onEnter(Event $event)
4343
{
4444
foreach ($event->getTransition()->getTos() as $place) {
45-
$this->logger->info(sprintf('entering "%s" for subject of class "%s"', $place, get_class($event->getSubject())));
45+
$this->logger->info(sprintf('Entering "%s" for subject of class "%s".', $place, get_class($event->getSubject())));
4646
}
4747
}
4848

src/Symfony/Component/Workflow/MarkingStore/PropertyAccessorMarkingStore.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
class PropertyAccessorMarkingStore implements MarkingStoreInterface
2424
{
2525
private $property;
26-
2726
private $propertyAccessor;
2827

2928
/**

src/Symfony/Component/Workflow/MarkingStore/ScalarMarkingStore.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
class ScalarMarkingStore implements MarkingStoreInterface, UniqueTransitionOutputInterface
2424
{
2525
private $property;
26-
2726
private $propertyAccessor;
2827

2928
/**

src/Symfony/Component/Workflow/Registry.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ class Registry
2323

2424
/**
2525
* @param Workflow $workflow
26-
* @param string $classname
26+
* @param string $className
2727
*/
28-
public function add(Workflow $workflow, $classname)
28+
public function add(Workflow $workflow, $className)
2929
{
30-
$this->workflows[] = array($workflow, $classname);
30+
$this->workflows[] = array($workflow, $className);
3131
}
3232

3333
public function get($subject, $workflowName = null)
3434
{
3535
$matched = null;
3636

37-
foreach ($this->workflows as list($workflow, $classname)) {
38-
if ($this->supports($workflow, $classname, $subject, $workflowName)) {
37+
foreach ($this->workflows as list($workflow, $className)) {
38+
if ($this->supports($workflow, $className, $subject, $workflowName)) {
3939
if ($matched) {
4040
throw new InvalidArgumentException('At least two workflows match this subject. Set a different name on each and use the second (name) argument of this method.');
4141
}
@@ -50,9 +50,9 @@ public function get($subject, $workflowName = null)
5050
return $matched;
5151
}
5252

53-
private function supports(Workflow $workflow, $classname, $subject, $name)
53+
private function supports(Workflow $workflow, $className, $subject, $name)
5454
{
55-
if (!$subject instanceof $classname) {
55+
if (!$subject instanceof $className) {
5656
return false;
5757
}
5858

src/Symfony/Component/Workflow/Tests/DefinitionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testSetInitialPlace()
2828
}
2929

3030
/**
31-
* @expectedException Symfony\Component\Workflow\Exception\LogicException
31+
* @expectedException \Symfony\Component\Workflow\Exception\LogicException
3232
* @expectedExceptionMessage Place "d" cannot be the initial place as it does not exist.
3333
*/
3434
public function testSetInitialPlaceAndPlaceIsNotDefined()
@@ -50,7 +50,7 @@ public function testAddTransition()
5050
}
5151

5252
/**
53-
* @expectedException Symfony\Component\Workflow\Exception\LogicException
53+
* @expectedException \Symfony\Component\Workflow\Exception\LogicException
5454
* @expectedExceptionMessage Place "c" referenced in transition "name" does not exist.
5555
*/
5656
public function testAddTransitionAndFromPlaceIsNotDefined()
@@ -61,7 +61,7 @@ public function testAddTransitionAndFromPlaceIsNotDefined()
6161
}
6262

6363
/**
64-
* @expectedException Symfony\Component\Workflow\Exception\LogicException
64+
* @expectedException \Symfony\Component\Workflow\Exception\LogicException
6565
* @expectedExceptionMessage Place "c" referenced in transition "name" does not exist.
6666
*/
6767
public function testAddTransitionAndToPlaceIsNotDefined()

src/Symfony/Component/Workflow/Tests/EventListener/AuditTrailListenerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public function testItWorks()
3434
$workflow->apply($object, 't1');
3535

3636
$expected = array(
37-
'leaving "a" for subject of class "stdClass"',
38-
'transition "t1" for subject of class "stdClass"',
39-
'entering "b" for subject of class "stdClass"',
37+
'Leaving "a" for subject of class "stdClass".',
38+
'Transition "t1" for subject of class "stdClass".',
39+
'Entering "b" for subject of class "stdClass".',
4040
);
4141

4242
$this->assertSame($expected, $logger->logs);

src/Symfony/Component/Workflow/Tests/RegistryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testGetWithSuccess()
4444
}
4545

4646
/**
47-
* @expectedException Symfony\Component\Workflow\Exception\InvalidArgumentException
47+
* @expectedException \Symfony\Component\Workflow\Exception\InvalidArgumentException
4848
* @expectedExceptionMessage At least two workflows match this subject. Set a different name on each and use the second (name) argument of this method.
4949
*/
5050
public function testGetWithMultipleMatch()

src/Symfony/Component/Workflow/Tests/TransitionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class TransitionTest extends \PHPUnit_Framework_TestCase
88
{
99
/**
10-
* @expectedException Symfony\Component\Workflow\Exception\InvalidArgumentException
10+
* @expectedException \Symfony\Component\Workflow\Exception\InvalidArgumentException
1111
* @expectedExceptionMessage The transition "foo.bar" contains invalid characters.
1212
*/
1313
public function testValidateName()

0 commit comments

Comments
 (0)