Allow for array parameters in a function call used in a define. #327

Merged
merged 1 commit into from Jan 15, 2017

Projects

None yet

3 participants

@jrfnl
Contributor
jrfnl commented Jan 6, 2017 edited

If a function call is made to set the value of a constant through define(), it depends on the function called whether or not the value passed to define() is one of the acceptable variable types, but determining what the variable type returned by the function call is (or could be), is outside of the scope of a static analyse tool.

So I believe, in that case we should not throw an error.

Includes additional unit tests.
Also changes the testVersion for the noViolation / false positives test to 5.6 to prevent interference from the short array syntax sniff.

Fixes the issue reported in wpengine/phpcompat#101

@jrfnl jrfnl Allow for array parameters in a function call used in a define.
If a function call is made to set the value of a constant through `define()`, it depends on the function called whether or not the value passed to `define()` is one of the acceptable variable types, but determining what the variable type returned by the function call is (or could be), is outside of the scope of a static analyse tool.

So I believe, in that case we should not throw an error.

Includes additional unit tests.
Also changes the `testVersion` for the `noViolation` / false positives test to `5.6` to prevet interference from the short array syntax sniff.
34b6194
@jrfnl jrfnl referenced this pull request in wpengine/phpcompat Jan 6, 2017
Open

False positive on wpDirAuth when tested against 5.6 #101

@coveralls
coveralls commented Jan 6, 2017 edited

Coverage Status

Coverage increased (+0.01%) to 96.872% when pulling 34b6194 on jrfnl:feature/fix-bug-constant-arrays into 4853c6d on wimg:master.

@coveralls

Coverage Status

Coverage increased (+0.01%) to 96.872% when pulling 34b6194 on jrfnl:feature/fix-bug-constant-arrays into 4853c6d on wimg:master.

@coveralls

Coverage Status

Coverage increased (+0.01%) to 96.872% when pulling 34b6194 on jrfnl:feature/fix-bug-constant-arrays into 4853c6d on wimg:master.

@coveralls

Coverage Status

Coverage increased (+0.01%) to 96.872% when pulling 34b6194 on jrfnl:feature/fix-bug-constant-arrays into 4853c6d on wimg:master.

@coveralls

Coverage Status

Coverage increased (+0.01%) to 96.872% when pulling 34b6194 on jrfnl:feature/fix-bug-constant-arrays into 4853c6d on wimg:master.

@wimg wimg merged commit 4fa57b3 into wimg:master Jan 15, 2017

2 checks passed

Scrutinizer 1 updated code elements
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jrfnl jrfnl deleted the jrfnl:feature/fix-bug-constant-arrays branch Jan 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment