Trait, inheritance, override and template #11075
Replies: 1 comment
-
Self response: use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Thank you for this amazing tool!
I am playing with traits an inheritance in order to implement logic with default behaviour on a group of classes.
All classes have a
viewable
method, with a default behaviour (access forbidden). When a class must be viewable,viewable
is overriden to implement logic (access granted).Problem is: the logic is added to a parameter
$query
whose the template must be the current class implementing the trait (sidenote:$query
comes from a package).Minimal reproduction: https://phpstan.org/r/ae4f78bf-0c5b-43f2-a11e-dfa0c0c2098c
How would you handle such case?
Beta Was this translation helpful? Give feedback.
All reactions