Skip to content

Commit 69430c5

Browse files
authored
Merge pull request #888 from PHPCSStandards/feature/188-deprecate-all-sniffs-removed-in-4.0
Hard deprecate all sniffs which will be removed in PHPCS 4.0
2 parents aa6eed0 + dd7257e commit 69430c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1824
-48
lines changed

src/Standards/Generic/Sniffs/Debug/CSSLintSniff.php

+38-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313

1414
use PHP_CodeSniffer\Config;
1515
use PHP_CodeSniffer\Files\File;
16+
use PHP_CodeSniffer\Sniffs\DeprecatedSniff;
1617
use PHP_CodeSniffer\Sniffs\Sniff;
1718
use PHP_CodeSniffer\Util\Common;
1819

19-
class CSSLintSniff implements Sniff
20+
class CSSLintSniff implements Sniff, DeprecatedSniff
2021
{
2122

2223
/**
@@ -95,4 +96,40 @@ public function process(File $phpcsFile, $stackPtr)
9596
}//end process()
9697

9798

99+
/**
100+
* Provide the version number in which the sniff was deprecated.
101+
*
102+
* @return string
103+
*/
104+
public function getDeprecationVersion()
105+
{
106+
return 'v3.9.0';
107+
108+
}//end getDeprecationVersion()
109+
110+
111+
/**
112+
* Provide the version number in which the sniff will be removed.
113+
*
114+
* @return string
115+
*/
116+
public function getRemovalVersion()
117+
{
118+
return 'v4.0.0';
119+
120+
}//end getRemovalVersion()
121+
122+
123+
/**
124+
* Provide a custom message to display with the deprecation.
125+
*
126+
* @return string
127+
*/
128+
public function getDeprecationMessage()
129+
{
130+
return 'Support for scanning CSS files will be removed completely in v4.0.0.';
131+
132+
}//end getDeprecationMessage()
133+
134+
98135
}//end class

src/Standards/Generic/Sniffs/Debug/ClosureLinterSniff.php

+38-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313

1414
use PHP_CodeSniffer\Config;
1515
use PHP_CodeSniffer\Files\File;
16+
use PHP_CodeSniffer\Sniffs\DeprecatedSniff;
1617
use PHP_CodeSniffer\Sniffs\Sniff;
1718
use PHP_CodeSniffer\Util\Common;
1819

19-
class ClosureLinterSniff implements Sniff
20+
class ClosureLinterSniff implements Sniff, DeprecatedSniff
2021
{
2122

2223
/**
@@ -116,4 +117,40 @@ public function process(File $phpcsFile, $stackPtr)
116117
}//end process()
117118

118119

120+
/**
121+
* Provide the version number in which the sniff was deprecated.
122+
*
123+
* @return string
124+
*/
125+
public function getDeprecationVersion()
126+
{
127+
return 'v3.9.0';
128+
129+
}//end getDeprecationVersion()
130+
131+
132+
/**
133+
* Provide the version number in which the sniff will be removed.
134+
*
135+
* @return string
136+
*/
137+
public function getRemovalVersion()
138+
{
139+
return 'v4.0.0';
140+
141+
}//end getRemovalVersion()
142+
143+
144+
/**
145+
* Provide a custom message to display with the deprecation.
146+
*
147+
* @return string
148+
*/
149+
public function getDeprecationMessage()
150+
{
151+
return 'Support for scanning JavaScript files will be removed completely in v4.0.0.';
152+
153+
}//end getDeprecationMessage()
154+
155+
119156
}//end class

src/Standards/Generic/Sniffs/Debug/ESLintSniff.php

+38-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313

1414
use PHP_CodeSniffer\Config;
1515
use PHP_CodeSniffer\Files\File;
16+
use PHP_CodeSniffer\Sniffs\DeprecatedSniff;
1617
use PHP_CodeSniffer\Sniffs\Sniff;
1718
use PHP_CodeSniffer\Util\Common;
1819

19-
class ESLintSniff implements Sniff
20+
class ESLintSniff implements Sniff, DeprecatedSniff
2021
{
2122

2223
/**
@@ -112,4 +113,40 @@ public function process(File $phpcsFile, $stackPtr)
112113
}//end process()
113114

114115

116+
/**
117+
* Provide the version number in which the sniff was deprecated.
118+
*
119+
* @return string
120+
*/
121+
public function getDeprecationVersion()
122+
{
123+
return 'v3.9.0';
124+
125+
}//end getDeprecationVersion()
126+
127+
128+
/**
129+
* Provide the version number in which the sniff will be removed.
130+
*
131+
* @return string
132+
*/
133+
public function getRemovalVersion()
134+
{
135+
return 'v4.0.0';
136+
137+
}//end getRemovalVersion()
138+
139+
140+
/**
141+
* Provide a custom message to display with the deprecation.
142+
*
143+
* @return string
144+
*/
145+
public function getDeprecationMessage()
146+
{
147+
return 'Support for scanning JavaScript files will be removed completely in v4.0.0.';
148+
149+
}//end getDeprecationMessage()
150+
151+
115152
}//end class

src/Standards/Generic/Sniffs/Debug/JSHintSniff.php

+38-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414

1515
use PHP_CodeSniffer\Config;
1616
use PHP_CodeSniffer\Files\File;
17+
use PHP_CodeSniffer\Sniffs\DeprecatedSniff;
1718
use PHP_CodeSniffer\Sniffs\Sniff;
1819
use PHP_CodeSniffer\Util\Common;
1920

20-
class JSHintSniff implements Sniff
21+
class JSHintSniff implements Sniff, DeprecatedSniff
2122
{
2223

2324
/**
@@ -94,4 +95,40 @@ public function process(File $phpcsFile, $stackPtr)
9495
}//end process()
9596

9697

98+
/**
99+
* Provide the version number in which the sniff was deprecated.
100+
*
101+
* @return string
102+
*/
103+
public function getDeprecationVersion()
104+
{
105+
return 'v3.9.0';
106+
107+
}//end getDeprecationVersion()
108+
109+
110+
/**
111+
* Provide the version number in which the sniff will be removed.
112+
*
113+
* @return string
114+
*/
115+
public function getRemovalVersion()
116+
{
117+
return 'v4.0.0';
118+
119+
}//end getRemovalVersion()
120+
121+
122+
/**
123+
* Provide a custom message to display with the deprecation.
124+
*
125+
* @return string
126+
*/
127+
public function getDeprecationMessage()
128+
{
129+
return 'Support for scanning JavaScript files will be removed completely in v4.0.0.';
130+
131+
}//end getDeprecationMessage()
132+
133+
97134
}//end class

src/Standards/Generic/Sniffs/Formatting/NoSpaceAfterCastSniff.php

+38-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Formatting;
1414

1515
use PHP_CodeSniffer\Files\File;
16+
use PHP_CodeSniffer\Sniffs\DeprecatedSniff;
1617
use PHP_CodeSniffer\Sniffs\Sniff;
1718
use PHP_CodeSniffer\Util\Tokens;
1819

19-
class NoSpaceAfterCastSniff implements Sniff
20+
class NoSpaceAfterCastSniff implements Sniff, DeprecatedSniff
2021
{
2122

2223

@@ -58,4 +59,40 @@ public function process(File $phpcsFile, $stackPtr)
5859
}//end process()
5960

6061

62+
/**
63+
* Provide the version number in which the sniff was deprecated.
64+
*
65+
* @return string
66+
*/
67+
public function getDeprecationVersion()
68+
{
69+
return 'v3.4.0';
70+
71+
}//end getDeprecationVersion()
72+
73+
74+
/**
75+
* Provide the version number in which the sniff will be removed.
76+
*
77+
* @return string
78+
*/
79+
public function getRemovalVersion()
80+
{
81+
return 'v4.0.0';
82+
83+
}//end getRemovalVersion()
84+
85+
86+
/**
87+
* Provide a custom message to display with the deprecation.
88+
*
89+
* @return string
90+
*/
91+
public function getDeprecationMessage()
92+
{
93+
return 'Use the Generic.Formatting.SpaceAfterCast sniff with the $spacing property set to 0 instead.';
94+
95+
}//end getDeprecationMessage()
96+
97+
6198
}//end class

src/Standards/Generic/Sniffs/Functions/CallTimePassByReferenceSniff.php

+38-1
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
namespace PHP_CodeSniffer\Standards\Generic\Sniffs\Functions;
1313

1414
use PHP_CodeSniffer\Files\File;
15+
use PHP_CodeSniffer\Sniffs\DeprecatedSniff;
1516
use PHP_CodeSniffer\Sniffs\Sniff;
1617
use PHP_CodeSniffer\Util\Tokens;
1718

18-
class CallTimePassByReferenceSniff implements Sniff
19+
class CallTimePassByReferenceSniff implements Sniff, DeprecatedSniff
1920
{
2021

2122

@@ -140,4 +141,40 @@ public function process(File $phpcsFile, $stackPtr)
140141
}//end process()
141142

142143

144+
/**
145+
* Provide the version number in which the sniff was deprecated.
146+
*
147+
* @return string
148+
*/
149+
public function getDeprecationVersion()
150+
{
151+
return 'v3.12.1';
152+
153+
}//end getDeprecationVersion()
154+
155+
156+
/**
157+
* Provide the version number in which the sniff will be removed.
158+
*
159+
* @return string
160+
*/
161+
public function getRemovalVersion()
162+
{
163+
return 'v4.0.0';
164+
165+
}//end getRemovalVersion()
166+
167+
168+
/**
169+
* Provide a custom message to display with the deprecation.
170+
*
171+
* @return string
172+
*/
173+
public function getDeprecationMessage()
174+
{
175+
return '';
176+
177+
}//end getDeprecationMessage()
178+
179+
143180
}//end class

src/Standards/MySource/Sniffs/CSS/BrowserSpecificStylesSniff.php

+38-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111

1212
namespace PHP_CodeSniffer\Standards\MySource\Sniffs\CSS;
1313

14+
use PHP_CodeSniffer\Sniffs\DeprecatedSniff;
1415
use PHP_CodeSniffer\Sniffs\Sniff;
1516
use PHP_CodeSniffer\Files\File;
1617

17-
class BrowserSpecificStylesSniff implements Sniff
18+
class BrowserSpecificStylesSniff implements Sniff, DeprecatedSniff
1819
{
1920

2021
/**
@@ -86,4 +87,40 @@ public function process(File $phpcsFile, $stackPtr)
8687
}//end process()
8788

8889

90+
/**
91+
* Provide the version number in which the sniff was deprecated.
92+
*
93+
* @return string
94+
*/
95+
public function getDeprecationVersion()
96+
{
97+
return 'v3.9.0';
98+
99+
}//end getDeprecationVersion()
100+
101+
102+
/**
103+
* Provide the version number in which the sniff will be removed.
104+
*
105+
* @return string
106+
*/
107+
public function getRemovalVersion()
108+
{
109+
return 'v4.0.0';
110+
111+
}//end getRemovalVersion()
112+
113+
114+
/**
115+
* Provide a custom message to display with the deprecation.
116+
*
117+
* @return string
118+
*/
119+
public function getDeprecationMessage()
120+
{
121+
return 'The MySource standard will be removed completely in v4.0.0.';
122+
123+
}//end getDeprecationMessage()
124+
125+
89126
}//end class

0 commit comments

Comments
 (0)