Upgrading fabpot/php-cs-fixer 2 to 3
Breakingv2.19.3 โ v3.95.27Breaking39Security3Platform8Deprecated18New286Changed323Fixed593Other1272
BreakingUpgrade verdict
39 breaking changes and 8 platform requirement changes and 3 security fixes.
In plain terms
- The fixer for duplicate PHPDoc types has a new name, so configurations using the old name must be updated.
- Removes AbstractFixerTestCase::getTestFile().
- Removes support for an array of patterns in Preg methods.
- Code constructing XdebugHandler with a second argument will break.
Must act Top 5 of 68 that need code or config changes
fabpot/php-cs-fixer publishes official migration guides for versions 3, 3, 3. They cover more than the release notes do.
Upgrade guide โUpgrade guide โUpgrade guide โPHP requirement changed in v3.21.2: ^5.6 || ^7.0 || ^8.0 โ ^7.4 || ^8.0.
What you must change
Breaking39
Renames PhpdocTypesNoDuplicatesFixer to PhpdocNoDuplicateTypesFixer.
PhpdocTypesNoDuplicatesFixerPhpdocNoDuplicateTypesFixerRemoves AbstractFixerTestCase::getTestFile().
AbstractFixerTestCase::getTestFile()Removes support for an array of patterns in Preg methods.
PregRemoves the second parameter of the XdebugHandler constructor.
XdebugHandlerRemoves __constructor() from RuleSetDescriptionInterface.
RuleSetDescriptionInterface__constructor()show-progress option drops run-in and estimating, and renames estimating-max to dots.
show-progressrun-inestimatingestimating-maxdotsTokenizer removes deprecations and legacy mode.
TokenizerRules change their default options.
Drops the SKIP_LINT_TEST_CASES environment variable.
SKIP_LINT_TEST_CASESRules drop rootless configurations.
Rules drop deprecated configurations.
FixerDefinitionInterface drops getConfigurationDescription and getDefaultConfiguration.
FixerDefinitionInterfacegetConfigurationDescriptiongetDefaultConfigurationdiff-format drops sbd diff, uses udiffer by default, and drops SebastianBergmannDiffer and SebastianBergmannShortDiffer classes.
diff-formatsbdudifferSebastianBergmannDifferSebastianBergmannShortDifferRemoves the Helpers class.
HelpersDrops the AccessibleObject class.
AccessibleObjectDrops deprecated rules: blank_line_before_return, hash_to_slash_comment, method_separation, no_extra_consecutive_blank_lines, no_multiline_whitespace_before_semicolons and pre_increment.
blank_line_before_returnhash_to_slash_commentmethod_separationno_extra_consecutive_blank_linesno_multiline_whitespace_before_semicolonspre_incrementRemoves deprecated rules: lowercase_constants, php_unit_ordered_covers and silenced_deprecation_error.
lowercase_constantsphp_unit_ordered_coverssilenced_deprecation_errorRemoves the deprecated no_short_echo_tag rule.
no_short_echo_tagDrops mapping of strings to boolean options other than yes/no.
Drops diff-format.
Drops the deprecated argument of Tokens::findBlockEnd.
Tokens::findBlockEndDrops the deprecated flat list configuration of ClassAttributesSeparationFixer.
ClassAttributesSeparationFixerDrops the unused Tokens::warnPhp8SplFixerArrayChange method.
Tokens::warnPhp8SplFixerArrayChangeDrops IsIdenticalConstraint.
IsIdenticalConstraintRuleSet no longer allows null to disable a rule.
RuleSetRemoves Utils::calculateBitmask.
Utils::calculateBitmaskRemoves the parameter from Token::toJson().
Token::toJson()Removes TrailingCommaInMultilineArrayFixer.
TrailingCommaInMultilineArrayFixerFixers stop exposing extra properties and constants.
MethodArgumentSpaceFixer fixSpace is now private.
MethodArgumentSpaceFixerfixSpaceDefinedFixerInterface is incorporated into FixerInterface.
DefinedFixerInterfaceFixerInterfaceConfigurableFixerInterface::configure parameter is now not nullable and not optional.
ConfigurableFixerInterface::configureConfigurationDefinitionFixerInterface is incorporated into ConfigurableFixerInterface.
ConfigurationDefinitionFixerInterfaceConfigurableFixerInterfaceFixCommand forbids passing the config and rules options together.
FixCommandconfigrulesMakes some more classes final.
Further backward compatibility cleanup for 3.0.
Drops the src/Test namespace.
Forbids usage of the old config filename.
Removes the 'create' method in internal classes.
createSecurity3
Refuses a symlinked cache path in FileHandler to avoid arbitrary file overwrite.
FileHandlerAddresses a credential exposure concern related to using ergebnis/agent-detector for detecting an AI agent.
ergebnis/agent-detectorHardens GitHub Workflows security.
Platform8
Use shipmonk/composer-dependency-analyser instead of icanhazstring/composer-unused and maglnet/composer-require-checker.
shipmonk/composer-dependency-analysericanhazstring/composer-unusedmaglnet/composer-require-checkerDrop support for justinrainbow/json-schema:^5.
Adds support for Symfony 7.
Requires PHP ^8.0.1.
Bumps the required PHP version to 7.4.
Bumps the minimum required PHP version to 7.2.
Requires PHP 7.2 or higher.
Bumps the required PHP version to 7.1.
Deprecations to plan for
Deprecated18
Explicitly deprecates non-handled objects in rules configuration, which now silently fail, and adds support for JsonSerializable config values.
JsonSerializableDeprecates the length sorting algorithm of OrderedImportsFixer.
OrderedImportsFixerDeprecates ConfigInterface::getPhpExecutable() and ConfigInterface::setPhpExecutable().
ConfigInterface::getPhpExecutable()ConfigInterface::setPhpExecutable()Deprecates the
nullable_type_declaration_for_default_null_value option that conflicts with @PHP84Migration.nullable_type_declaration_for_default_null_value@PHP84MigrationDeprecates Token::isKeyCaseSensitive.
Token::isKeyCaseSensitiveContinues deprecating Token::isKeyCaseSensitive in a second part.
Token::isKeyCaseSensitiveDeprecates CompactNullableTypehintFixer and proxies it to CompactNullableTypeDeclarationFixer.
CompactNullableTypehintFixerCompactNullableTypeDeclarationFixerDeprecates NewWithBracesFixer and proxies it to NewWithParenthesesFixer.
NewWithBracesFixerNewWithParenthesesFixerDeprecates CurlyBracesPositionFixer and proxies it to BracesPositionFixer.
CurlyBracesPositionFixerBracesPositionFixerDeprecates NoUnneededCurlyBracesFixer and proxies it to NoUnneededBracesFixer.
NoUnneededCurlyBracesFixerNoUnneededBracesFixerMarks PER-CS v1 as deprecated.
@PER-CS1.0Officially deprecates the internal Utils anti-pattern class.
UtilsMarks Tokens::getNamespaceDeclarations as @internal.
Tokens::getNamespaceDeclarationsIntroduces single_space_around_construct and deprecates single_space_after_construct.
single_space_around_constructsingle_space_after_constructDeprecates BracesFixer.
BracesFixerDeprecates ClassKeywordRemoveFixer.
ClassKeywordRemoveFixerDeprecates v2.
Deprecates the parameter of Token::toJson().
Token::toJson()