ExtensionsExtension: Fix type hint of RC#209
Merged
dg merged 2 commits intonette:masterfrom Jul 19, 2019
Merged
Conversation
edf67d2 to
b365d4c
Compare
dg
reviewed
Jul 19, 2019
| if ($class instanceof Nette\DI\Definitions\Statement) { | ||
| $rc = new \ReflectionClass($class->getEntity()); | ||
| $this->compiler->addExtension($name, $rc->newInstanceArgs($class->arguments)); | ||
| /** @var Nette\DI\CompilerExtension $rcExtension */ |
Member
There was a problem hiding this comment.
In fact, we don't know if the $rcExtension is CompilerExtension, and it is expected that it might throw a TypeError.
Contributor
There was a problem hiding this comment.
Btw, it is better to use assert($rcExtension instanceof CompilerExtension)
Locally defined annotations are hack to satisfy IDE
Member
There was a problem hiding this comment.
Ideally, there should be checking and throwing an exception.
Contributor
There was a problem hiding this comment.
assert should be used instead of local annotations for internal behavior, to be exact.
Contributor
Author
There was a problem hiding this comment.
I implemented exception, but I'm not sure about the message.
89b7ae6 to
c60c7ff
Compare
fecd1fb to
15978c3
Compare
dg
pushed a commit
that referenced
this pull request
Jul 19, 2019
dg
pushed a commit
that referenced
this pull request
Aug 7, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix type hint and solve error: