-
Notifications
You must be signed in to change notification settings - Fork 131
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
Consider making Roave\BetterReflection\Reflection\ReflectionClass#getMethod()
non-nullable?
#1275
Comments
We should make getProperty() etc use the same pattern to be consistent. |
in case you don't want todo another major in the near future I think you could also use phpdoc to narrow the return type in the meantime. phpstan does a similar thing with phpstan/phpstan-src@ace76ce its a pretty recent feature in phpstan though |
@staabm a new major would be OK here, IMO. We aren't that worried about BC, on a codebase that provides full type safety (and therefore is easy yo upgrade to) |
We currently have:
Roave\BetterReflection\Reflection\ReflectionClass#getMethod(): ReflectionMethod|null
Roave\BetterReflection\Reflection\ReflectionClass#hasMethod(): bool
This API is kinda dumb-ish, and we kinda went back on it in
6.0.0
, IMO: an exception being thrown was probably a much nicer API here.Either we make
getMethod()
throw, or we removehasMethod()
here. Relying ongetMethod()
throwing is not so bad here, but either way could work.The text was updated successfully, but these errors were encountered: