Skip to content

Commit

Permalink
Merge pull request #933 from PHPCompatibility/develop
Browse files Browse the repository at this point in the history
Release PHPCompatibility 9.3.4
  • Loading branch information
jrfnl committed Nov 15, 2019
2 parents 1af08ca + fc52bb8 commit 1f37659
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ From version 8.0.0 onwards, [Semantic Versioning](http://semver.org/) is used.

_Nothing yet._

## [9.3.4] - 2019-11-15

See all related issues and PRs in the [9.3.4 milestone].

### Fixed
- :bug: `PHPCompatibility.Keywords.ForbiddenNames`: false positive for list when used in a `foreach()` condition. [#930](https://github.com/PHPCompatibility/PHPCompatibility/pull/930). Fixes [#928](https://github.com/PHPCompatibility/PHPCompatibility/issues/928), [#929](https://github.com/PHPCompatibility/PHPCompatibility/pull/929)

### Credits
Thanks go out to [Sergii Bondarenko] for their contribution to this version. :clap:


## [9.3.3] - 2019-11-11

See all related issues and PRs in the [9.3.3 milestone].
Expand Down Expand Up @@ -1358,6 +1369,8 @@ See all related issues and PRs in the [5.5 milestone].


[Unreleased]: https://github.com/PHPCompatibility/PHPCompatibility/compare/master...HEAD
[9.3.4]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.3...9.3.4
[9.3.3]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.2...9.3.3
[9.3.2]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.1...9.3.2
[9.3.1]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.3.0...9.3.1
[9.3.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/9.2.0...9.3.0
Expand Down Expand Up @@ -1386,6 +1399,8 @@ See all related issues and PRs in the [5.5 milestone].
[7.0]: https://github.com/PHPCompatibility/PHPCompatibility/compare/5.6...7.0
[5.6]: https://github.com/PHPCompatibility/PHPCompatibility/compare/5.5...5.6

[9.3.4 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/33
[9.3.3 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/32
[9.3.2 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/31
[9.3.1 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/30
[9.3.0 milestone]: https://github.com/PHPCompatibility/PHPCompatibility/milestone/29
Expand Down Expand Up @@ -1440,6 +1455,7 @@ See all related issues and PRs in the [5.5 milestone].
[Rowan Collins]: https://github.com/IMSoP
[Ryan Neufeld]: https://github.com/ryanneufeld
[Sam Van der Borght]: https://github.com/samvdb
[Sergii Bondarenko]: https://github.com/BR0kEN-
[Tadas Juozapaitis]: https://github.com/kasp3r
[Tim Millwood]: https://github.com/timmillwood
[Yılmaz]: https://github.com/edigu
Expand Down
17 changes: 17 additions & 0 deletions PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,23 @@ public function processNonString(File $phpcsFile, $stackPtr, $tokens)
$nextNonEmpty = $maybeUseNext;
}

/*
* Deal with foreach ( ... as list() ).
*/
elseif ($tokens[$stackPtr]['type'] === 'T_AS'
&& isset($tokens[$stackPtr]['nested_parenthesis']) === true
&& $tokens[$nextNonEmpty]['code'] === \T_LIST
) {
$parentheses = array_reverse($tokens[$stackPtr]['nested_parenthesis'], true);
foreach ($parentheses as $open => $close) {
if (isset($tokens[$open]['parenthesis_owner'])
&& $tokens[$tokens[$open]['parenthesis_owner']]['code'] === \T_FOREACH
) {
return;
}
}
}

/*
* Deal with functions declared to return by reference.
*/
Expand Down
4 changes: 4 additions & 0 deletions PHPCompatibility/Tests/Keywords/ForbiddenNamesUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ use const MyCONSTANT;

// list
list( $a, $b, $c ) = $array;
foreach ($array as list($key, $value)) {}
foreach ([[1, 2], [2, 3]] as list($a, $b)):
// Do something.
endforeach;

// die
die();
Expand Down

0 comments on commit 1f37659

Please sign in to comment.