Skip to content

Commit 8eea52a

Browse files
committed
Use ::class keyword when possible
1 parent bf87861 commit 8eea52a

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

Tests/DefinitionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testSetInitialPlaces()
3636

3737
public function testSetInitialPlaceAndPlaceIsNotDefined()
3838
{
39-
$this->expectException('Symfony\Component\Workflow\Exception\LogicException');
39+
$this->expectException(\Symfony\Component\Workflow\Exception\LogicException::class);
4040
$this->expectExceptionMessage('Place "d" cannot be the initial place as it does not exist.');
4141
new Definition([], [], 'd');
4242
}
@@ -54,7 +54,7 @@ public function testAddTransition()
5454

5555
public function testAddTransitionAndFromPlaceIsNotDefined()
5656
{
57-
$this->expectException('Symfony\Component\Workflow\Exception\LogicException');
57+
$this->expectException(\Symfony\Component\Workflow\Exception\LogicException::class);
5858
$this->expectExceptionMessage('Place "c" referenced in transition "name" does not exist.');
5959
$places = range('a', 'b');
6060

@@ -63,7 +63,7 @@ public function testAddTransitionAndFromPlaceIsNotDefined()
6363

6464
public function testAddTransitionAndToPlaceIsNotDefined()
6565
{
66-
$this->expectException('Symfony\Component\Workflow\Exception\LogicException');
66+
$this->expectException(\Symfony\Component\Workflow\Exception\LogicException::class);
6767
$this->expectExceptionMessage('Place "c" referenced in transition "name" does not exist.');
6868
$places = range('a', 'b');
6969

Tests/Metadata/InMemoryMetadataStoreTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function testGetMetadata()
7777

7878
public function testGetMetadataWithUnknownType()
7979
{
80-
$this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
80+
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidArgumentException::class);
8181
$this->expectExceptionMessage('Could not find a MetadataBag for the subject of type "boolean".');
8282
$this->store->getMetadata('title', true);
8383
}

Tests/RegistryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testGetWithSuccess()
6161

6262
public function testGetWithMultipleMatch()
6363
{
64-
$this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
64+
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidArgumentException::class);
6565
$this->expectExceptionMessage('Too many workflows (workflow2, workflow3) match this subject (Symfony\Component\Workflow\Tests\Subject2); set a different name on each and use the second (name) argument of this method.');
6666
$w1 = $this->registry->get(new Subject2());
6767
$this->assertInstanceOf(Workflow::class, $w1);
@@ -70,7 +70,7 @@ public function testGetWithMultipleMatch()
7070

7171
public function testGetWithNoMatch()
7272
{
73-
$this->expectException('Symfony\Component\Workflow\Exception\InvalidArgumentException');
73+
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidArgumentException::class);
7474
$this->expectExceptionMessage('Unable to find a workflow for class "stdClass".');
7575
$w1 = $this->registry->get(new \stdClass());
7676
$this->assertInstanceOf(Workflow::class, $w1);

Tests/Validator/StateMachineValidatorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class StateMachineValidatorTest extends TestCase
1111
{
1212
public function testWithMultipleTransitionWithSameNameShareInput()
1313
{
14-
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
14+
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
1515
$this->expectExceptionMessage('A transition from a place/state must have an unique name.');
1616
$places = ['a', 'b', 'c'];
1717
$transitions[] = new Transition('t1', 'a', 'b');
@@ -35,7 +35,7 @@ public function testWithMultipleTransitionWithSameNameShareInput()
3535

3636
public function testWithMultipleTos()
3737
{
38-
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
38+
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
3939
$this->expectExceptionMessage('A transition in StateMachine can only have one output.');
4040
$places = ['a', 'b', 'c'];
4141
$transitions[] = new Transition('t1', 'a', ['b', 'c']);
@@ -58,7 +58,7 @@ public function testWithMultipleTos()
5858

5959
public function testWithMultipleFroms()
6060
{
61-
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
61+
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
6262
$this->expectExceptionMessage('A transition in StateMachine can only have one input.');
6363
$places = ['a', 'b', 'c'];
6464
$transitions[] = new Transition('t1', ['a', 'b'], 'c');
@@ -106,7 +106,7 @@ public function testValid()
106106

107107
public function testWithTooManyInitialPlaces()
108108
{
109-
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
109+
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
110110
$this->expectExceptionMessage('The state machine "foo" can not store many places. But the definition has 2 initial places. Only one is supported.');
111111
$places = range('a', 'c');
112112
$transitions = [];

Tests/Validator/WorkflowValidatorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class WorkflowValidatorTest extends TestCase
1414

1515
public function testSinglePlaceWorkflowValidatorAndComplexWorkflow()
1616
{
17-
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
17+
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
1818
$this->expectExceptionMessage('The marking store of workflow "foo" can not store many places.');
1919
$definition = $this->createComplexWorkflowDefinition();
2020

@@ -33,7 +33,7 @@ public function testSinglePlaceWorkflowValidatorAndSimpleWorkflow()
3333

3434
public function testWorkflowWithInvalidNames()
3535
{
36-
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
36+
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
3737
$this->expectExceptionMessage('All transitions for a place must have an unique name. Multiple transitions named "t1" where found for place "a" in workflow "foo".');
3838
$places = range('a', 'c');
3939

@@ -49,7 +49,7 @@ public function testWorkflowWithInvalidNames()
4949

5050
public function testWithTooManyInitialPlaces()
5151
{
52-
$this->expectException('Symfony\Component\Workflow\Exception\InvalidDefinitionException');
52+
$this->expectException(\Symfony\Component\Workflow\Exception\InvalidDefinitionException::class);
5353
$this->expectExceptionMessage('The marking store of workflow "foo" can not store many places. But the definition has 2 initial places. Only one is supported.');
5454
$places = range('a', 'c');
5555
$transitions = [];

Tests/WorkflowTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class WorkflowTest extends TestCase
2222

2323
public function testGetMarkingWithInvalidStoreReturn()
2424
{
25-
$this->expectException('Symfony\Component\Workflow\Exception\LogicException');
25+
$this->expectException(\Symfony\Component\Workflow\Exception\LogicException::class);
2626
$this->expectExceptionMessage('The value returned by the MarkingStore is not an instance of "Symfony\Component\Workflow\Marking" for workflow "unnamed".');
2727
$subject = new Subject();
2828
$workflow = new Workflow(new Definition([], []), $this->getMockBuilder(MarkingStoreInterface::class)->getMock());
@@ -32,7 +32,7 @@ public function testGetMarkingWithInvalidStoreReturn()
3232

3333
public function testGetMarkingWithEmptyDefinition()
3434
{
35-
$this->expectException('Symfony\Component\Workflow\Exception\LogicException');
35+
$this->expectException(\Symfony\Component\Workflow\Exception\LogicException::class);
3636
$this->expectExceptionMessage('The Marking is empty and there is no initial place for workflow "unnamed".');
3737
$subject = new Subject();
3838
$workflow = new Workflow(new Definition([], []), new MethodMarkingStore());
@@ -42,7 +42,7 @@ public function testGetMarkingWithEmptyDefinition()
4242

4343
public function testGetMarkingWithImpossiblePlace()
4444
{
45-
$this->expectException('Symfony\Component\Workflow\Exception\LogicException');
45+
$this->expectException(\Symfony\Component\Workflow\Exception\LogicException::class);
4646
$this->expectExceptionMessage('Place "nope" is not valid for workflow "unnamed".');
4747
$subject = new Subject();
4848
$subject->setMarking(['nope' => 1]);
@@ -169,7 +169,7 @@ public function testCanWithSameNameTransition()
169169

170170
public function testBuildTransitionBlockerListReturnsUndefinedTransition()
171171
{
172-
$this->expectException('Symfony\Component\Workflow\Exception\UndefinedTransitionException');
172+
$this->expectException(\Symfony\Component\Workflow\Exception\UndefinedTransitionException::class);
173173
$this->expectExceptionMessage('Transition "404 Not Found" is not defined for workflow "unnamed".');
174174
$definition = $this->createSimpleWorkflowDefinition();
175175
$subject = new Subject();
@@ -249,7 +249,7 @@ public function testBuildTransitionBlockerListReturnsReasonsProvidedInGuards()
249249

250250
public function testApplyWithNotExisingTransition()
251251
{
252-
$this->expectException('Symfony\Component\Workflow\Exception\UndefinedTransitionException');
252+
$this->expectException(\Symfony\Component\Workflow\Exception\UndefinedTransitionException::class);
253253
$this->expectExceptionMessage('Transition "404 Not Found" is not defined for workflow "unnamed".');
254254
$definition = $this->createComplexWorkflowDefinition();
255255
$subject = new Subject();

0 commit comments

Comments
 (0)