Skip to content

Commit cff3d37

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Use ::class keyword when possible
2 parents 4a64d5a + 082fd04 commit cff3d37

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

DeprecationErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ private function displayDeprecations($groups, $configuration, $isFailing)
330330
private static function getPhpUnitErrorHandler()
331331
{
332332
if (!isset(self::$isAtLeastPhpUnit83)) {
333-
self::$isAtLeastPhpUnit83 = class_exists('PHPUnit\Util\ErrorHandler') && method_exists('PHPUnit\Util\ErrorHandler', '__invoke');
333+
self::$isAtLeastPhpUnit83 = class_exists(ErrorHandler::class) && method_exists(ErrorHandler::class, '__invoke');
334334
}
335335
if (!self::$isAtLeastPhpUnit83) {
336336
return 'PHPUnit\Util\ErrorHandler::handleError';

Legacy/SymfonyTestsListenerTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ public function startTestSuite($suite)
135135
echo "Testing $suiteName\n";
136136
$this->state = 0;
137137

138-
if (!class_exists('Doctrine\Common\Annotations\AnnotationRegistry', false) && class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
139-
if (method_exists('Doctrine\Common\Annotations\AnnotationRegistry', 'registerUniqueLoader')) {
138+
if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
139+
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
140140
AnnotationRegistry::registerUniqueLoader('class_exists');
141141
} else {
142142
AnnotationRegistry::registerLoader('class_exists');

Tests/Fixtures/coverage/tests/BarCovTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class BarCovTest extends TestCase
1717
{
1818
public function testBarCov()
1919
{
20-
if (!class_exists('PhpUnitCoverageTest\FooCov')) {
20+
if (!class_exists(\PhpUnitCoverageTest\FooCov::class)) {
2121
$this->markTestSkipped('This test is not part of the main Symfony test suite. It\'s here to test the CoverageListener.');
2222
}
2323

Tests/ProcessIsolationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testIsolation()
2424

2525
public function testCallingOtherErrorHandler()
2626
{
27-
$this->expectException('PHPUnit\Framework\Exception');
27+
$this->expectException(\PHPUnit\Framework\Exception::class);
2828
$this->expectExceptionMessage('Test that PHPUnit\'s error handler fires.');
2929

3030
trigger_error('Test that PHPUnit\'s error handler fires.', \E_USER_WARNING);

bin/simple-phpunit.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,17 @@
263263
define('PHPUNIT_COMPOSER_INSTALL', __DIR__.'/vendor/autoload.php');
264264
require PHPUNIT_COMPOSER_INSTALL;
265265
266-
if (!class_exists('SymfonyExcludeListPhpunit', false)) {
266+
if (!class_exists(\SymfonyExcludeListPhpunit::class, false)) {
267267
class SymfonyExcludeListPhpunit {}
268268
}
269-
if (method_exists('PHPUnit\Util\ExcludeList', 'addDirectory')) {
269+
if (method_exists(\PHPUnit\Util\ExcludeList::class, 'addDirectory')) {
270270
(new PHPUnit\Util\Excludelist())->getExcludedDirectories();
271-
PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListPhpunit'))->getFileName()));
272-
class_exists('SymfonyExcludeListSimplePhpunit', false) && PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
273-
} elseif (method_exists('PHPUnit\Util\Blacklist', 'addDirectory')) {
271+
PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListPhpunit::class))->getFileName()));
272+
class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\ExcludeList::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListSimplePhpunit::class))->getFileName()));
273+
} elseif (method_exists(\PHPUnit\Util\Blacklist::class, 'addDirectory')) {
274274
(new PHPUnit\Util\BlackList())->getBlacklistedDirectories();
275-
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListPhpunit'))->getFileName()));
276-
class_exists('SymfonyExcludeListSimplePhpunit', false) && PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass('SymfonyExcludeListSimplePhpunit'))->getFileName()));
275+
PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListPhpunit::class))->getFileName()));
276+
class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Blacklist::addDirectory(\dirname((new \ReflectionClass(\SymfonyExcludeListSimplePhpunit::class))->getFileName()));
277277
} else {
278278
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListPhpunit'] = 1;
279279
PHPUnit\Util\Blacklist::$blacklistedClassNames['SymfonyExcludeListSimplePhpunit'] = 1;
@@ -398,7 +398,7 @@ class_exists('SymfonyExcludeListSimplePhpunit', false) && PHPUnit\Util\Blacklist
398398
}
399399
}
400400
} elseif (!isset($argv[1]) || 'install' !== $argv[1] || file_exists('install')) {
401-
if (!class_exists('SymfonyExcludeListSimplePhpunit', false)) {
401+
if (!class_exists(\SymfonyExcludeListSimplePhpunit::class, false)) {
402402
class SymfonyExcludeListSimplePhpunit
403403
{
404404
}

bootstrap.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Doctrine\Common\Annotations\AnnotationRegistry;
1313
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;
1414

15-
if (class_exists('PHPUnit_Runner_Version') && version_compare(\PHPUnit_Runner_Version::id(), '6.0.0', '<')) {
15+
if (class_exists(\PHPUnit_Runner_Version::class) && version_compare(\PHPUnit_Runner_Version::id(), '6.0.0', '<')) {
1616
$classes = [
1717
'PHPUnit_Framework_Assert', // override PhpUnit's ForwardCompat child class
1818
'PHPUnit_Framework_AssertionFailedError', // override PhpUnit's ForwardCompat child class
@@ -110,15 +110,15 @@ class_alias('PHPUnit_Framework_Error', 'PHPUnit\Framework\Error\Error');
110110
}
111111

112112
// Detect if we're loaded by an actual run of phpunit
113-
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists('PHPUnit_TextUI_Command', false) && !class_exists('PHPUnit\TextUI\Command', false)) {
113+
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists(\PHPUnit_TextUI_Command::class, false) && !class_exists(\PHPUnit\TextUI\Command::class, false)) {
114114
return;
115115
}
116116

117117
// Enforce a consistent locale
118118
setlocale(\LC_ALL, 'C');
119119

120-
if (!class_exists('Doctrine\Common\Annotations\AnnotationRegistry', false) && class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
121-
if (method_exists('Doctrine\Common\Annotations\AnnotationRegistry', 'registerUniqueLoader')) {
120+
if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
121+
if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
122122
AnnotationRegistry::registerUniqueLoader('class_exists');
123123
} else {
124124
AnnotationRegistry::registerLoader('class_exists');

0 commit comments

Comments
 (0)