8000 Refactor static variable to static property · symfony/symfony@f613ebf · GitHub
[go: up one dir, main page]

Skip to content

Commit f613ebf

Browse files
committed
Refactor static variable to static property
This is slightly less weird than a static local variable.
1 parent cc6e2bb commit f613ebf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ class DeprecationErrorHandler
2525

2626
private static $isRegistered = false;
2727

28+
/** @var string[] absolute paths to vendor directories */
29+
private static $vendors;
30+
2831
/**
2932
* Registers and configures the deprecation handler.
3033
*
@@ -294,23 +297,20 @@ private static function getPackage(string $path): string
294297

295298
private static function getVendors(): array
296299
{
297-
/** @var string[] absolute paths to vendor directories */
298-
static $vendors;
299-
300-
if (null === $vendors) {
301-
$vendors = array();
300+
if (null === self::$vendors) {
301+
self::$vendors = array();
302302
foreach (get_declared_classes() as $class) {
303303
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
304304
$r = new \ReflectionClass($class);
305305
$v = dirname(dirname($r->getFileName()));
306306
if (file_exists($v.'/composer/installed.json')) {
307-
$vendors[] = $v;
307+
self::$vendors[] = $v;
308308
}
309309
}
310310
}
311311
}
312312

313-
return $vendors;
313+
return self::$vendors;
314314
}
315315

316316
private static function inVendors(string $path): bool

0 commit comments

Comments
 (0)
0