-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
ExtensionsExtension: Fix type hint of RC #209
Conversation
edf67d2
to
b365d4c
Compare
@@ -30,8 +30,9 @@ public function loadConfiguration() | |||
$name = null; | |||
} | |||
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 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, we don't know if the $rcExtension
is CompilerExtension, and it is expected that it might throw a TypeError.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, it is better to use assert($rcExtension instanceof CompilerExtension)
Locally defined annotations are hack to satisfy IDE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, there should be checking and throwing an exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert
should be used instead of local annotations for internal behavior, to be exact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented exception, but I'm not sure about the message.
89b7ae6
to
c60c7ff
Compare
fecd1fb
to
15978c3
Compare
Fix type hint and solve error: