-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Improve static analysis on AttachEntityListenersListener #11272
Conversation
$listenerCallback is supposed to be a method name, so it is safe to require it is not a falsy string.
* @param class-string $entityClass The entity to attach the listener. | ||
* @param class-string $listenerClass The listener class. | ||
* @param Events::*|null $eventName The entity lifecycle event. | ||
* @param non-falsy-string|null $listenerCallback The listener callback method or NULL to use $eventName. | ||
*/ | ||
public function addEntityListener( |
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.
Note: it's unclear to me who/what calls this method. The class is not referenced at all in src
, but it is referenced in the Symfony bundle. I suspect the method might only be there for test purposes. That class was introduced in #850
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.
Possible. I remember when entitylisteners could only be configured with annotations in the entity class itself and there was no way to inject dependencies into the listener's constructor.
* @param class-string $entityClass The entity to attach the listener. | ||
* @param class-string $listenerClass The listener class. | ||
* @param Events::*|null $eventName The entity lifecycle event. | ||
* @param non-falsy-string|null $listenerCallback The listener callback method or NULL to use $eventName. | ||
*/ | ||
public function addEntityListener( |
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.
Possible. I remember when entitylisteners could only be configured with annotations in the entity class itself and there was no way to inject dependencies into the listener's constructor.
Improve static analysis on AttachEntityListenersListener
$listenerCallback
is supposed to be a method name, so it is safe torequire it is not a falsy string.