-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
M2.1: "setup:di:compile" doesn't work with the "::class" keyword #5629
Comments
The core issue might be default PHP behaviour, from official PHP manual:
What is the exact point of using such 🆑 via ObjectManager?
? |
This is NOT valid PHP (try it): $drpMsDataHlp = Instance::getInstance()->get(\Unirgy\DropshipMicrosite\Helper\Data); The characters On the other hand, with the $drpMsDataHlp = Instance::getInstance()->get(\Unirgy\DropshipMicrosite\Helper\Data::class); The characters The benefit of using the As far as I can see the error @adragus-inviqa reported is an unhandled PHP tokenizer return value, not a issue of the PHP engine. |
@Vinai: I made a mistake by copy/pasting entire row here, with removal of |
In all fairness, So
|
@adragus-inviqa: I believe that would need to be Quick test: namespace Foo {
class Bar
{
const Baz = 'qux';
}
}
namespace {
echo \Foo\Bar\Baz . PHP_EOL;
} gives
The code
|
Yeah, my nitpicking was moot, as I was refering to a constant. |
Closing, as it seems to be fixed in #1722 |
The same problem as #1722.
Steps to reproduce
$objectManager->get(\My\Class::class)
.php bin/magento setup:di:compile -vvv
Expected result
Actual result
::class
yet in the M2 codebase.Btw, although zendframework/zend-code#70 has the exact same error, I don't think the PR for it is well suited for us.
I think it's better to strenghten this condition in a similar manner as this one: 4cfc4ab.
The text was updated successfully, but these errors were encountered: