Releases: InteractionDesignFoundation/coding-standard
Releases · InteractionDesignFoundation/coding-standard
Release list
1.0.0-RC2
Changes since 1.0.0-RC1
- php-cs-fixer: disable
php_unit_strict; delegate assertEquals→assertSame to Rector'sAssertEqualsToSameRector(only rewrites provably-scalar assertions, avoids breaking object/array value comparisons) (864246c) - CI: bump
stefanzweifel/git-auto-commit-actionto v7 (#44) - docs: clarify README
Full Changelog: 1.0.0-RC1...1.0.0-RC2
1.0.0-RC1
First release candidate for 1.0. The standard has been reorganized around a clear division of roles, with PHP-CS-Fixer promoted to the primary tool.
Tool roles (breaking)
- PHP-CS-Fixer is now the primary tool. It owns all code formatting (based on PER-CS 3.0) and auto-fixes it. Use the shared config:
return Config::create(__DIR__); - PHP_CodeSniffer is now supplementary. Its ruleset was slimmed by ~50 sniffs: all formatting checks duplicated by PHP-CS-Fixer were removed (the whole PSR12 ruleset, array formatting, whitespace/spacing, string quoting, use-statement ordering, and more). It now focuses on what the fixer cannot express: structural and semantic checks, Laravel conventions, naming, complexity.
- PHP_CodeSniffer alone is no longer a complete standard. Run both tools together (
composer cs).
Requirements (breaking)
- PHP ^8.4 (was ^8.3)
- PHP_CodeSniffer ^4.0
Main coding-style changes
- PHP 8.4 modernization:
@PHP8x4Migration+@PHP8x4Migration:riskypresets enabled (risky rules on by default). - PHPUnit:
@PHPUnit10x0Migration:riskypreset; test method names are snake_case (php_unit_method_casing), with the PSR1 CamelCaps sniff excluded fortests/. - Line length: was a hard 120 error; now 180 warning / 220 error (soft-wrap era).
- Imports: global functions are imported (
global_namespace_import), classes and constants stay fully qualified; unneeded import aliases removed. - PHPDoc: single-line docblocks for constants, properties and methods where they fit (
phpdoc_line_span);@inheritdocnormalized to@inheritDoc; noise annotations (@author,@package,@since, ...) stripped; types ordered. - Class structure: fixed member order enforced (
ordered_class_elements); one blank line between methods. - Modern PHP:
is_null()→null ===-free comparisons, cast functions → native casts (modernize_types_casting),and/or→&&/||,heredoc→nowdocwhen possible, elvis operator where shorter, native constant/function casing. - Strings: single quotes by default, no concat spacing (
'hello'.$name),mb_*string functions enforced. - Arrow functions are not forced: long closure syntax stays when more readable (
use_arrow_functionsdisabled).
Developer experience
composer csnow chains PHP-CS-Fixer and phpcbf, identical locally and in CI.- Single auto-fix CI workflow replaces the previous two style workflows; it runs Rector, PHP-CS-Fixer and phpcbf, then commits fixes back (copyable example).
- Custom sniffs are now documented in one place, including the previously undocumented
Functions.MissingOptionalArgument: docs/README.md - Rector added to the toolchain (
composer rector).
Upgrading from 0.x
- Bump PHP to 8.4 and this package to
1.0.0-RC1. - Replace your PHP-CS-Fixer config with
Config::create(__DIR__)(see README). - Keep
<rule ref="IxDFCodingStandard"/>inphpcs.xml; remove any formatting sniff overrides that no longer exist. - Run
composer csand review the (large, mostly mechanical) diff.
What's Changed
- Modernize coding standard: PHP 8.4, PER-CS 3, Rector, dedup rules by @alies-dev in #42
Full Changelog: 0.8.0...1.0.0-RC1
0.8.0
PHP 8.5 fully ready.
What's Changed
- Prevent ForbidMethodDeclaration sniff aborting on deprecated traits by @alies-dev in #36
Internal Changes
- Update ramsey/composer-install action to v4 by @renovate[bot] in #33
- Update EndBug/add-and-commit action to v10 by @renovate[bot] in #32
- Update actions/checkout action to v7 by @renovate[bot] in #35
- Pin dependencies by @renovate[bot] in #34
Full Changelog: 0.7.0...0.8.0
0.7.0
What's Changed
- Easy way to use shared PHP-CS-Fixer config by @alies-dev in #30 (see README.md)
- Enable few more PHP-CS-Fixer rules in #30 :
multiline_whitespace_before_semicolonsnullable_type_declaration_for_default_null_valueordered_imports
Full Changelog: 0.6.5...0.7.0
0.6.5
What's changed:
- Refine no_trailing_comma_in_singleline rule to specify elements @alies-dev
Full Changelog: 0.6.4...0.6.5
0.6.4
What's Changed
- Exclude
PSR2.Classes.ClassDeclaration.OpenBraceNewLinethat conflicts with PHP-CS-Fixer'ssingle_line_empty_bodyfrom PER2x0 @alies-dev
Full Changelog: 0.6.3...0.6.4
0.6.3
0.6.2
What's changed:
- Update composer dependencies @alies-dev
- Disable
Generic.CodeAnalysis.UnusedFunctionParametersniff @alies-dev - Disable
SlevomatCodingStandard.Functions.DisallowNamedArgumentssniff @alies-dev - Run tests over PHP 8.5 @alies-dev
Full Changelog: 0.6.1...0.6.2
0.6.1
What's changed
- Allow using
$thisin traversable PHPDoc types to avoid conflicts with Larastan when write types for Laravel relationships (where Larastan requires using$thiskeyword instead of the Model's classname) @alies-dev
Requires using fork for the slevomat/coding-standard till PR slevomat/coding-standard#1802 will be merged and released ("repositories" key of the composer.json):
{
"type": "vcs",
"url": "https://github.com/alies-dev/slevomat-coding-standard"
},Full Changelog: 0.6.0...0.6.1
0.6.0
What's changed
- Update PHP-CS-Fixer rules to use PER-CS 3.0 ruleset @alies-dev
Full Changelog: 0.5.0...0.6.0