You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+50-2Lines changed: 50 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,13 +14,60 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses
14
14
15
15
_Nothing yet._
16
16
17
+
## [1.1.0] - 2023-07-19
18
+
19
+
### Added
20
+
21
+
#### Universal
22
+
23
+
*:wrench::books: New `Universal.CodeAnalysis.NoEchoSprintf` sniff to detect use of the inefficient `echo [v]sprintf(...);` combi and recommends using `[v]printf()` instead. [#242]
24
+
*:bar_chart::books: New `Universal.FunctionDeclarations.NoLongClosures` sniff to detect "long" closures and recommend using a named function instead. [#240]
25
+
The sniff offers the following properties to influence its behaviour: `recommendedLines` (defaults to `5`), `maxLines` (defaults to `8`), `ignoreCommentLines` (defaults to `true`) and `ignoreEmptyLines` (defaults to `true`).
26
+
*:wrench::bar_chart::books: New `Universal.FunctionDeclarations.RequireFinalMethodsInTraits` sniff to enforce non-private, non-abstract methods in traits to be declared as `final`. [#243], [#245]
27
+
There is a separate `NonFinalMagicMethodFound` error code for magic methods to allow those to be excluded from the check.
28
+
*:wrench::bar_chart::books: New `Universal.UseStatements.DisallowMixedGroupUse` sniff to disallow group use statements which import a combination of namespace/OO construct, functions and/or constants in one statement. [#241], [#246]
29
+
Note: the fixer will use a semi-standardized format for group use statements. If there are more specific requirements for the formatting of group use statements, the ruleset configurator should ensure that additional sniffs are included in the ruleset to enforce the required format.
30
+
*:wrench::bar_chart::books: New `Universal.UseStatements.KeywordSpacing` sniff to enforce the use of a single space after the `use`, `function`, `const` keywords and both before and after the `as` keyword in import `use` statements. [#247]
31
+
The sniff has modular error codes to allow for disabling individual checks.
32
+
*:wrench::books: New `Universal.UseStatements.NoUselessAliases` sniff to detect useless aliases (aliasing something to its original name) in import use statements. [#244]
33
+
Note: as OO and function names in PHP are case-insensitive, aliasing to the same name, using a different case is also considered useless.
34
+
*:wrench::bar_chart::books: New `Universal.WhiteSpace.CommaSpacing` sniff to enforce that there is no space before a comma and exactly one space, or a new line, after a comma. [#254]
35
+
Additionally, the sniff also enforces that the comma should follow the code and not be placed after a trailing comment.
36
+
The sniff has modular error codes to allow for disabling individual checks and checks in certain contexts.
37
+
The sniff will respect a potentially set [`php_version` configuration option][php_version-config] when deciding how to handle the spacing after a heredoc/nowdoc closer.
38
+
39
+
### Changed
40
+
41
+
#### Universal
42
+
43
+
* Minor performance improvements for the `Universal.Arrays.DuplicateArrayKey` and the `Universal.CodeAnalysis.ConstructorDestructorReturn` sniffs. [#251], [#252]
44
+
45
+
#### Other
46
+
47
+
* Composer: The minimum `PHPCSUtils` requirement has been updated to `^1.0.8` (was `^1.0.6`). [#249], [#254]
Alternatively, you may want to install this standard globally:
70
70
```bash
71
71
composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
72
-
composer global require --dev phpcsstandards/phpcsextra:"^1.0"
72
+
composer global require --dev phpcsstandards/phpcsextra:"^1.1.0"
73
73
```
74
74
75
75
### Updating to a newer version
@@ -220,6 +220,10 @@ Require a consistent modifier keyword order for class declarations.
220
220
If a [`php_version` configuration option][php_version-config] has been passed to PHPCS using either `--config-set` or `--runtime-set`, it will be respected by the sniff.
221
221
In effect, this means that the sniff will only report on PHP4-style constructors if the configured PHP version is less than 8.0.
Detects `foreach` control structures which use the same variable for both the key as well as the value assignment as this will lead to unexpected - and most likely unintended - behaviour.
@@ -278,6 +282,26 @@ Enforce for a file to either declare (global/namespaced) functions or declare OO
278
282
* Also note: This sniff has no opinion on multiple OO structures being declared in one file.
279
283
If you want to sniff for that, use the PHPCS native `Generic.Files.OneObjectStructurePerFile` sniff.
Disallow group use statements which import a combination of namespace/OO construct, functions and/or constants in one statement.
398
+
399
+
Note: the fixer will use a semi-standardized format for group use statements.
400
+
If there are more specific requirements for the formatting of group use statements, the ruleset configurator should ensure that additional sniffs are included in the ruleset to enforce the required format.
Enforce the use of a single space after the `use`, `function`, `const` keywords and both before and after the `as` keyword in import `use` statements.
431
+
432
+
Companion sniff to the PHPCS native `Generic.WhiteSpace.LanguageConstructSpacing` sniff which doesn't cover the `function`, `const` and `as` keywords when used in an import `use` statement.
433
+
434
+
The sniff has modular error codes to allow for disabling individual checks. The error codes are: `SpaceAfterUse`, `SpaceAfterFunction`, `SpaceAfterConst`, `SpaceBeforeAs` and `SpaceAfterAs`.
Verify that a name being imported in an import `use` statement does not start with a leading backslash.
@@ -402,13 +441,40 @@ Names in import `use` statements should always be fully qualified, so a leading
402
441
403
442
This sniff handles all types of import use statements supported by PHP, in contrast to other sniffs for the same in, for instance, the PHPCS native `PSR12` or the Slevomat standard, which are incomplete.
Enforce that there is no space before a comma and exactly one space, or a new line, after a comma.
461
+
462
+
Additionally, the sniff also enforces that the comma should follow the code and not be placed after a trailing comment.
463
+
464
+
For the spacing part, the sniff makes the following exceptions:
465
+
1. A comma preceded or followed by a parenthesis, curly or square bracket.
466
+
These will not be flagged to prevent conflicts with sniffs handling spacing around braces.
467
+
2. A comma preceded or followed by another comma, like for skipping items in a list assignment.
468
+
These will not be flagged.
469
+
470
+
* The sniff has a separate error code - `TooMuchSpaceAfterCommaBeforeTrailingComment` - for when a comma is found with more than one space after it, followed by a trailing comment.
471
+
Exclude this error code to allow trailing comment alignment.
472
+
* The other error codes the sniff uses, `SpaceBefore`, `TooMuchSpaceAfter` and `NoSpaceAfter`, may be suffixed with a context indicator - `*InFunctionDeclaration`, `*InFunctionCall`, `*InClosureUse` or `*InDeclare` -.
473
+
This allows for disabling the sniff in any of these contexts by excluding the specific suffixed error codes.
474
+
* The sniff will respect a potentially set [`php_version` configuration option][php_version-config] when deciding how to handle the spacing after a heredoc/nowdoc closer.
475
+
In effect, this means that the sniff will enforce a new line between the closer and a comma if the configured PHP version is less than 7.3.
476
+
When no `php_version` is passed, the sniff will handle the spacing between a heredoc/nowdoc closer and a comma based on whether it is a cross-version compatible heredoc/nowdoc (enforce new line) or a flexible heredoc/nowdoc (enforce no space).
Forbids the use of long closures and recommends using named functions instead.
9
+
10
+
By default a closure is considered "longish" (warning) when it contains more than 5 lines of code and too long (error) when it contains more than 8 lines of code.
11
+
Also, by default only code lines are counted and blank lines and comment lines are ignored.
12
+
Each of these settings can be changed via the sniff configuration.
0 commit comments