phpinspectionsea
phpinspectionsea copied to clipboard
Do not trigger "Return type hint can be used" for impl of external interfaces
In a Symfony 3.4 project with PHP7.1, i get type hint warnings for methods not under my control - in this case overridden methods or implementations of abstract methods from Symfony's Symfony\Component\Console\Command\Command
Description (screenshot):
I really like this inspection, but it would be nice if it can be muted if the declaration is not located in one of the sources folder.
You can specify the return type.
For example, specify void
for the execute
method and self
for the configure
. Why you don't want to add return types to the implemented methods?
You are right; quick-fix (alt-space) suggests changing the signature in the interface, which is not under my control. So either close this issue, or suggest quick-fix like in non-inherited methods ("Add return type hint")
I think QF should add return type only in the concrete method, not to the interface.
I cant reproduce this behavior:
Alt+enter-> hit
enter. Then QF specifies
:void` in my method and does not touch the parent method call :thinking:
This is what it looks here (PhpStorm 2019.1.2 Preview Build #PS-191.7141.5 Windows 10 10.0)
Looks like QF to add the type-hint should be used instead of change signature suggestion. Hence bug.