PHP-Scoper incorrectly scopes `\ReflectionClassConstant`
Closed this issue · 5 comments
bobthecow commented
ReflectionClassConstant::create
tries to decide whether to create an instance of the actual \ReflectionClassConstant
, or our ponyfill. When trying to re-enable PHP-Scoper
it was incorrectly scoping that class name, which caused test failures:
public static function create($class, $name)
{
if (\class_exists('_HumbugBox4f95cd3d5edb\\ReflectionClassConstant')) {
return new \ReflectionClassConstant($class, $name);
}
return new self($class, $name);
}
cc @theofidry
theofidry commented
Maybe it should be fixed via a patched; Also maybe PhpScoper should be
enabled for the most cutting edge PHAR and omit it for the others where you
include various polyfills
…On Sun 1 Dec 2019 at 18:04, Justin Hileman ***@***.***> wrote:
ReflectionClassConstant::create tries fto decide whether to create an
instance of the tactual \ReflectionClassConstant, or our ponyfill. When
trying to re-enable PHP-Scoper it was incorrectly scoping that class
name, which caused test failures:
public static function create($class, $name) { if (\class_exists('_HumbugBox4f95cd3d5edb\\ReflectionClassConstant')) { return new \ReflectionClassConstant($class, $name); } return new self($class, $name); }
cc @theofidry <https://github.com/theofidry>
—
You are receiving this because you were mentioned.
LcReply to this email directly, view it on GitHub
<#581?email_source=notifications&email_token=ABHPVAO4OMR7TRBZCXDJ7ADQWPVAFA5CNFSM4JTMULOKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H5CZFMQ>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHPVAPQA27DQMVX7B772JTQWPVAFANCNFSM4JTMULOA>
.
bobthecow commented
In this case, the ReflectionClassConstant bit is part of PsySH core and is in everything, not optionally just in compatibility builds.
This feels like it might be a bug in PHP Scoper, tbh. the original code was
if (\class_exists('\\ReflectionClassConstant')) {
// ...
… which couldn't be anything but a reference to an internal class.
theofidry commented
Hm indeed
bobthecow commented
@theofidry is there an easy way to work around this on our end while we're waiting for the issue in PHP Scoper to be resolved?