Skip to content

Releases: InteractionDesignFoundation/coding-standard

1.0.0-RC2

1.0.0-RC2 Pre-release
Pre-release

Choose a tag to compare

@alies-dev alies-dev released this 14 Jul 13:55
1.0.0-RC2
864246c

Changes since 1.0.0-RC1

  • php-cs-fixer: disable php_unit_strict; delegate assertEquals→assertSame to Rector's AssertEqualsToSameRector (only rewrites provably-scalar assertions, avoids breaking object/array value comparisons) (864246c)
  • CI: bump stefanzweifel/git-auto-commit-action to v7 (#44)
  • docs: clarify README

Full Changelog: 1.0.0-RC1...1.0.0-RC2

1.0.0-RC1

1.0.0-RC1 Pre-release
Pre-release

Choose a tag to compare

@alies-dev alies-dev released this 11 Jul 14:49
117338e

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:risky presets enabled (risky rules on by default).
  • PHPUnit: @PHPUnit10x0Migration:risky preset; test method names are snake_case (php_unit_method_casing), with the PSR1 CamelCaps sniff excluded for tests/.
  • 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); @inheritdoc normalized 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&&/||, heredocnowdoc when 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_functions disabled).

Developer experience

  • composer cs now 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

  1. Bump PHP to 8.4 and this package to 1.0.0-RC1.
  2. Replace your PHP-CS-Fixer config with Config::create(__DIR__) (see README).
  3. Keep <rule ref="IxDFCodingStandard"/> in phpcs.xml; remove any formatting sniff overrides that no longer exist.
  4. Run composer cs and 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

Choose a tag to compare

@alies-dev alies-dev released this 23 Jun 11:13
737a4ba

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

Choose a tag to compare

@alies-dev alies-dev released this 06 Mar 13:04
481b8c2

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_semicolons
    • nullable_type_declaration_for_default_null_value
    • ordered_imports

Full Changelog: 0.6.5...0.7.0

0.6.5

Choose a tag to compare

@alies-dev alies-dev released this 15 Jan 09:17
2a62f45

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

Choose a tag to compare

@alies-dev alies-dev released this 13 Jan 10:44
288e7cb

What's Changed

  • Exclude PSR2.Classes.ClassDeclaration.OpenBraceNewLine that conflicts with PHP-CS-Fixer's single_line_empty_body from PER2x0 @alies-dev

Full Changelog: 0.6.3...0.6.4

0.6.3

Choose a tag to compare

@alies-dev alies-dev released this 24 Nov 09:26
6035756

What's new:

Full Changelog: 0.6.2...0.6.3

0.6.2

Choose a tag to compare

@alies-dev alies-dev released this 14 Nov 08:58
8b9e9c1

What's changed:

  • Update composer dependencies @alies-dev
  • Disable Generic.CodeAnalysis.UnusedFunctionParameter sniff @alies-dev
  • Disable SlevomatCodingStandard.Functions.DisallowNamedArguments sniff @alies-dev
  • Run tests over PHP 8.5 @alies-dev

Full Changelog: 0.6.1...0.6.2

0.6.1

Choose a tag to compare

@alies-dev alies-dev released this 08 Oct 19:22
10d9cb3

What's changed

  • Allow using $this in traversable PHPDoc types to avoid conflicts with Larastan when write types for Laravel relationships (where Larastan requires using $this keyword 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

Choose a tag to compare

@alies-dev alies-dev released this 24 Sep 23:13
2779f13

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