You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When referring to type hinting, our standards say:
When using type hinting on classes, it is recommended to specify the particular interface the class implements rather than the class name itself.
And the following example is given:
/** * First parameter must be an object implementing the OtherClassInterface. */publicfunctiontest(OtherClassInterface$otherClass) {
echo$otherClass->var;
}
Hmm, yes and no... I plan to start using phpcs a lot more, so it'd be good if I had maintainer access in order to fix problems as I found them. But then I have no idea how to write/fix sniff files... So not sure.
But then I have no idea how to write/fix sniff files...
Guess what, I'm no specialist, either. 😏 We all learn as we go.
I'm using my own projects (modules) as reference, to avoid throwing out nagging, that hasn't been there before - because some (like me) might use phpcs in their PR workflow. But that's also something we could discuss and eventually adapt.
When referring to type hinting, our standards say:
And the following example is given:
And yet our
FunctionCommentSniff
doesn't account for this: https://github.com/backdrop-ops/phpcs/blob/main/Backdrop/Sniffs/Commenting/FunctionCommentSniff.php#L697-L704 It only accounts forstdClass
,object
andmixed
...As such, I'm getting the following error on the following code:
The text was updated successfully, but these errors were encountered: