Skip to content
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

Cannot register class as a service with parent::FOO as default ctor argument #231

ondrejmirtes opened this issue Jan 24, 2020 · 2 comments


Copy link

@ondrejmirtes ondrejmirtes commented Jan 24, 2020

Version: 3.0.3

Bug Description

Steps To Reproduce

Class Hoa\File\Read looks like this:

    public function __construct(
        $mode    = parent::MODE_READ,
        $context = null,
        $wait    = false
    ) {
        parent::__construct($streamName, $mode, $context, $wait);


I try to register it like this:

		class: Hoa\Compiler\Llk\Parser
		factory: Hoa\Compiler\Llk\Llk::load(@regexGrammarStream)

		class: Hoa\File\Read
			streamName: 'hoa://Library/Regex/Grammar.pp'

It crashes like this:

In Resolver.php line 397:

  Service 'regexGrammarStream' (type of Hoa\File\Read): Unable to resolve constant parent::MODE_REA
  D used as default value of $mode in __construct().

In Reflection.php line 88:

  Unable to resolve constant parent::MODE_READ used as default value of $mode in Hoa\File\Read::__c

In Reflection.php line 85:

  Class parent does not exist

Expected Behavior

Service is registered and ready to use.

Possible Solution

Correctly resolve special static class names like self, static, parent.

Copy link

@dg dg commented Jan 24, 2020

self should be handled correctly, static is not allowed in PHP, parent is fixed.

Copy link
Contributor Author

@ondrejmirtes ondrejmirtes commented Jan 24, 2020

Thank you! Looking forward to a release :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants