comparison vendor/psy/psysh/test/CodeCleaner/ValidClassNamePassTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents c2387f117808
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
170 // static call 170 // static call
171 ['DateTime::createFromFormat()'], 171 ['DateTime::createFromFormat()'],
172 ['DateTime::$someMethod()'], 172 ['DateTime::$someMethod()'],
173 ['Psy\Test\CodeCleaner\Fixtures\ClassWithStatic::doStuff()'], 173 ['Psy\Test\CodeCleaner\Fixtures\ClassWithStatic::doStuff()'],
174 ['Psy\Test\CodeCleaner\Fixtures\ClassWithCallStatic::doStuff()'], 174 ['Psy\Test\CodeCleaner\Fixtures\ClassWithCallStatic::doStuff()'],
175 ['Psy\Test\CodeCleaner\Fixtures\TraitWithStatic::doStuff()'],
175 176
176 // Allow `self` and `static` as class names. 177 // Allow `self` and `static` as class names.
177 [' 178 ['
178 class Psy_Test_CodeCleaner_ValidClassNamePass_ClassWithStatic { 179 class Psy_Test_CodeCleaner_ValidClassNamePass_ClassWithStatic {
179 public static function getInstance() { 180 public static function getInstance() {
303 } 304 }
304 '], 305 '],
305 ]; 306 ];
306 307
307 // Ugh. There's gotta be a better way to test for this. 308 // Ugh. There's gotta be a better way to test for this.
308 if (class_exists('PhpParser\ParserFactory')) { 309 if (\class_exists('PhpParser\ParserFactory')) {
309 // PHP 7.0 anonymous classes, only supported by PHP Parser v2.x 310 // PHP 7.0 anonymous classes, only supported by PHP Parser v2.x
310 $valid[] = ['$obj = new class() {}']; 311 $valid[] = ['$obj = new class() {}'];
311 } 312 }
312 313
313 if (version_compare(PHP_VERSION, '5.5', '>=')) { 314 if (\version_compare(PHP_VERSION, '5.5', '>=')) {
314 $valid[] = ['interface A {} A::class']; 315 $valid[] = ['interface A {} A::class'];
315 $valid[] = ['interface A {} A::CLASS']; 316 $valid[] = ['interface A {} A::CLASS'];
316 $valid[] = ['class A {} A::class']; 317 $valid[] = ['class A {} A::class'];
317 $valid[] = ['class A {} A::CLASS']; 318 $valid[] = ['class A {} A::CLASS'];
318 $valid[] = ['A::class']; 319 $valid[] = ['A::class'];