Skip to content

Commit d27a8c8

Browse files
authored
Merge pull request #984 from PHPCSStandards/phpcs-4.0/feature/199-filter-remove-deprecated-whitelist-blacklist-methods
Filters/ExactMatch: remove the deprecated `getBlacklist()` and `getWhitelist()` methods
2 parents 293b332 + c2514f3 commit d27a8c8

File tree

3 files changed

+8
-116
lines changed

3 files changed

+8
-116
lines changed

src/Filters/ExactMatch.php

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,10 @@ public function accept()
4848

4949
if ($this->disallowedFiles === null) {
5050
$this->disallowedFiles = $this->getDisallowedFiles();
51-
52-
// BC-layer.
53-
if ($this->disallowedFiles === null) {
54-
$this->disallowedFiles = $this->getBlacklist();
55-
}
5651
}
5752

5853
if ($this->allowedFiles === null) {
5954
$this->allowedFiles = $this->getAllowedFiles();
60-
61-
// BC-layer.
62-
if ($this->allowedFiles === null) {
63-
$this->allowedFiles = $this->getWhitelist();
64-
}
6555
}
6656

6757
$filePath = Common::realpath($this->current());
@@ -102,55 +92,21 @@ public function getChildren()
10292
/**
10393
* Get a list of file paths to exclude.
10494
*
105-
* @deprecated 3.9.0 Implement the `getDisallowedFiles()` method instead.
106-
* The `getDisallowedFiles()` method will be made abstract and therefore required
107-
* in v4.0 and this method will be removed.
108-
* If both methods are implemented, the new `getDisallowedFiles()` method will take precedence.
95+
* @since 3.9.0 Replaces the `getBlacklist()` method, which was removed in PHPCS 4.0.0.
10996
*
11097
* @return array
11198
*/
112-
abstract protected function getBlacklist();
99+
abstract protected function getDisallowedFiles();
113100

114101

115102
/**
116103
* Get a list of file paths to include.
117104
*
118-
* @deprecated 3.9.0 Implement the `getAllowedFiles()` method instead.
119-
* The `getAllowedFiles()` method will be made abstract and therefore required
120-
* in v4.0 and this method will be removed.
121-
* If both methods are implemented, the new `getAllowedFiles()` method will take precedence.
105+
* @since 3.9.0 Replaces the `getWhitelist()` method, which was removed in PHPCS 4.0.0.
122106
*
123107
* @return array
124108
*/
125-
abstract protected function getWhitelist();
126-
127-
128-
/**
129-
* Get a list of file paths to exclude.
130-
*
131-
* @since 3.9.0 Replaces the deprecated `getBlacklist()` method.
132-
*
133-
* @return array|null
134-
*/
135-
protected function getDisallowedFiles()
136-
{
137-
return null;
138-
139-
}//end getDisallowedFiles()
140-
141-
142-
/**
143-
* Get a list of file paths to include.
144-
*
145-
* @since 3.9.0 Replaces the deprecated `getWhitelist()` method.
146-
*
147-
* @return array|null
148-
*/
149-
protected function getAllowedFiles()
150-
{
151-
return null;
152-
153-
}//end getAllowedFiles()
109+
abstract protected function getAllowedFiles();
154110

155111

156112
}//end class

src/Filters/GitModified.php

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class GitModified extends ExactMatch
1818
/**
1919
* Get a list of file paths to exclude.
2020
*
21-
* @since 3.9.0
21+
* @since 3.9.0 Replaces the `getBlacklist()` method, which was removed in PHPCS 4.0.0.
2222
*
2323
* @return array
2424
*/
@@ -29,26 +29,10 @@ protected function getDisallowedFiles()
2929
}//end getDisallowedFiles()
3030

3131

32-
/**
33-
* Get a list of file paths to exclude.
34-
*
35-
* @deprecated 3.9.0 Overload the `getDisallowedFiles()` method instead.
36-
*
37-
* @codeCoverageIgnore
38-
*
39-
* @return array
40-
*/
41-
protected function getBlacklist()
42-
{
43-
return $this->getDisallowedFiles();
44-
45-
}//end getBlacklist()
46-
47-
4832
/**
4933
* Get a list of file paths to include.
5034
*
51-
* @since 3.9.0
35+
* @since 3.9.0 Replaces the `getWhitelist()` method, which was removed in PHPCS 4.0.0.
5236
*
5337
* @return array
5438
*/
@@ -82,22 +66,6 @@ protected function getAllowedFiles()
8266
}//end getAllowedFiles()
8367

8468

85-
/**
86-
* Get a list of file paths to include.
87-
*
88-
* @deprecated 3.9.0 Overload the `getAllowedFiles()` method instead.
89-
*
90-
* @codeCoverageIgnore
91-
*
92-
* @return array
93-
*/
94-
protected function getWhitelist()
95-
{
96-
return $this->getAllowedFiles();
97-
98-
}//end getWhitelist()
99-
100-
10169
/**
10270
* Execute an external command.
10371
*

src/Filters/GitStaged.php

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class GitStaged extends ExactMatch
2020
/**
2121
* Get a list of file paths to exclude.
2222
*
23-
* @since 3.9.0
23+
* @since 3.9.0 Replaces the `getBlacklist()` method, which was removed in PHPCS 4.0.0.
2424
*
2525
* @return array
2626
*/
@@ -31,26 +31,10 @@ protected function getDisallowedFiles()
3131
}//end getDisallowedFiles()
3232

3333

34-
/**
35-
* Get a list of file paths to exclude.
36-
*
37-
* @deprecated 3.9.0 Overload the `getDisallowedFiles()` method instead.
38-
*
39-
* @codeCoverageIgnore
40-
*
41-
* @return array
42-
*/
43-
protected function getBlacklist()
44-
{
45-
return $this->getDisallowedFiles();
46-
47-
}//end getBlacklist()
48-
49-
5034
/**
5135
* Get a list of file paths to include.
5236
*
53-
* @since 3.9.0
37+
* @since 3.9.0 Replaces the `getWhitelist()` method, which was removed in PHPCS 4.0.0.
5438
*
5539
* @return array
5640
*/
@@ -84,22 +68,6 @@ protected function getAllowedFiles()
8468
}//end getAllowedFiles()
8569

8670

87-
/**
88-
* Get a list of file paths to include.
89-
*
90-
* @deprecated 3.9.0 Overload the `getAllowedFiles()` method instead.
91-
*
92-
* @codeCoverageIgnore
93-
*
94-
* @return array
95-
*/
96-
protected function getWhitelist()
97-
{
98-
return $this->getAllowedFiles();
99-
100-
}//end getWhitelist()
101-
102-
10371
/**
10472
* Execute an external command.
10573
*

0 commit comments

Comments
 (0)