Skip to content

Filters/ExactMatch: remove the deprecated getBlacklist() and getWhitelist() methods #984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 4 additions & 48 deletions src/Filters/ExactMatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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
36 changes: 2 additions & 34 deletions src/Filters/GitModified.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand Down Expand Up @@ -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.
*
Expand Down
36 changes: 2 additions & 34 deletions src/Filters/GitStaged.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand Down Expand Up @@ -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.
*
Expand Down