From e4680190f82c669ce5432838bc45b00ff52e3677 Mon Sep 17 00:00:00 2001 From: pedro Date: Thu, 2 Aug 2018 18:55:32 +0200 Subject: [PATCH] Trigger deprecation error for deprecated fixers. --- src/PedroTroller/CS/Fixer/AbstractFixer.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/PedroTroller/CS/Fixer/AbstractFixer.php b/src/PedroTroller/CS/Fixer/AbstractFixer.php index 7efdcce..b6b7af2 100644 --- a/src/PedroTroller/CS/Fixer/AbstractFixer.php +++ b/src/PedroTroller/CS/Fixer/AbstractFixer.php @@ -9,6 +9,23 @@ abstract class AbstractFixer extends PhpCsFixer { + /** + * {@inheritdoc} + */ + public function __construct() + { + parent::__construct(); + + if ($this->isDeprecated()) { + $message = null === $this->getDeprecationReplacement() + ? sprintf('The fixer "%s" is deprecated.', $this->getName()) + : sprintf('The fixer "%s" is deprecated. Please use "%s".', $this->getName(), $this->getDeprecationReplacement()) + ; + + @trigger_error($message, E_USER_DEPRECATED); + } + } + // {@inheritdoc} public function isCandidate(Tokens $tokens) {