PHPCSStandards / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
906 stars 55 forks source link

Generic/FunctionCallArgumentSpacing: improve code coverage #497

Closed rodrigoprimo closed 4 months ago

rodrigoprimo commented 4 months ago

Description

This PR improves code coverage for the Generic.Functions.FunctionCallArgumentSpacing sniff.

Related issues/external references

Part of #146

Types of changes

PR checklist

rodrigoprimo commented 4 months ago

Thanks for the review, @jrfnl!

There are no tests with attributes, while the sniff does act on them: There are no tests with first class callable.

I added the tests that you suggested.

Regarding the attributes, I added the test you shared that triggers the sniff, and I also added another test that does not trigger the sniff to document the expected behavior. I did not add more tests as it seems to me, for the purposes of this sniff, the attributes behave just like a function call.

jrfnl commented 4 months ago

Regarding the attributes, I added the test you shared that triggers the sniff, and I also added another test that does not trigger the sniff to document the expected behavior.

Well, technically, both code samples trigger the sniff, but only one will trigger an error from the sniff....

jrfnl commented 4 months ago

FYI: I've pulled the follow up mentioned in one of my previous comments as PR #513