Mercurial > hg > isophonics-drupal-site
diff vendor/psy/psysh/src/CodeCleaner/ValidClassNamePass.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 5fb285c0d0e3 |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/vendor/psy/psysh/src/CodeCleaner/ValidClassNamePass.php Thu Apr 26 11:26:54 2018 +0100 +++ b/vendor/psy/psysh/src/CodeCleaner/ValidClassNamePass.php Tue Jul 10 15:07:59 2018 +0100 @@ -38,13 +38,11 @@ const INTERFACE_TYPE = 'interface'; const TRAIT_TYPE = 'trait'; - protected $checkTraits; private $conditionalScopes = 0; private $atLeastPhp55; public function __construct() { - $this->checkTraits = function_exists('trait_exists'); $this->atLeastPhp55 = version_compare(PHP_VERSION, '5.5', '>='); } @@ -117,7 +115,7 @@ */ protected function validateClassStatement(Class_ $stmt) { - $this->ensureCanDefine($stmt); + $this->ensureCanDefine($stmt, self::CLASS_TYPE); if (isset($stmt->extends)) { $this->ensureClassExists($this->getFullyQualifiedName($stmt->extends), $stmt); } @@ -131,7 +129,7 @@ */ protected function validateInterfaceStatement(Interface_ $stmt) { - $this->ensureCanDefine($stmt); + $this->ensureCanDefine($stmt, self::INTERFACE_TYPE); $this->ensureInterfacesExist($stmt->extends, $stmt); } @@ -142,7 +140,7 @@ */ protected function validateTraitStatement(Trait_ $stmt) { - $this->ensureCanDefine($stmt); + $this->ensureCanDefine($stmt, self::TRAIT_TYPE); } /** @@ -194,9 +192,10 @@ * * @throws FatalErrorException * - * @param Stmt $stmt + * @param Stmt $stmt + * @param string $scopeType */ - protected function ensureCanDefine(Stmt $stmt) + protected function ensureCanDefine(Stmt $stmt, $scopeType = self::CLASS_TYPE) { $name = $this->getFullyQualifiedName($stmt->name); @@ -216,7 +215,7 @@ // Store creation for the rest of this code snippet so we can find local // issue too - $this->currentScope[strtolower($name)] = $this->getScopeType($stmt); + $this->currentScope[strtolower($name)] = $scopeType; } /** @@ -304,6 +303,9 @@ /** * Get a symbol type key for storing in the scope name cache. * + * @deprecated No longer used. Scope type should be passed into ensureCanDefine directly. + * @codeCoverageIgnore + * * @param Stmt $stmt * * @return string @@ -361,7 +363,7 @@ */ protected function traitExists($name) { - return $this->checkTraits && (trait_exists($name) || $this->findInScope($name) === self::TRAIT_TYPE); + return trait_exists($name) || $this->findInScope($name) === self::TRAIT_TYPE; } /**