Skip to content

Commit 87833be

Browse files
committed
Use ::class keyword when possible
1 parent ceae6bb commit 87833be

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Tests/ApplicationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ public function testFindAmbiguousCommandsIfAllAlternativesAreHidden()
738738
$application->add(new \FooCommand());
739739
$application->add(new \FooHiddenCommand());
740740

741-
$this->assertInstanceOf('FooCommand', $application->find('foo:'));
741+
$this->assertInstanceOf(\FooCommand::class, $application->find('foo:'));
742742
}
743743

744744
public function testSetCatchExceptions()

Tests/Command/CommandTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testConstructor()
4242

4343
public function testCommandNameCannotBeEmpty()
4444
{
45-
$this->expectException('LogicException');
45+
$this->expectException(\LogicException::class);
4646
$this->expectExceptionMessage('The command defined in "Symfony\Component\Console\Command\Command" cannot have an empty name.');
4747
(new Application())->add(new Command());
4848
}
@@ -115,7 +115,7 @@ public function testGetNamespaceGetNameSetName()
115115
*/
116116
public function testInvalidCommandNames($name)
117117
{
118-
$this->expectException('InvalidArgumentException');
118+
$this->expectException(\InvalidArgumentException::class);
119119
$this->expectExceptionMessage(sprintf('Command name "%s" is invalid.', $name));
120120

121121
$command = new \TestCommand();
@@ -207,7 +207,7 @@ public function testGetHelper()
207207

208208
public function testGetHelperWithoutHelperSet()
209209
{
210-
$this->expectException('LogicException');
210+
$this->expectException(\LogicException::class);
211211
$this->expectExceptionMessage('Cannot retrieve helper "formatter" because there is no HelperSet defined.');
212212
$command = new \TestCommand();
213213
$command->getHelper('formatter');
@@ -278,15 +278,15 @@ public function testRunNonInteractive()
278278

279279
public function testExecuteMethodNeedsToBeOverridden()
280280
{
281-
$this->expectException('LogicException');
281+
$this->expectException(\LogicException::class);
282282
$this->expectExceptionMessage('You must override the execute() method in the concrete command class.');
283283
$command = new Command('foo');
284284
$command->run(new StringInput(''), new NullOutput());
285285
}
286286

287287
public function testRunWithInvalidOption()
288288
{
289-
$this->expectException('Symfony\Component\Console\Exception\InvalidOptionException');
289+
$this->expectException(\Symfony\Component\Console\Exception\InvalidOptionException::class);
290290
$this->expectExceptionMessage('The "--bar" option does not exist.');
291291
$command = new \TestCommand();
292292
$tester = new CommandTester($command);

0 commit comments

Comments
 (0)