Closed dakujem closed 1 year ago
thanks, fixed
Hey, David, you closed this without merging to master. Not sure it was intentional. c8457ab58ad2a27863af2721f3bc590bb24045db does not close this PR, bud closes #444 instead. @dg
It is in master as part of "coding standards" commit, because all methods should have types.
yeah, that's better
Description of the problem
While using Dibi with PhpStorm (the prevalent PHP IDE), I'm constantly being warned about using void where I should not.
I'm pushed to either disable the inspection or suppress it for the given statement/block etc.
But this inspection is useful and I do not wish to suppress it.
Solution of the problem
Instead, we can just add
mixed
return type-hint to the magicRow::__get
method to "confuse" PhpStorm. We can do this, because we are actually usingRow
magically without type safety so there is no sacrifice to make. Withmixed
as the return value type, PS accepts it can not infer the type of the property and stops complaining.We can then omit the suppressions
and we end up with clean code:
We are still warned that we acces the properties using "magic" (Property accessed via magic method).