Skip to content

Commit e4f9f17

Browse files
committed
Changelog and readme updates for PHPCSExtra 1.2.0
1 parent a8be56a commit e4f9f17

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,36 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses
1414

1515
_Nothing yet._
1616

17+
## [1.2.0] - 2023-12-02
18+
19+
### Added
20+
21+
#### Universal
22+
23+
* :wrench: :books: New `Universal.CodeAnalysis.NoDoubleNegative` sniff to detect double negatives (!!) and advise to use a boolean cast instead. Thanks [@diedexx] for reviewing. [#277]
24+
* :wrench: :books: New `Universal.Operators.ConcatPosition` sniff to enforce that the concatenation operator for multi-line concatenations is in a preferred position, either always at the start of the next line or always at the end of the previous line. [#294]
25+
* :wrench: :bar_chart: :books: New `Universal.PHP.LowercasePHPTag` sniff to enforce that the "PHP" in a PHP open tag is lowercase. Thanks [@fredden] for reviewing. [#276]
26+
27+
### Changed
28+
29+
#### NormalizedArrays
30+
31+
* `NormalizedArrays.Arrays.CommaAfterLast`: the sniff now has two extra error codes to distinguish between multi-line arrays with the last array item on the _same line_ as the array closer vs the last array item being on a line _before_ the array closer. Thanks [@stronk7] for suggesting and patching this. [#283], [#284]
32+
These new error codes allow for selectively excluding that specific situation from triggering the sniff.
33+
The new error codes are `FoundMultiLineCloserSameLine` (for `multiLine="forbid"`) and `MissingMultiLineCloserSameLine` (for `multiLine="enforce"`).
34+
The pre-existing `FoundMultiLine` and `FoundSingleLine` error codes continue to be used for multi-line arrays with the last array item on a different line than the array closer.
35+
36+
#### Other
37+
38+
* Various housekeeping.
39+
40+
[#276]: https://github.com/PHPCSStandards/PHPCSExtra/pull/276
41+
[#277]: https://github.com/PHPCSStandards/PHPCSExtra/pull/277
42+
[#283]: https://github.com/PHPCSStandards/PHPCSExtra/issues/283
43+
[#284]: https://github.com/PHPCSStandards/PHPCSExtra/pull/284
44+
[#294]: https://github.com/PHPCSStandards/PHPCSExtra/pull/294
45+
46+
1747
## [1.1.2] - 2023-09-21
1848

1949
### Changed
@@ -523,6 +553,7 @@ This initial alpha release contains the following sniffs:
523553
[php_version-config]: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-php-version
524554

525555
[Unreleased]: https://github.com/PHPCSStandards/PHPCSExtra/compare/stable...HEAD
556+
[1.2.0]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.1.2...1.2.0
526557
[1.1.2]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.1.1...1.1.2
527558
[1.1.1]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.1.0...1.1.1
528559
[1.1.0]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.0.4...1.1.0
@@ -537,5 +568,8 @@ This initial alpha release contains the following sniffs:
537568

538569
[@anomiex]: https://github.com/anomiex
539570
[@derickr]: https://github.com/derickr
571+
[@diedexx]: https://github.com/diedexx
572+
[@fredden]: https://github.com/fredden
540573
[@GaryJones]: https://github.com/GaryJones
574+
[@stronk7]: https://github.com/stronk7
541575
[@szepeviktor]: https://github.com/szepeviktor

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,13 @@ Detects `foreach` control structures which use the same variable for both the ke
230230

231231
Note: The fixer will maintain the existing behaviour of the code. This may not be the _intended_ behaviour.
232232

233+
#### `Universal.CodeAnalysis.NoDoubleNegative` :wrench: :books:
234+
235+
Detects double negation `!!` in code, which is effectively the same as a boolean cast, but with a much higher cognitive load.
236+
Also detects triple negation `!!!`, which is effectively the same as a single negation.
237+
238+
The sniff has modular error codes to allow for disabling individual checks. The error codes are: `FoundDouble`, `FoundDoubleWithInstanceof` (not auto-fixable) and `FoundTriple`.
239+
233240
#### `Universal.CodeAnalysis.NoEchoSprintf` :wrench: :books:
234241

235242
Detects use of the inefficient `echo [v]sprintf(...);` combi. Use `[v]printf()` instead.
@@ -361,6 +368,14 @@ Enforce that the names used in a class/enum "implements" statement or an interfa
361368
The fixer will separate each name with a comma and one space.
362369
If alternative formatting is desired, a sniff which will check and fix the formatting should be added to the ruleset.
363370

371+
#### `Universal.Operators.ConcatPosition` :wrench: :bar_chart: :books:
372+
373+
Enforce that the concatenation operator for multi-line concatenations is in a preferred position, either always at the start of the next line or always at the end of the previous line.
374+
375+
* This sniff contains an `allowOnly` property to set the preferred position for the operator.
376+
Accepted values: (string) `"start"` or `"end"`. Defaults to `"start"`.
377+
* Note: mid-line concatenation is still allowed and will not be flagged by this sniff.
378+
364379
#### `Universal.Operators.DisallowLogicalAndOr` :bar_chart: :books:
365380

366381
Enforce the use of the boolean `&&` and `||` operators instead of the logical `and`/`or` operators.
@@ -392,6 +407,10 @@ Enforce no spaces around the union type and intersection type operators.
392407

393408
The available error codes are: `UnionTypeSpacesBefore`, `UnionTypeSpacesAfter`, `IntersectionTypeSpacesBefore`, `IntersectionTypeSpacesAfter`.
394409

410+
#### `Universal.PHP.LowercasePHPTag` :wrench: :bar_chart: :books:
411+
412+
Enforces that the "PHP" in a PHP open tag is lowercase.
413+
395414
#### `Universal.PHP.OneStatementInShortEchoTag` :wrench: :books:
396415

397416
Disallow short open echo tags `<?=` containing more than one PHP statement.

0 commit comments

Comments
 (0)