From b0ea9159de8b26e9e68c58a50ac500ab3d8db8c0 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 17 Feb 2020 13:00:08 +0100 Subject: [PATCH] Generic/DeprecatedFunctions: remove redundant `method_exists()` This code snippet was introduced in ec29df437d7ce83bf63f73cdf6c4583b5ea91d8e to allow for running the sniff on HHVM, but HHVM support has been dropped in PHPCS 3.3.1. In native PHP, the `ReflectionFunctionAbstract::isDeprecated()` method is available since PHP 5.2, so this check is redundant. Ref: https://www.php.net/manual/en/reflectionfunctionabstract.isdeprecated.php --- src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php b/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php index 4ab3444a83..42eaa40f4e 100644 --- a/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php +++ b/src/Standards/Generic/Sniffs/PHP/DeprecatedFunctionsSniff.php @@ -35,9 +35,6 @@ public function __construct() foreach ($functions['internal'] as $functionName) { $function = new \ReflectionFunction($functionName); - if (method_exists($function, 'isDeprecated') === false) { - break; - } if ($function->isDeprecated() === true) { $this->forbiddenFunctions[$functionName] = null;