Ran
|
Files
108
|
Run time
38s
|
Badge
Embed ▾
README BADGES
|
push
travis-ci
<a href="https://github.com/PHPCompatibility/PHPCompatibility/commit/<a class=hub.com/PHPCompatibility/PHPCompatibility/commit/<a class="double-link" href="https://git"><a class=hub.com/PHPCompatibility/PHPCompatibility/commit/5eae43fb4238b944f2dc31fe4647636f2138813f">5eae43fb4<a href="https://github.com/PHPCompatibility/PHPCompatibility/commit/5eae43fb4238b944f2dc31fe4647636f2138813f"><a href="https://github.com/PHPCompatibility/PHPCompatibility/commit/5eae43fb4238b944f2dc31fe4647636f2138813f">&quot;&gt;:sparkles: PHP 7.4: New RemovedCurlyBraceArrayAccess sniff &amp;gt; The array and string offset access syntax using curly braces is deprecated. &gt; Use $str[$idx] instead of $str{$idx}. Refs: * https://wiki.php.net/rfc/deprecate_curly_braces_array_access * https://github.com/php/php-src/blob/</a><a class="double-link" href="https://github.com/PHPCompatibility/PHPCompatibility/commit/<a class="double-link" href="https://github.com/PHPCompatibility/PHPCompatibility/commit/ef165b4422f4cef60f963833dddffa26fe1b2759">ef165b442</a>">ef165b442</a><a href="https://github.com/PHPCompatibility/PHPCompatibility/commit/5eae43fb4238b944f2dc31fe4647636f2138813f">/UPGRADING#L351-L353 * https://github.com/php/php-src/pull/4416 * https://github.com/php/php-src/commit/</a><a class="double-link" href="https://github.com/PHPCompatibility/PHPCompatibility/commit/<a class="double-link" href="https://github.com/PHPCompatibility/PHPCompatibility/commit/d574df63dc375f5fc9202ce5afde23f866b6450a">d574df63d</a>">d574df63d</a><a href="https://github.com/PHPCompatibility/PHPCompatibility/commit/5eae43fb4238b944f2dc31fe4647636f2138813f"> ## Implementation notes Based on a lot of testing, I have come to the conclusion that the curly braces for array access worked in quite a lot of cases, though mostly since PHP 7.0. The other sniffs which should take curly brace access into account - `NewArrayStringDereferencing`, `NewClassMemberAccess` and `NewFunctionArrayDereferencing` - have been adjusted in separate PRs. This PR can only be merged after those PRs have been merged as it re-uses logic from those sniffs. ### Other tests Based on the above mentioned tests, I also found that - yes, curly brace array access is supported on constants, but only when the first set of braces is square brackets. See: * https://3v4l.org/WIUHk * https://3v4l.org/OWSq6 * https://3v4l.org/e6YWk ## Auto-fixing In contrast to any other PHPCompatibility sniff, this sniff contains an auto-fixer. For larger codebases, this issue can be quite time-consuming to fix, while fixing this automatically is tri... (continued)
4920 of 5410 relevant lines covered (90.94%)
6.37 hits per line
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
---|