X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fpsy%2Fpsysh%2Fsrc%2FPsy%2FCodeCleaner%2FValidConstantPass.php;fp=vendor%2Fpsy%2Fpsysh%2Fsrc%2FPsy%2FCodeCleaner%2FValidConstantPass.php;h=e84f3de6661cede28ce53a14311c133ff6cbe47e;hp=abc4d54673853ced5fc5ec344c129e35386336dc;hb=eba34333e3c89f208d2f72fa91351ad019a71583;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae diff --git a/vendor/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php b/vendor/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php index abc4d5467..e84f3de66 100644 --- a/vendor/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php +++ b/vendor/psy/psysh/src/Psy/CodeCleaner/ValidConstantPass.php @@ -45,7 +45,8 @@ class ValidConstantPass extends NamespaceAwarePass if ($node instanceof ConstFetch && count($node->name->parts) > 1) { $name = $this->getFullyQualifiedName($node->name); if (!defined($name)) { - throw new FatalErrorException(sprintf('Undefined constant %s', $name), 0, 1, null, $node->getLine()); + $msg = sprintf('Undefined constant %s', $name); + throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine()); } } elseif ($node instanceof ClassConstFetch) { $this->validateClassConstFetchExpression($node); @@ -73,11 +74,11 @@ class ValidConstantPass extends NamespaceAwarePass // if the class doesn't exist, don't throw an exception… it might be // defined in the same line it's used or something stupid like that. if (class_exists($className) || interface_exists($className)) { - $constName = sprintf('%s::%s', $className, $stmt->name); - if (!defined($constName)) { + $refl = new \ReflectionClass($className); + if (!$refl->hasConstant($stmt->name)) { $constType = class_exists($className) ? 'Class' : 'Interface'; - $msg = sprintf('%s constant \'%s\' not found', $constType, $constName); - throw new FatalErrorException($msg, 0, 1, null, $stmt->getLine()); + $msg = sprintf('%s constant \'%s::%s\' not found', $constType, $className, $stmt->name); + throw new FatalErrorException($msg, 0, E_ERROR, null, $stmt->getLine()); } } }