From da198c19c913f0238945dbaff61bec86f8e0da75 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 6 Oct 2026 10:45:03 +0200 Subject: [PATCH 1/5] Replace tomasvotruba/unused-public with shipmonk/dead-code-detector --- composer.json | 2 +- phpstan-baseline.neon | 427 ++++++++++++++++++++++++++++++++++++++++++ phpstan.neon | 9 +- 3 files changed, 431 insertions(+), 7 deletions(-) create mode 100644 phpstan-baseline.neon diff --git a/composer.json b/composer.json index 165ca3d327..738a5c863d 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "symplify/vendor-patches": "^11.5", "tomasvotruba/class-leak": "^2.3", "tomasvotruba/type-coverage": "^2.5", - "tomasvotruba/unused-public": "^2.2", + "shipmonk/dead-code-detector": "^1.4", "tracy/tracy": "^2.12" }, "autoload": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000000..6facc79067 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,427 @@ +parameters: + ignoreErrors: + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Annotation\\RemoveEventSubscriberDescriptionFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Annotation/RemoveEventSubscriberDescriptionFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Annotation\\RemoveMethodNameDuplicateDescriptionFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Annotation/RemoveMethodNameDuplicateDescriptionFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Annotation\\RemovePHPStormAnnotationFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Annotation/RemovePHPStormAnnotationFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Annotation\\RemovePropertyVariableNameDescriptionFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Annotation/RemovePropertyVariableNameDescriptionFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\ArrayNotation\\ArrayListItemNewlineFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/ArrayNotation/ArrayListItemNewlineFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\ArrayNotation\\ArrayOpenerAndCloserNewlineFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/ArrayNotation/ArrayOpenerAndCloserNewlineFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\ArrayNotation\\StandaloneLineInMultilineArrayFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/ArrayNotation/StandaloneLineInMultilineArrayFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Commenting\\AddMissingParamNameFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Commenting/AddMissingParamNameFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Commenting\\FixParamNameTypoFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Commenting/FixParamNameTypoFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Commenting\\RemoveUselessDefaultCommentFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Commenting/RemoveUselessDefaultCommentFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Commenting\\TypeToVarTagFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Commenting/TypeToVarTagFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\LineLength\\LineLengthFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/LineLength/LineLengthFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Spacing\\MethodChainingNewlineFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Spacing/MethodChainingNewlineFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Spacing\\StandaloneLineConstructorParamFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Spacing/StandaloneLineConstructorParamFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Spacing\\StandaloneLinePlainConstructorParamFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Spacing/StandaloneLinePlainConstructorParamFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Spacing\\StandaloneLinePromotedPropertyFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Spacing/StandaloneLinePromotedPropertyFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Spacing\\StandaloneLineRequiredParamFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Spacing/StandaloneLineRequiredParamFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Spacing\\StandaloneLineSymfonyAttributeParamFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Spacing/StandaloneLineSymfonyAttributeParamFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\Fixer\\Strict\\BlankLineAfterStrictTypesFixer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/Fixer/Strict/BlankLineAfterStrictTypesFixer.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenAnalyzer\\ChainMethodCallAnalyzer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenAnalyzer/ChainMethodCallAnalyzer.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenAnalyzer\\DocblockRelatedParamNamesResolver\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenAnalyzer/DocblockRelatedParamNamesResolver.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenAnalyzer\\ParamNewliner\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenAnalyzer/ParamNewliner.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Analyzer\\FixerAnalyzer\\ArrayAnalyzer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Analyzer/FixerAnalyzer/ArrayAnalyzer.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Analyzer\\FixerAnalyzer\\IndentDetector\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Analyzer/FixerAnalyzer/IndentDetector.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Analyzer\\FixerAnalyzer\\TokenSkipper\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Analyzer/FixerAnalyzer/TokenSkipper.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Arrays\\ArrayItemNewliner\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Arrays/ArrayItemNewliner.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Transformer\\FixerTransformer\\FirstLineLengthResolver\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Transformer/FixerTransformer/FirstLineLengthResolver.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Transformer\\FixerTransformer\\LineLengthCloserTransformer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Transformer/FixerTransformer/LineLengthCloserTransformer.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Transformer\\FixerTransformer\\LineLengthOpenerTransformer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Transformer/FixerTransformer/LineLengthOpenerTransformer.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Transformer\\FixerTransformer\\LineLengthTransformer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Transformer/FixerTransformer/LineLengthTransformer.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Transformer\\FixerTransformer\\TokensInliner\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Transformer/FixerTransformer/TokensInliner.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Transformer\\FixerTransformer\\TokensNewliner\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Transformer/FixerTransformer/TokensNewliner.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Traverser\\ArrayBlockInfoFinder\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Traverser/ArrayBlockInfoFinder.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Whitespace\\IndentResolver\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Whitespace/IndentResolver.php + + - + message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Wrapper\\FixerWrapper\\ArrayWrapperFactory\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: packages/coding-standard/src/TokenRunner/Wrapper/FixerWrapper/ArrayWrapperFactory.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Application\\EasyCodingStandardApplication\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Application/EasyCodingStandardApplication.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Application\\FileProcessorCollector\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Application/FileProcessorCollector.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Application\\SingleFileProcessor\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Application/SingleFileProcessor.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Blink\\BlinkConfigDumper\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Blink/BlinkConfigDumper.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Caching\\ChangedFilesDetector\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Caching/ChangedFilesDetector.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Configuration\\ConfigInitializer\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Configuration/ConfigInitializer.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Configuration\\ConfigurationFactory\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Configuration/ConfigurationFactory.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Command\\CheckCommand\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Console/Command/CheckCommand.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Command\\DumpConfigCommand\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Console/Command/DumpConfigCommand.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Command\\ListCheckersCommand\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Console/Command/ListCheckersCommand.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Command\\WorkerCommand\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Console/Command/WorkerCommand.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Output\\ConsoleOutputFormatter\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Console/Output/ConsoleOutputFormatter.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Output\\JsonOutputFormatter\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Console/Output/JsonOutputFormatter.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Output\\OutputFormatterCollector\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Console/Output/OutputFormatterCollector.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Reporter\\CheckerListReporter\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Console/Reporter/CheckerListReporter.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Contract\\Application\\FileProcessorInterface\:\:processFileToString$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Contract/Application/FileProcessorInterface.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Error\\FileDiffFactory\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Error/FileDiffFactory.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\FileSystem\\FileFilter\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/FileSystem/FileFilter.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Finder\\SourceFinder\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Finder/SourceFinder.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\FixerRunner\\Application\\FixerFileProcessor\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/FixerRunner/Application/FixerFileProcessor.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Parallel\\Application\\ParallelFileProcessor\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Parallel/Application/ParallelFileProcessor.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Parallel\\Contract\\SerializableInterface\:\:decode$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Parallel/Contract/SerializableInterface.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Parallel\\WorkerRunner\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Parallel/WorkerRunner.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Reporter\\ProcessedFileReporter\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Reporter/ProcessedFileReporter.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\Contract\\SkipVoterInterface\:\:match$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Skipper/Contract/SkipVoterInterface.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\Contract\\SkipVoterInterface\:\:shouldSkip$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Skipper/Contract/SkipVoterInterface.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\Matcher\\FileInfoMatcher\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Skipper/Matcher/FileInfoMatcher.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\SkipCriteriaResolver\\SkippedPathsResolver\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Skipper/SkipCriteriaResolver/SkippedPathsResolver.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\SkipVoter\\ClassAndCodeSkipVoter\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Skipper/SkipVoter/ClassAndCodeSkipVoter.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\SkipVoter\\ClassSkipVoter\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Skipper/SkipVoter/ClassSkipVoter.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\SkipVoter\\MessageSkipVoter\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Skipper/SkipVoter/MessageSkipVoter.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\SkipVoter\\PathSkipVoter\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Skipper/SkipVoter/PathSkipVoter.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\Skipper\\SkipSkipper\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Skipper/Skipper/SkipSkipper.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\SniffRunner\\Application\\SniffFileProcessor\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/SniffRunner/Application/SniffFileProcessor.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\SniffRunner\\File\\FileFactory\:\:__construct$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/SniffRunner/File/FileFactory.php + + - + message: '#^Unused Symplify\\EasyCodingStandard\\Utils\\ParametersMerger\:\:mergeWithCombine$#' + identifier: shipmonk.deadMethod + count: 1 + path: src/Utils/ParametersMerger.php diff --git a/phpstan.neon b/phpstan.neon index 6c3937c847..893e4ef3dc 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,6 @@ +includes: + - phpstan-baseline.neon + parameters: level: 8 @@ -30,12 +33,6 @@ parameters: mocks: true ctor: true - # see https://github.com/tomasVotruba/unused-public - unused_public: - methods: true - properties: true - constants: true - # see https://github.com/TomasVotruba/type-coverage type_coverage: return: 99 From 851c19a094ba5ac91e2131b4b282036ad19e6e42 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 6 Oct 2026 22:52:55 +0200 Subject: [PATCH 2/5] Replace dead-code baseline with single __construct ignore mask in phpstan.neon --- phpstan-baseline.neon | 427 ------------------------------------------ phpstan.neon | 26 ++- 2 files changed, 23 insertions(+), 430 deletions(-) delete mode 100644 phpstan-baseline.neon diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon deleted file mode 100644 index 6facc79067..0000000000 --- a/phpstan-baseline.neon +++ /dev/null @@ -1,427 +0,0 @@ -parameters: - ignoreErrors: - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Annotation\\RemoveEventSubscriberDescriptionFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Annotation/RemoveEventSubscriberDescriptionFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Annotation\\RemoveMethodNameDuplicateDescriptionFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Annotation/RemoveMethodNameDuplicateDescriptionFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Annotation\\RemovePHPStormAnnotationFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Annotation/RemovePHPStormAnnotationFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Annotation\\RemovePropertyVariableNameDescriptionFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Annotation/RemovePropertyVariableNameDescriptionFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\ArrayNotation\\ArrayListItemNewlineFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/ArrayNotation/ArrayListItemNewlineFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\ArrayNotation\\ArrayOpenerAndCloserNewlineFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/ArrayNotation/ArrayOpenerAndCloserNewlineFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\ArrayNotation\\StandaloneLineInMultilineArrayFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/ArrayNotation/StandaloneLineInMultilineArrayFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Commenting\\AddMissingParamNameFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Commenting/AddMissingParamNameFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Commenting\\FixParamNameTypoFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Commenting/FixParamNameTypoFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Commenting\\RemoveUselessDefaultCommentFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Commenting/RemoveUselessDefaultCommentFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Commenting\\TypeToVarTagFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Commenting/TypeToVarTagFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\LineLength\\LineLengthFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/LineLength/LineLengthFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Spacing\\MethodChainingNewlineFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Spacing/MethodChainingNewlineFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Spacing\\StandaloneLineConstructorParamFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Spacing/StandaloneLineConstructorParamFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Spacing\\StandaloneLinePlainConstructorParamFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Spacing/StandaloneLinePlainConstructorParamFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Spacing\\StandaloneLinePromotedPropertyFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Spacing/StandaloneLinePromotedPropertyFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Spacing\\StandaloneLineRequiredParamFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Spacing/StandaloneLineRequiredParamFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Spacing\\StandaloneLineSymfonyAttributeParamFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Spacing/StandaloneLineSymfonyAttributeParamFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\Fixer\\Strict\\BlankLineAfterStrictTypesFixer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/Fixer/Strict/BlankLineAfterStrictTypesFixer.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenAnalyzer\\ChainMethodCallAnalyzer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenAnalyzer/ChainMethodCallAnalyzer.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenAnalyzer\\DocblockRelatedParamNamesResolver\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenAnalyzer/DocblockRelatedParamNamesResolver.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenAnalyzer\\ParamNewliner\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenAnalyzer/ParamNewliner.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Analyzer\\FixerAnalyzer\\ArrayAnalyzer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Analyzer/FixerAnalyzer/ArrayAnalyzer.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Analyzer\\FixerAnalyzer\\IndentDetector\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Analyzer/FixerAnalyzer/IndentDetector.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Analyzer\\FixerAnalyzer\\TokenSkipper\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Analyzer/FixerAnalyzer/TokenSkipper.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Arrays\\ArrayItemNewliner\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Arrays/ArrayItemNewliner.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Transformer\\FixerTransformer\\FirstLineLengthResolver\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Transformer/FixerTransformer/FirstLineLengthResolver.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Transformer\\FixerTransformer\\LineLengthCloserTransformer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Transformer/FixerTransformer/LineLengthCloserTransformer.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Transformer\\FixerTransformer\\LineLengthOpenerTransformer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Transformer/FixerTransformer/LineLengthOpenerTransformer.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Transformer\\FixerTransformer\\LineLengthTransformer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Transformer/FixerTransformer/LineLengthTransformer.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Transformer\\FixerTransformer\\TokensInliner\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Transformer/FixerTransformer/TokensInliner.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Transformer\\FixerTransformer\\TokensNewliner\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Transformer/FixerTransformer/TokensNewliner.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Traverser\\ArrayBlockInfoFinder\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Traverser/ArrayBlockInfoFinder.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Whitespace\\IndentResolver\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Whitespace/IndentResolver.php - - - - message: '#^Unused Symplify\\CodingStandard\\TokenRunner\\Wrapper\\FixerWrapper\\ArrayWrapperFactory\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: packages/coding-standard/src/TokenRunner/Wrapper/FixerWrapper/ArrayWrapperFactory.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Application\\EasyCodingStandardApplication\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Application/EasyCodingStandardApplication.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Application\\FileProcessorCollector\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Application/FileProcessorCollector.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Application\\SingleFileProcessor\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Application/SingleFileProcessor.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Blink\\BlinkConfigDumper\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Blink/BlinkConfigDumper.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Caching\\ChangedFilesDetector\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Caching/ChangedFilesDetector.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Configuration\\ConfigInitializer\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Configuration/ConfigInitializer.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Configuration\\ConfigurationFactory\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Configuration/ConfigurationFactory.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Command\\CheckCommand\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Console/Command/CheckCommand.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Command\\DumpConfigCommand\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Console/Command/DumpConfigCommand.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Command\\ListCheckersCommand\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Console/Command/ListCheckersCommand.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Command\\WorkerCommand\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Console/Command/WorkerCommand.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Output\\ConsoleOutputFormatter\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Console/Output/ConsoleOutputFormatter.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Output\\JsonOutputFormatter\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Console/Output/JsonOutputFormatter.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Output\\OutputFormatterCollector\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Console/Output/OutputFormatterCollector.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Console\\Reporter\\CheckerListReporter\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Console/Reporter/CheckerListReporter.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Contract\\Application\\FileProcessorInterface\:\:processFileToString$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Contract/Application/FileProcessorInterface.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Error\\FileDiffFactory\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Error/FileDiffFactory.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\FileSystem\\FileFilter\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/FileSystem/FileFilter.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Finder\\SourceFinder\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Finder/SourceFinder.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\FixerRunner\\Application\\FixerFileProcessor\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/FixerRunner/Application/FixerFileProcessor.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Parallel\\Application\\ParallelFileProcessor\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Parallel/Application/ParallelFileProcessor.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Parallel\\Contract\\SerializableInterface\:\:decode$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Parallel/Contract/SerializableInterface.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Parallel\\WorkerRunner\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Parallel/WorkerRunner.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Reporter\\ProcessedFileReporter\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Reporter/ProcessedFileReporter.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\Contract\\SkipVoterInterface\:\:match$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Skipper/Contract/SkipVoterInterface.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\Contract\\SkipVoterInterface\:\:shouldSkip$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Skipper/Contract/SkipVoterInterface.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\Matcher\\FileInfoMatcher\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Skipper/Matcher/FileInfoMatcher.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\SkipCriteriaResolver\\SkippedPathsResolver\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Skipper/SkipCriteriaResolver/SkippedPathsResolver.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\SkipVoter\\ClassAndCodeSkipVoter\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Skipper/SkipVoter/ClassAndCodeSkipVoter.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\SkipVoter\\ClassSkipVoter\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Skipper/SkipVoter/ClassSkipVoter.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\SkipVoter\\MessageSkipVoter\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Skipper/SkipVoter/MessageSkipVoter.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\SkipVoter\\PathSkipVoter\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Skipper/SkipVoter/PathSkipVoter.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\Skipper\\SkipSkipper\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Skipper/Skipper/SkipSkipper.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\SniffRunner\\Application\\SniffFileProcessor\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/SniffRunner/Application/SniffFileProcessor.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\SniffRunner\\File\\FileFactory\:\:__construct$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/SniffRunner/File/FileFactory.php - - - - message: '#^Unused Symplify\\EasyCodingStandard\\Utils\\ParametersMerger\:\:mergeWithCombine$#' - identifier: shipmonk.deadMethod - count: 1 - path: src/Utils/ParametersMerger.php diff --git a/phpstan.neon b/phpstan.neon index 893e4ef3dc..2a11dc7981 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,3 @@ -includes: - - phpstan-baseline.neon - parameters: level: 8 @@ -96,3 +93,26 @@ parameters: - identifier: symplify.noNullableServiceInConstructor path: packages/coding-standard/src/Fixer/LineLength/LineLengthFixer.php + + # constructors are invoked via DI autowiring, not detectable by dead-code-detector + - + identifier: shipmonk.deadMethod + message: '#::__construct$#' + + # interface contracts and util method called dynamically + - + message: '#^Unused Symplify\\EasyCodingStandard\\Parallel\\Contract\\SerializableInterface\:\:decode$#' + identifier: shipmonk.deadMethod + path: src/Parallel/Contract/SerializableInterface.php + - + message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\Contract\\SkipVoterInterface\:\:match$#' + identifier: shipmonk.deadMethod + path: src/Skipper/Contract/SkipVoterInterface.php + - + message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\Contract\\SkipVoterInterface\:\:shouldSkip$#' + identifier: shipmonk.deadMethod + path: src/Skipper/Contract/SkipVoterInterface.php + - + message: '#^Unused Symplify\\EasyCodingStandard\\Utils\\ParametersMerger\:\:mergeWithCombine$#' + identifier: shipmonk.deadMethod + path: src/Utils/ParametersMerger.php From 2403f2cb266b808f99d16433ec3acef2f4959011 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 6 Oct 2026 23:27:08 +0200 Subject: [PATCH 3/5] Restore FileProcessorInterface dead-method ignore with identifier --- phpstan.neon | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 2a11dc7981..1d4e111e8c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -101,17 +101,13 @@ parameters: # interface contracts and util method called dynamically - - message: '#^Unused Symplify\\EasyCodingStandard\\Parallel\\Contract\\SerializableInterface\:\:decode$#' - identifier: shipmonk.deadMethod - path: src/Parallel/Contract/SerializableInterface.php - - - message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\Contract\\SkipVoterInterface\:\:match$#' + message: '#^Unused Symplify\\EasyCodingStandard\\Contract\\Application\\FileProcessorInterface\:\:processFileToString$#' identifier: shipmonk.deadMethod - path: src/Skipper/Contract/SkipVoterInterface.php + path: src/Contract/Application/FileProcessorInterface.php - - message: '#^Unused Symplify\\EasyCodingStandard\\Skipper\\Contract\\SkipVoterInterface\:\:shouldSkip$#' + message: '#^Unused Symplify\\EasyCodingStandard\\Parallel\\Contract\\SerializableInterface\:\:decode$#' identifier: shipmonk.deadMethod - path: src/Skipper/Contract/SkipVoterInterface.php + path: src/Parallel/Contract/SerializableInterface.php - message: '#^Unused Symplify\\EasyCodingStandard\\Utils\\ParametersMerger\:\:mergeWithCombine$#' identifier: shipmonk.deadMethod From 40ee54ff6e3617eb7022feecfd47620905531fa7 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 7 Oct 2026 10:50:45 +0200 Subject: [PATCH 4/5] remove mergeWithCombine() dead method --- phpstan.neon | 4 ---- src/Utils/ParametersMerger.php | 26 -------------------------- 2 files changed, 30 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 1d4e111e8c..2496344f1b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -108,7 +108,3 @@ parameters: message: '#^Unused Symplify\\EasyCodingStandard\\Parallel\\Contract\\SerializableInterface\:\:decode$#' identifier: shipmonk.deadMethod path: src/Parallel/Contract/SerializableInterface.php - - - message: '#^Unused Symplify\\EasyCodingStandard\\Utils\\ParametersMerger\:\:mergeWithCombine$#' - identifier: shipmonk.deadMethod - path: src/Utils/ParametersMerger.php diff --git a/src/Utils/ParametersMerger.php b/src/Utils/ParametersMerger.php index 9f42b56f0a..f21a5a5b03 100644 --- a/src/Utils/ParametersMerger.php +++ b/src/Utils/ParametersMerger.php @@ -33,32 +33,6 @@ public function merge(mixed $left, mixed $right): mixed return $right; } - /** - * The same as above, just with the case if both values being non-array, it will combined them to array: - * - * $this->mergeWithCombine(1, 2); // [1, 2] - */ - public function mergeWithCombine(mixed $left, mixed $right): mixed - { - if (is_array($left) && is_array($right)) { - return $this->mergeLeftToRightWithCallable( - $left, - $right, - fn ($leftValue, $rightValue): mixed => $this->mergeWithCombine($leftValue, $rightValue) - ); - } - - if ($left === null && is_array($right)) { - return $right; - } - - if ($right && (array) $left !== (array) $right) { - return $this->mergeWithCombine((array) $right, (array) $left); - } - - return $left; - } - /** * @param array $left * @param array $right From de2d94b67cda947bc0b80b3da17474920681ae6d Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 7 Oct 2026 11:04:23 +0200 Subject: [PATCH 5/5] Drop dead processFileToString, route checker tests through processFile --- phpstan.neon | 4 --- .../Application/FileProcessorInterface.php | 2 -- .../Application/FixerFileProcessor.php | 25 ------------------- .../Application/SniffFileProcessor.php | 11 -------- .../PHPUnit/AbstractCheckerTestCase.php | 14 +++++++---- 5 files changed, 9 insertions(+), 47 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 2496344f1b..5c9c495257 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -100,10 +100,6 @@ parameters: message: '#::__construct$#' # interface contracts and util method called dynamically - - - message: '#^Unused Symplify\\EasyCodingStandard\\Contract\\Application\\FileProcessorInterface\:\:processFileToString$#' - identifier: shipmonk.deadMethod - path: src/Contract/Application/FileProcessorInterface.php - message: '#^Unused Symplify\\EasyCodingStandard\\Parallel\\Contract\\SerializableInterface\:\:decode$#' identifier: shipmonk.deadMethod diff --git a/src/Contract/Application/FileProcessorInterface.php b/src/Contract/Application/FileProcessorInterface.php index ebc1447d9b..4bc7636754 100644 --- a/src/Contract/Application/FileProcessorInterface.php +++ b/src/Contract/Application/FileProcessorInterface.php @@ -10,8 +10,6 @@ interface FileProcessorInterface { - public function processFileToString(string $filePath): string; - /** * @return array{file_diffs?: FileDiff[], coding_standard_errors?: CodingStandardError[]} */ diff --git a/src/FixerRunner/Application/FixerFileProcessor.php b/src/FixerRunner/Application/FixerFileProcessor.php index eca60315ad..4e285fb5d8 100644 --- a/src/FixerRunner/Application/FixerFileProcessor.php +++ b/src/FixerRunner/Application/FixerFileProcessor.php @@ -100,31 +100,6 @@ public function processFile(string $filePath, Configuration $configuration): arr ]; } - public function processFileToString(string $filePath): string - { - $tokens = $this->fileToTokensParser->parseFromFilePath($filePath); - - $appliedFixers = []; - foreach ($this->fixers as $fixer) { - if ($this->processTokensByFixer($filePath, $tokens, $fixer)) { - $appliedFixers[] = $fixer::class; - } - } - - $contents = FileSystem::read($filePath); - if ($appliedFixers === []) { - return $contents; - } - - $diff = $this->differ->diff($contents, $tokens->generateCode()); - // some fixer with feature overlap can null each other - if ($diff === '') { - return $contents; - } - - return $tokens->generateCode(); - } - /** * @param FixerInterface[] $fixers * @return FixerInterface[] diff --git a/src/SniffRunner/Application/SniffFileProcessor.php b/src/SniffRunner/Application/SniffFileProcessor.php index 241eeb3428..dbc8a927ff 100644 --- a/src/SniffRunner/Application/SniffFileProcessor.php +++ b/src/SniffRunner/Application/SniffFileProcessor.php @@ -121,17 +121,6 @@ public function processFile(string $filePath, Configuration $configuration): arr return $errorsAndDiffs; } - /** - * For tests or printing contenet - */ - public function processFileToString(string $filePath): string - { - $file = $this->fileFactory->createFromFile($filePath); - $this->fixFile($file, $filePath, $this->tokenListeners, []); - - return $this->fixer->getContents(); - } - private function addSniff(Sniff $sniff): void { $this->sniffs[] = $sniff; diff --git a/src/Testing/PHPUnit/AbstractCheckerTestCase.php b/src/Testing/PHPUnit/AbstractCheckerTestCase.php index 060e3874f0..11471b8552 100644 --- a/src/Testing/PHPUnit/AbstractCheckerTestCase.php +++ b/src/Testing/PHPUnit/AbstractCheckerTestCase.php @@ -12,6 +12,7 @@ use Symplify\EasyCodingStandard\FixerRunner\Application\FixerFileProcessor; use Symplify\EasyCodingStandard\SniffRunner\Application\SniffFileProcessor; use Symplify\EasyCodingStandard\Testing\Contract\ConfigAwareInterface; +use Symplify\EasyCodingStandard\ValueObject\Configuration; use Webmozart\Assert\Assert; // needed for scoped version to load unprefixed classes; does not have any effect inside the class @@ -72,15 +73,18 @@ protected function doTestFile(string $filePath): void $inputFilePath = sys_get_temp_dir() . '/ecs_tests/' . md5($inputContents) . '.php'; FileSystem::write($inputFilePath, $inputContents, null); + $configuration = new Configuration(isFixer: true); + // 1. process php-cs-fixer if ($this->fixerFileProcessor->getCheckers() !== []) { - $processedFileContent = $this->fixerFileProcessor->processFileToString($inputFilePath); - $this->assertEquals($expectedContents, $processedFileContent); - // 2. process php coce sniffer + $this->fixerFileProcessor->processFile($inputFilePath, $configuration); + // 2. process php code sniffer } elseif ($this->sniffFileProcessor->getCheckers() !== []) { - $processedFileContent = $this->sniffFileProcessor->processFileToString($inputFilePath); - $this->assertEquals($expectedContents, $processedFileContent); + $this->sniffFileProcessor->processFile($inputFilePath, $configuration); } + + $processedFileContent = FileSystem::read($inputFilePath); + $this->assertEquals($expectedContents, $processedFileContent); } protected static function yieldFiles(string $directory, string $suffix = '*.php.inc'): Iterator