Browse Source

Use ::class

Dariusz Ruminski 7 years ago
parent
commit
3c6d89b29b

+ 1 - 1
tests/AutoReview/FixerTest.php

@@ -187,7 +187,7 @@ final class FixerTest extends TestCase
         $this->assertInstanceOf(\PhpCsFixer\FixerConfiguration\FixerConfigurationResolverInterface::class, $configurationDefinition);
 
         foreach ($configurationDefinition->getOptions() as $option) {
-            $this->assertInstanceOf('PhpCsFixer\FixerConfiguration\FixerOption', $option);
+            $this->assertInstanceOf(\PhpCsFixer\FixerConfiguration\FixerOption::class, $option);
             $this->assertNotEmpty($option->getDescription());
 
             $this->assertSame(

+ 1 - 1
tests/AutoReview/ProjectFixerConfigurationTest.php

@@ -30,7 +30,7 @@ final class ProjectFixerConfigurationTest extends TestCase
         /** @var \PhpCsFixer\Config $config */
         $config = require __DIR__.'/../../.php_cs.dist';
 
-        $this->assertInstanceOf('PhpCsFixer\Config', $config);
+        $this->assertInstanceOf(\PhpCsFixer\Config::class, $config);
         $this->assertEmpty($config->getCustomFixers());
         $this->assertNotEmpty($config->getRules());
 

+ 1 - 1
tests/Cache/FileCacheManagerTest.php

@@ -45,7 +45,7 @@ final class FileCacheManagerTest extends TestCase
         $signature = $this->prophesize(\PhpCsFixer\Cache\SignatureInterface::class)->reveal();
 
         $handlerProphecy = $this->prophesize(\PhpCsFixer\Cache\FileHandlerInterface::class);
-        $handlerProphecy = $this->prophesize('PhpCsFixer\Cache\FileHandlerInterface');
+        $handlerProphecy = $this->prophesize(\PhpCsFixer\Cache\FileHandlerInterface::class);
         $handlerProphecy->read()->shouldBeCalled()->willReturn(null);
         $handlerProphecy->write(Argument::that(function (CacheInterface $cache) use ($signature) {
             return $cache->getSignature() === $signature;

+ 2 - 2
tests/Console/Command/DescribeCommandTest.php

@@ -148,7 +148,7 @@ EOT;
 
         $commandTester = new CommandTester($command);
 
-        $this->setExpectedExceptionRegExp('InvalidArgumentException', '#^Set "@NoSuchSet" not found\.$#');
+        $this->setExpectedExceptionRegExp(\InvalidArgumentException::class, '#^Set "@NoSuchSet" not found\.$#');
         $commandTester->execute([
             'command' => $command->getName(),
             'name' => '@NoSuchSet',
@@ -171,7 +171,7 @@ EOT;
 
     public function testGetAlternativeSuggestion()
     {
-        $this->setExpectedExceptionRegExp('InvalidArgumentException', '#^Rule "Foo2/bar" not found\. Did you mean "Foo/bar"\?$#');
+        $this->setExpectedExceptionRegExp(\InvalidArgumentException::class, '#^Rule "Foo2/bar" not found\. Did you mean "Foo/bar"\?$#');
         $this->execute('Foo2/bar', false);
     }
 

+ 1 - 1
tests/Console/Command/DescribeNameNotFoundExceptionTest.php

@@ -31,7 +31,7 @@ final class DescribeNameNotFoundExceptionTest extends TestCase
             'weird'
         );
 
-        $this->assertInstanceOf('InvalidArgumentException', $exception);
+        $this->assertInstanceOf(\InvalidArgumentException::class, $exception);
     }
 
     public function testConstructorSetsValues()

+ 1 - 1
tests/Console/ConfigurationResolverTest.php

@@ -357,7 +357,7 @@ final class ConfigurationResolverTest extends TestCase
             ''
         );
 
-        $this->assertInstanceOf('PhpCsFixer\Console\ConfigurationResolver', $resolver);
+        $this->assertInstanceOf(\PhpCsFixer\Console\ConfigurationResolver::class, $resolver);
     }
 
     public function testResolvePathRelativeA()

+ 3 - 3
tests/DocBlock/AnnotationTest.php

@@ -335,9 +335,9 @@ final class AnnotationTest extends TestCase
         return [
             [['Foo', 'null'], ['Bar[]'], '     * @param Foo|null $foo', '     * @param Bar[] $foo'],
             [['false'], ['bool'], '*   @return            false', '*   @return            bool'],
-            [['RUNTIMEEEEeXCEPTION'], ['Throwable'], "* \t@throws\t  \t RUNTIMEEEEeXCEPTION\t\t\t\t\t\t\t\n\n\n", "* \t@throws\t  \t Throwable\t\t\t\t\t\t\t\n\n\n"],
-            [['RUNTIMEEEEeXCEPTION'], ['Throwable'], "*\t@throws\t  \t RUNTIMEEEEeXCEPTION\t\t\t\t\t\t\t\n\n\n", "*\t@throws\t  \t Throwable\t\t\t\t\t\t\t\n\n\n"],
-            [['RUNTIMEEEEeXCEPTION'], ['Throwable'], "*@throws\t  \t RUNTIMEEEEeXCEPTION\t\t\t\t\t\t\t\n\n\n", "*@throws\t  \t Throwable\t\t\t\t\t\t\t\n\n\n"],
+            [['RUNTIMEEEEeXCEPTION'], [\Throwable::class], "* \t@throws\t  \t RUNTIMEEEEeXCEPTION\t\t\t\t\t\t\t\n\n\n", "* \t@throws\t  \t Throwable\t\t\t\t\t\t\t\n\n\n"],
+            [['RUNTIMEEEEeXCEPTION'], [\Throwable::class], "*\t@throws\t  \t RUNTIMEEEEeXCEPTION\t\t\t\t\t\t\t\n\n\n", "*\t@throws\t  \t Throwable\t\t\t\t\t\t\t\n\n\n"],
+            [['RUNTIMEEEEeXCEPTION'], [\Throwable::class], "*@throws\t  \t RUNTIMEEEEeXCEPTION\t\t\t\t\t\t\t\n\n\n", "*@throws\t  \t Throwable\t\t\t\t\t\t\t\n\n\n"],
             [['string'], ['string', 'null'], ' * @method string getString()', ' * @method string|null getString()'],
         ];
     }

+ 1 - 1
tests/Linter/LintingExceptionTest.php

@@ -28,7 +28,7 @@ final class LintingExceptionTest extends TestCase
     {
         $exception = new LintingException();
 
-        $this->assertInstanceOf('RuntimeException', $exception);
+        $this->assertInstanceOf(\RuntimeException::class, $exception);
     }
 
     public function testConstructorSetsValues()

+ 1 - 1
tests/Linter/UnavailableLinterExceptionTest.php

@@ -28,7 +28,7 @@ final class UnavailableLinterExceptionTest extends TestCase
     {
         $exception = new UnavailableLinterException();
 
-        $this->assertInstanceOf('RuntimeException', $exception);
+        $this->assertInstanceOf(\RuntimeException::class, $exception);
     }
 
     public function testConstructorSetsValues()

+ 3 - 3
tests/Tokenizer/TokenTest.php

@@ -304,9 +304,9 @@ final class TokenTest extends TestCase
         return [
             [[T_FOREACH, 'foreach'], T_FOREACH, 'foreach', true],
             ['(', null, '(', false],
-            [123, null, null, null, 'InvalidArgumentException'],
-            [false, null, null, null, 'InvalidArgumentException'],
-            [null, null, null, null, 'InvalidArgumentException'],
+            [123, null, null, null, \InvalidArgumentException::class],
+            [false, null, null, null, \InvalidArgumentException::class],
+            [null, null, null, null, \InvalidArgumentException::class],
         ];
     }