From c2514f3e285ece8745569b27bedbdf07b291ecb2 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 31 Dec 2023 08:54:23 +0100 Subject: [PATCH] Filters/ExactMatch: remove the deprecated `getBlacklist()` and `getWhitelist()` methods * Removes the deprecated `getBlacklist()` and `getWhitelist()` methods. * Makes the `getDisallowedFiles()` and `getAllowedFiles()` replacement methods `abstract`. Related to 198 Fixes 199 --- src/Filters/ExactMatch.php | 52 +++---------------------------------- src/Filters/GitModified.php | 36 ++----------------------- src/Filters/GitStaged.php | 36 ++----------------------- 3 files changed, 8 insertions(+), 116 deletions(-) diff --git a/src/Filters/ExactMatch.php b/src/Filters/ExactMatch.php index 89517b8385..782ec99e02 100644 --- a/src/Filters/ExactMatch.php +++ b/src/Filters/ExactMatch.php @@ -48,20 +48,10 @@ public function accept() if ($this->disallowedFiles === null) { $this->disallowedFiles = $this->getDisallowedFiles(); - - // BC-layer. - if ($this->disallowedFiles === null) { - $this->disallowedFiles = $this->getBlacklist(); - } } if ($this->allowedFiles === null) { $this->allowedFiles = $this->getAllowedFiles(); - - // BC-layer. - if ($this->allowedFiles === null) { - $this->allowedFiles = $this->getWhitelist(); - } } $filePath = Common::realpath($this->current()); @@ -102,55 +92,21 @@ public function getChildren() /** * Get a list of file paths to exclude. * - * @deprecated 3.9.0 Implement the `getDisallowedFiles()` method instead. - * The `getDisallowedFiles()` method will be made abstract and therefore required - * in v4.0 and this method will be removed. - * If both methods are implemented, the new `getDisallowedFiles()` method will take precedence. + * @since 3.9.0 Replaces the `getBlacklist()` method, which was removed in PHPCS 4.0.0. * * @return array */ - abstract protected function getBlacklist(); + abstract protected function getDisallowedFiles(); /** * Get a list of file paths to include. * - * @deprecated 3.9.0 Implement the `getAllowedFiles()` method instead. - * The `getAllowedFiles()` method will be made abstract and therefore required - * in v4.0 and this method will be removed. - * If both methods are implemented, the new `getAllowedFiles()` method will take precedence. + * @since 3.9.0 Replaces the `getWhitelist()` method, which was removed in PHPCS 4.0.0. * * @return array */ - abstract protected function getWhitelist(); - - - /** - * Get a list of file paths to exclude. - * - * @since 3.9.0 Replaces the deprecated `getBlacklist()` method. - * - * @return array|null - */ - protected function getDisallowedFiles() - { - return null; - - }//end getDisallowedFiles() - - - /** - * Get a list of file paths to include. - * - * @since 3.9.0 Replaces the deprecated `getWhitelist()` method. - * - * @return array|null - */ - protected function getAllowedFiles() - { - return null; - - }//end getAllowedFiles() + abstract protected function getAllowedFiles(); }//end class diff --git a/src/Filters/GitModified.php b/src/Filters/GitModified.php index 3337287b92..c1f0216351 100644 --- a/src/Filters/GitModified.php +++ b/src/Filters/GitModified.php @@ -18,7 +18,7 @@ class GitModified extends ExactMatch /** * Get a list of file paths to exclude. * - * @since 3.9.0 + * @since 3.9.0 Replaces the `getBlacklist()` method, which was removed in PHPCS 4.0.0. * * @return array */ @@ -29,26 +29,10 @@ protected function getDisallowedFiles() }//end getDisallowedFiles() - /** - * Get a list of file paths to exclude. - * - * @deprecated 3.9.0 Overload the `getDisallowedFiles()` method instead. - * - * @codeCoverageIgnore - * - * @return array - */ - protected function getBlacklist() - { - return $this->getDisallowedFiles(); - - }//end getBlacklist() - - /** * Get a list of file paths to include. * - * @since 3.9.0 + * @since 3.9.0 Replaces the `getWhitelist()` method, which was removed in PHPCS 4.0.0. * * @return array */ @@ -82,22 +66,6 @@ protected function getAllowedFiles() }//end getAllowedFiles() - /** - * Get a list of file paths to include. - * - * @deprecated 3.9.0 Overload the `getAllowedFiles()` method instead. - * - * @codeCoverageIgnore - * - * @return array - */ - protected function getWhitelist() - { - return $this->getAllowedFiles(); - - }//end getWhitelist() - - /** * Execute an external command. * diff --git a/src/Filters/GitStaged.php b/src/Filters/GitStaged.php index 7a764314aa..894191c01f 100644 --- a/src/Filters/GitStaged.php +++ b/src/Filters/GitStaged.php @@ -20,7 +20,7 @@ class GitStaged extends ExactMatch /** * Get a list of file paths to exclude. * - * @since 3.9.0 + * @since 3.9.0 Replaces the `getBlacklist()` method, which was removed in PHPCS 4.0.0. * * @return array */ @@ -31,26 +31,10 @@ protected function getDisallowedFiles() }//end getDisallowedFiles() - /** - * Get a list of file paths to exclude. - * - * @deprecated 3.9.0 Overload the `getDisallowedFiles()` method instead. - * - * @codeCoverageIgnore - * - * @return array - */ - protected function getBlacklist() - { - return $this->getDisallowedFiles(); - - }//end getBlacklist() - - /** * Get a list of file paths to include. * - * @since 3.9.0 + * @since 3.9.0 Replaces the `getWhitelist()` method, which was removed in PHPCS 4.0.0. * * @return array */ @@ -84,22 +68,6 @@ protected function getAllowedFiles() }//end getAllowedFiles() - /** - * Get a list of file paths to include. - * - * @deprecated 3.9.0 Overload the `getAllowedFiles()` method instead. - * - * @codeCoverageIgnore - * - * @return array - */ - protected function getWhitelist() - { - return $this->getAllowedFiles(); - - }//end getWhitelist() - - /** * Execute an external command. *