Skip to content

RemovedImplodeFlexibleParamOrder: fix two bugs + one enhancement#891

Merged
wimg merged 1 commit intodevelopfrom
feature/890-implode-order-bug
Sep 5, 2019
Merged

RemovedImplodeFlexibleParamOrder: fix two bugs + one enhancement#891
wimg merged 1 commit intodevelopfrom
feature/890-implode-order-bug

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 29, 2019

Bugs:

  1. "Empty" tokens (whitespace, comments) were not disregarded when determining whether the first parameter was only a text string, which could lead to the second parameter being examined when it doesn't need to be.
  2. If either parameter contained a ternary, potentially nested in some other construct, the ternary would confuse the sniff.

Both fixed now.

In addition to this if one of the parameters contains an (array) cast, let's presume that's the array parameter. This may lead to some false positives for complexly build parameters, but we'll deal with that later if needs be.

Includes unit tests.

Fixes #890

@jrfnl jrfnl force-pushed the feature/890-implode-order-bug branch from 4ac867d to db5e306 Compare September 5, 2019 17:55
Bugs:
1. "Empty" tokens (whitespace, comments) were not disregarded when determining whether the first parameter was only a text string, which could lead to the second parameter being examined when it doesn't need to be.
2. If either parameter contained a ternary, potentially nested in some other construct, the ternary would confuse the sniff.

Both fixed now.

In addition to this if one of the parameters contains an `(array)` cast, let's presume that's the array parameter. This may lead to some false positives for complexly build parameters, but we'll deal with that later if needs be.

Includes unit tests.

Fixes 890
@wimg wimg merged commit 3ff247e into develop Sep 5, 2019
@delete-merged-branch delete-merged-branch bot deleted the feature/890-implode-order-bug branch September 5, 2019 17:56
@jrfnl jrfnl removed PR: ready for review PR: quick merge PR only contains relatively simple changes labels Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implode() order - false positive for PHP 7.4 compatibility

2 participants