Skip to content

Upgrading friendsofphp/php-cs-fixer 1 to 2

Breakingv1.13.3 → v2.19.3Breaking31Security1Platform7Deprecated13New258Changed213Fixed580Other756

BreakingUpgrade verdict

30 breaking changes and 7 platform requirement changes and a security fix.

  • The old fixer name no longer exists; use the new fixer name in your configuration instead.
  • A method that was not used anywhere has been deleted.
  • Deletes the old ConfigurationResolver class.
  • Fixer::getLevelAsString is no longer static.
Top 5 of 51 that need code or config changes

friendsofphp/php-cs-fixer publishes an official migration guide for version 2. It covers more than the release notes do.

UPGRADE ↗

PHP requirement changed in v2.17.0: ^5.3.6 || >=7.0 <7.2 → ^5.6 || ^7.0 || ^8.0.

Breaking30
PhpdocTrimAfterDescriptionFixer is replaced by PhpdocTrimConsecutiveBlankLineSeparationFixer.
PhpdocTrimAfterDescriptionFixerPhpdocTrimConsecutiveBlankLineSeparationFixer
Removes the unused Token::isStructureAlternativeEnd method.
Token.isStructureAlternativeEnd()
Deletes the old ConfigurationResolver class.
ConfigurationResolver
Fixer::getLevelAsString is no longer static.
Fixer::getLevelAsString
Renames PhpdocShortDescriptionFixer to PhpdocSummaryFixer.
PhpdocShortDescriptionFixerPhpdocSummaryFixer
Removes non-default Config and Finder classes.
ConfigFinder
Renames namespace Symfony\CS to PhpCsFixer.
Symfony\CSPhpCsFixer
Renames fixers.
Renames the --config-file CLI argument.
--config-file
Renames not_operators_with_space to not_operator_with_space.
not_operators_with_spacenot_operator_with_space
Renames PhpdocNoSimplifiedNullReturnFixer back to PhpdocNoEmptyReturnFixer.
PhpdocNoSimplifiedNullReturnFixerPhpdocNoEmptyReturnFixer
Removes ConfigInterface::getDir, ConfigInterface::setDir, Finder::setDir and the whole FinderInterface.
ConfigInterface::getDirConfigInterface::setDirFinder::setDirFinderInterface
Removes ConfigAwareInterface.
ConfigAwareInterface
Removes the overcomplete NoDuplicateSemicolonsFixer.
NoDuplicateSemicolonsFixer
Renames no_whitespace_in_blank_lines to no_whitespace_in_blank_line.
no_whitespace_in_blank_linesno_whitespace_in_blank_line
Unifies the Phpdoc*Fixer rename fixers.
Phpdoc*Fixer
Removes the unused Tokens::isMethodNameIsMagic method.
Tokens::isMethodNameIsMagic()
Renames the phpdoc_params rule to phpdoc_align.
phpdoc_paramsphpdoc_align
Removes Token::$line.
Token::$line
Removes Token::getLine.
Token::getLine
FileCacheManager removes code for backward compatibility support.
FileCacheManager
Adds a short diff output format, which breaks backward compatibility; this PR was reverted in v2.2.3, which should be used instead.
Makes fixers final.
FixerInterface::configure now always overrides configuration instead of patching it.
FixerInterface::configure
Merges the conflicting ShortArraySyntaxFixer and LongArraySyntaxFixer.
ShortArraySyntaxFixerLongArraySyntaxFixer
Unifies the Concat*Fixer fixers.
Concat*Fixer
Splits Tokens into Tokens and TokensAnalyzer.
TokensTokensAnalyzer
Changes the FixerInterface.
FixerInterface
Requires all Transformer classes to be named with the Transformer suffix.
Makes internal classes final.
Security1
Disallows unserializing classes that have a destructor.
Platform7
Relaxes composer requirements so installation is not blocked under PHP 8, though PHP 8 support is not yet ready.
Requires PHP 7.1.
Requires PHP 7.0.
Adds official support for PHP 7.3.
Adds official support for PHP 7.3.
Requires PHP 5.6 or newer.
Adds support for PHP 7.2.
Deprecated13
Deprecates version 2.
Deprecates a parameter of Token::toJson().
Token::toJson()
Deprecates FinalStaticAccessFixer.
FinalStaticAccessFixer
Deprecates Config::create().
Config::create()
Deprecates the target option of PhpUnitDedicateAssertInternalTypeFixer.
PhpUnitDedicateAssertInternalTypeFixertarget
Raises deprecation warnings when deprecated aliases are used.
Deprecates the last parameter of Tokens::findBlockEnd.
Tokens::findBlockEnd
Renames no_extra_consecutive_blank_lines to no_extra_blank_lines with a BC layer.
no_extra_consecutive_blank_linesno_extra_blank_lines
Deprecates use_yoda_style in IsNullFixer.
use_yoda_styleIsNullFixer
Updates deprecations in ConfigurableFixerInterface and ConfigurationDefinitionFixerInterface.
ConfigurableFixerInterfaceConfigurationDefinitionFixerInterface
Adds missing deprecations for Token.
Token
Deprecates input option values other than "yes" or "no".
Deprecates IntegrationCase::shouldCheckPriority as priority checking is now automated.
AbstractIntegrationTestCaseIntegrationCase::shouldCheckPriority