Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AbstractArrayAssignmentRestrictions: bug fix - improve value capturing
This commit improves the way the `AbstractArrayAssignmentRestrictionsSniff` captures the value of an array key assignment before it gets passed on to the callback for further examination. As things were previously, the sniff would go wrong in two cases: 1. Without a trailing comma after an array item, the long/short array close bracket would be included in the value, while it shouldn't be. This was reported in issue 2211. 2. The sniff would not always capture a complete value when the value contained a function call, sub-array, closure etc; basically anything which can contain a comma or semi-colon, but where that comma/semi-colon is in an "inner" construct and not the "outer" construct which is being captured. This was reported in issue 2027 The fix included in this commit fixes the first issue completely and a partial fix for the second issue. Includes tests via the `WordPress.WP.PostsPerPage` sniff. Fixes 2211
- Loading branch information