Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ec3b1e4

Browse files
committedApr 11, 2023
Merge remote-tracking branch 'origin/develop' into feature/typed_class_properties
# Conflicts: # Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc
2 parents 1e60800 + bc6b0f6 commit ec3b1e4

31 files changed

+685
-426
lines changed
 

‎.github/workflows/php.yml

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
php-version:
16-
- "7.3"
1716
- "7.4"
1817
- "8.0"
1918
- "8.1"

‎Magento2/Helpers/Commenting/PHPDocFormattingValidator.php

+6
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ public function hasDeprecatedWellFormatted($commentStartPtr, $tokens)
123123
}
124124
$seePtr = $this->getTagPosition('@see', $commentStartPtr, $tokens);
125125
if ($seePtr === -1) {
126+
if (preg_match(
127+
"/This [a-zA-Z]* will be removed in version \d.\d.\d without replacement/",
128+
$tokens[$deprecatedPtr + 2]['content']
129+
)) {
130+
return true;
131+
}
126132
return false;
127133
}
128134

‎Magento2/Rector/Tests/AddArrayAccessInterfaceReturnTypes/AddArrayAccessInterfaceReturnTypesTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class AddArrayAccessInterfaceReturnTypesTest extends AbstractRectorTestCase
1616
/**
1717
* @dataProvider provideData()
1818
*/
19-
public function test(SmartFileInfo $fileInfo): void
19+
public function test(string $fileInfo): void
2020
{
21-
$this->doTestFileInfo($fileInfo);
21+
$this->doTestFile($fileInfo);
2222
}
2323

2424
/**
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?php
22
/**
3-
* Copyright 2021 Adobe
3+
* Copyright 2022 Adobe
44
* See COPYING.txt for license details.
55
*/
66
declare(strict_types=1);
77

88
use Magento2\Rector\Src\AddArrayAccessInterfaceReturnTypes;
9-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
9+
use Rector\Config\RectorConfig;
1010

11-
return static function (ContainerConfigurator $containerConfigurator): void {
12-
$services = $containerConfigurator->services();
13-
$services->set(AddArrayAccessInterfaceReturnTypes::class);
11+
return static function (RectorConfig $rectorConfig): void {
12+
$rectorConfig->rule(AddArrayAccessInterfaceReturnTypes::class);
1413
};

‎Magento2/Rector/Tests/ReplaceMbStrposNullLimit/ReplaceMbStrposNullLimitTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class ReplaceMbStrposNullLimitTest extends AbstractRectorTestCase
1616
/**
1717
* @dataProvider provideData()
1818
*/
19-
public function test(SmartFileInfo $fileInfo): void
19+
public function test(string $fileInfo): void
2020
{
21-
$this->doTestFileInfo($fileInfo);
21+
$this->doTestFile($fileInfo);
2222
}
2323

2424
/**
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?php
22
/**
3-
* Copyright 2021 Adobe
3+
* Copyright 2022 Adobe
44
* See COPYING.txt for license details.
55
*/
66
declare(strict_types=1);
77

88
use Magento2\Rector\Src\ReplaceMbStrposNullLimit;
9-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
9+
use Rector\Config\RectorConfig;
1010

11-
return static function (ContainerConfigurator $containerConfigurator): void {
12-
$services = $containerConfigurator->services();
13-
$services->set(ReplaceMbStrposNullLimit::class);
11+
return static function (RectorConfig $rectorConfig): void {
12+
$rectorConfig->rule(ReplaceMbStrposNullLimit::class);
1413
};

‎Magento2/Rector/Tests/ReplaceNewDateTimeNull/ReplaceNewDateTimeNullTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class ReplaceNewDateTimeNullTest extends AbstractRectorTestCase
1616
/**
1717
* @dataProvider provideData()
1818
*/
19-
public function test(SmartFileInfo $fileInfo): void
19+
public function test(string $fileInfo): void
2020
{
21-
$this->doTestFileInfo($fileInfo);
21+
$this->doTestFile($fileInfo);
2222
}
2323

2424
/**
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?php
22
/**
3-
* Copyright 2021 Adobe
3+
* Copyright 2022 Adobe
44
* See COPYING.txt for license details.
55
*/
66
declare(strict_types=1);
77

88
use Magento2\Rector\Src\ReplaceNewDateTimeNull;
9-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
9+
use Rector\Config\RectorConfig;
1010

11-
return static function (ContainerConfigurator $containerConfigurator): void {
12-
$services = $containerConfigurator->services();
13-
$services->set(ReplaceNewDateTimeNull::class);
11+
return static function (RectorConfig $rectorConfig): void {
12+
$rectorConfig->rule(ReplaceNewDateTimeNull::class);
1413
};

‎Magento2/Rector/Tests/ReplacePregSplitNullLimit/ReplacePregSplitNullLimitTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class ReplacePregSplitNullLimitTest extends AbstractRectorTestCase
1616
/**
1717
* @dataProvider provideData()
1818
*/
19-
public function test(SmartFileInfo $fileInfo): void
19+
public function test(string $fileInfo): void
2020
{
21-
$this->doTestFileInfo($fileInfo);
21+
$this->doTestFile($fileInfo);
2222
}
2323

2424
/**
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?php
22
/**
3-
* Copyright 2021 Adobe
3+
* Copyright 2022 Adobe
44
* See COPYING.txt for license details.
55
*/
66
declare(strict_types=1);
77

88
use Magento2\Rector\Src\ReplacePregSplitNullLimit;
9-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
9+
use Rector\Config\RectorConfig;
1010

11-
return static function (ContainerConfigurator $containerConfigurator): void {
12-
$services = $containerConfigurator->services();
13-
$services->set(ReplacePregSplitNullLimit::class);
11+
return static function (RectorConfig $rectorConfig): void {
12+
$rectorConfig->rule(ReplacePregSplitNullLimit::class);
1413
};

‎Magento2/Sniffs/Commenting/ClassAndInterfacePHPDocFormattingSniff.php

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ClassAndInterfacePHPDocFormattingSniff implements Sniff
2424
* @var string[] List of tags that can not be used in comments
2525
*/
2626
public $forbiddenTags = [
27+
'@author',
2728
'@category',
2829
'@package',
2930
'@subpackage'

‎Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ class ClassPropertyPHPDocFormattingSniff extends AbstractVariableSniff
2929
T_NS_SEPARATOR,
3030
T_STRING,
3131
T_COMMENT,
32-
T_NULLABLE
32+
T_NULLABLE,
33+
T_BITWISE_AND,
34+
T_TYPE_UNION,
3335
];
3436

3537
/**

‎Magento2/Sniffs/Legacy/TableNameSniff.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,10 @@ private function checkOccurrencesInProperty(File $phpcsFile, int $stackPtr, arra
189189
private function checkOccurrencesInArray(File $phpcsFile, int $stackPtr, array $tokens): void
190190
{
191191
$aliasPos = $phpcsFile->findPrevious(
192-
T_CONSTANT_ENCAPSED_STRING,
193-
$stackPtr -1
192+
T_WHITESPACE,
193+
$stackPtr - 1,
194+
null,
195+
true,
194196
);
195197

196198
$alias = trim($tokens[$aliasPos]['content'], '\'"');

‎Magento2/Sniffs/Legacy/_files/restricted_classes.php

+305
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,311 @@
2929
'Magento/Framework/DB/Adapter/Pdo/Mysql.php'
3030
]
3131
],
32+
'Zend_Json' => [
33+
'warning_code' => 'ZendJsonIsRestricted',
34+
'replacement' => 'Magento\Framework\Serialize\Serializer\Json',
35+
'exclude' => []
36+
],
37+
'Zend_Json_Exception' => [
38+
'warning_code' => 'ZendJsonIsRestricted',
39+
'replacement' => '\InvalidArgumentException',
40+
'exclude' => []
41+
],
42+
'Zend_Acl' => [
43+
'warning_code' => 'ZendAclIsRestricted',
44+
'replacement' => 'Laminas\Permissions\Acl\Acl',
45+
'exclude' => []
46+
],
47+
'Zend_Acl_Role' => [
48+
'warning_code' => 'ZendAclIsRestricted',
49+
'replacement' => 'Laminas\Permissions\Acl\Role\GenericRole',
50+
'exclude' => []
51+
],
52+
'Zend_Acl_Resource' => [
53+
'warning_code' => 'ZendAclIsRestricted',
54+
'replacement' => 'Laminas\Permissions\Acl\Resource\GenericResource',
55+
'exclude' => []
56+
],
57+
'Zend_Acl_Role_Registry' => [
58+
'warning_code' => 'ZendAclIsRestricted',
59+
'replacement' => 'Laminas\Permissions\Acl\Role\Registry',
60+
'exclude' => []
61+
],
62+
'Zend_Acl_Role_Registry_Exception' => [
63+
'warning_code' => 'ZendAclIsRestricted',
64+
'replacement' => 'Laminas\Permissions\Acl\Exception\InvalidArgumentException',
65+
'exclude' => []
66+
],
67+
'Zend_Acl_Exception' => [
68+
'warning_code' => 'ZendAclIsRestricted',
69+
'replacement' => 'Laminas\Permissions\Acl\Exception\InvalidArgumentException',
70+
'exclude' => []
71+
],
72+
'Zend_Acl_Role_Interface' => [
73+
'warning_code' => 'ZendAclIsRestricted',
74+
'replacement' => 'Laminas\Permissions\Acl\Role\RoleInterface',
75+
'exclude' => []
76+
],
77+
'Zend_Currency' => [
78+
'warning_code' => 'ZendAclIsRestricted',
79+
'replacement' => 'Magento\Framework\Currency\Data\Currency',
80+
'exclude' => []
81+
],
82+
'Zend_Currency_Exception' => [
83+
'warning_code' => 'ZendCurrencyIsRestricted',
84+
'replacement' => 'Magento\Framework\Currency\Exception\CurrencyException',
85+
'exclude' => []
86+
],
87+
'Zend_Oauth_Http_Utility' => [
88+
'warning_code' => 'ZendOauthIsRestricted',
89+
'replacement' => 'Laminas\OAuth\Http\Utility',
90+
'exclude' => []
91+
],
92+
'Zend_Measure_Weight' => [
93+
'warning_code' => 'ZendMeasureIsRestricted',
94+
'replacement' => 'Magento\Framework\Measure\Weight',
95+
'exclude' => []
96+
],
97+
'Zend_Measure_Length' => [
98+
'warning_code' => 'ZendMeasureIsRestricted',
99+
'replacement' => 'Magento\Framework\Measure\Length',
100+
'exclude' => []
101+
],
102+
'Zend_Validate' => [
103+
'warning_code' => 'ZendValidateIsRestricted',
104+
'replacement' => 'Magento\Framework\Validator\ValidatorChain',
105+
'exclude' => []
106+
],
107+
'Zend_Validate_Regex' => [
108+
'warning_code' => 'ZendValidateIsRestricted',
109+
'replacement' => 'Laminas\Validator\Regex',
110+
'exclude' => []
111+
],
112+
'Zend_Validate_Interface' => [
113+
'warning_code' => 'ZendValidateIsRestricted',
114+
'replacement' => 'Laminas\Validator\ValidatorInterface',
115+
'exclude' => []
116+
],
117+
'Zend_Validate_EmailAddress' => [
118+
'warning_code' => 'ZendValidateIsRestricted',
119+
'replacement' => 'Magento\Framework\Validator\EmailAddress',
120+
'exclude' => []
121+
],
122+
'Zend_Validate_StringLength' => [
123+
'warning_code' => 'ZendValidateIsRestricted',
124+
'replacement' => 'Magento\Framework\Validator\StringLength',
125+
'exclude' => []
126+
],
127+
'Zend_Validate_Exception' => [
128+
'warning_code' => 'ZendValidateIsRestricted',
129+
'replacement' => 'Magento\Framework\Validator\ValidateException',
130+
'exclude' => []
131+
],
132+
'Zend_Validate_File_ExcludeExtension' => [
133+
'warning_code' => 'ZendValidateIsRestricted',
134+
'replacement' => 'Laminas\Validator\File\ExcludeExtension',
135+
'exclude' => []
136+
],
137+
'Zend_Validate_File_Extension' => [
138+
'warning_code' => 'ZendValidateIsRestricted',
139+
'replacement' => 'Laminas\Validator\File\Extension',
140+
'exclude' => []
141+
],
142+
'Zend_Validate_File_ImageSize' => [
143+
'warning_code' => 'ZendValidateIsRestricted',
144+
'replacement' => 'Laminas\Validator\File\ImageSize',
145+
'exclude' => []
146+
],
147+
'Zend_Validate_File_FilesSize' => [
148+
'warning_code' => 'ZendValidateIsRestricted',
149+
'replacement' => 'Laminas\Validator\File\FilesSize',
150+
'exclude' => []
151+
],
152+
'Zend_Validate_Alnum' => [
153+
'warning_code' => 'ZendValidateIsRestricted',
154+
'replacement' => 'Magento\Framework\Validator\Alnum',
155+
'exclude' => []
156+
],
157+
'Zend_Validate_Hostname' => [
158+
'warning_code' => 'ZendValidateIsRestricted',
159+
'replacement' => 'Magento\Framework\Validator\Hostname',
160+
'exclude' => []
161+
],
162+
'Zend_Validate_Date' => [
163+
'warning_code' => 'ZendValidateIsRestricted',
164+
'replacement' => 'Laminas\Validator\Date',
165+
'exclude' => []
166+
],
167+
'Zend_Validate_Digits' => [
168+
'warning_code' => 'ZendValidateIsRestricted',
169+
'replacement' => 'Laminas\Validator\Digits',
170+
'exclude' => []
171+
],
172+
'Zend_Validate_Alpha' => [
173+
'warning_code' => 'ZendValidateIsRestricted',
174+
'replacement' => 'Laminas\I18n\Validator\Alpha',
175+
'exclude' => []
176+
],
177+
'Zend_Validate_InArray' => [
178+
'warning_code' => 'ZendValidateIsRestricted',
179+
'replacement' => 'Laminas\Validator\InArray',
180+
'exclude' => []
181+
],
182+
'Zend_Validate_Abstract' => [
183+
'warning_code' => 'ZendValidateIsRestricted',
184+
'replacement' => 'Laminas\Validator\AbstractValidator',
185+
'exclude' => []
186+
],
187+
'Zend_Validate_NotEmpty' => [
188+
'warning_code' => 'ZendValidateIsRestricted',
189+
'replacement' => 'Magento\Framework\Validator\NotEmpty',
190+
'exclude' => []
191+
],
192+
'Zend_Validate_Callback' => [
193+
'warning_code' => 'ZendValidateIsRestricted',
194+
'replacement' => 'Laminas\Validator\Callback',
195+
'exclude' => []
196+
],
197+
'Zend_Validate_Ip' => [
198+
'warning_code' => 'ZendValidateIsRestricted',
199+
'replacement' => 'Laminas\Validator\Ip',
200+
'exclude' => []
201+
],
202+
'Zend_Validate_Identical' => [
203+
'warning_code' => 'ZendValidateIsRestricted',
204+
'replacement' => 'Laminas\Validator\Identical',
205+
'exclude' => []
206+
],
207+
'Zend_Validate_File_IsImage' => [
208+
'warning_code' => 'ZendValidateIsRestricted',
209+
'replacement' => 'Laminas\Validator\File\IsImage',
210+
'exclude' => []
211+
],
212+
'Zend_Validate_File_Size' => [
213+
'warning_code' => 'ZendValidateIsRestricted',
214+
'replacement' => 'Laminas\Validator\File\FilesSize',
215+
'exclude' => []
216+
],
217+
'Zend_Validate_Float' => [
218+
'warning_code' => 'ZendValidateIsRestricted',
219+
'replacement' => 'Laminas\I18n\Validator\IsFloat',
220+
'exclude' => []
221+
],
222+
'Zend_Validate_Int' => [
223+
'warning_code' => 'ZendValidateIsRestricted',
224+
'replacement' => 'Laminas\I18n\Validator\IsInt',
225+
'exclude' => []
226+
],
227+
'Magento\Framework\HTTP\ZendClient' => [
228+
'warning_code' => 'HttpZendClientIsRestricted',
229+
'replacement' => 'Magento\Framework\HTTP\LaminasClient',
230+
'exclude' => []
231+
],
232+
'Magento\Framework\HTTP\ZendClientFactory' => [
233+
'warning_code' => 'HttpZendClientFactoryIsRestricted',
234+
'replacement' => 'Magento\Framework\HTTP\LaminasClientFactory',
235+
'exclude' => []
236+
],
237+
'Zend_Http_Client' => [
238+
'warning_code' => 'ZendHttpIsRestricted',
239+
'replacement' => 'Laminas\Http\Request',
240+
'exclude' => []
241+
],
242+
'Zend_Http_Response' => [
243+
'warning_code' => 'ZendHttpIsRestricted',
244+
'replacement' => 'Laminas\Http\Response',
245+
'exclude' => []
246+
],
247+
'Zend_Http_Exception' => [
248+
'warning_code' => 'ZendHttpIsRestricted',
249+
'replacement' => 'Laminas\Http\Exception\RuntimeException',
250+
'exclude' => []
251+
],
252+
'Zend_Http_Client_Exception' => [
253+
'warning_code' => 'ZendHttpIsRestricted',
254+
'replacement' => 'Laminas\Http\Exception\RuntimeException',
255+
'exclude' => []
256+
],
257+
'Zend_Http_Client_Adapter_Interface' => [
258+
'warning_code' => 'ZendHttpIsRestricted',
259+
'replacement' => 'Laminas\Http\Client\Adapter\AdapterInterface',
260+
'exclude' => []
261+
],
262+
'Zend_Filter_File_Rename' => [
263+
'warning_code' => 'ZendFilterIsRestricted',
264+
'replacement' => 'Laminas\Filter\File\Rename',
265+
'exclude' => []
266+
],
267+
'Zend_Filter' => [
268+
'warning_code' => 'ZendFilterIsRestricted',
269+
'replacement' => 'Magento\Framework\Filter\FilterInput',
270+
'exclude' => []
271+
],
272+
'Zend_Filter_Input' => [
273+
'warning_code' => 'ZendFilterIsRestricted',
274+
'replacement' => 'Magento\Framework\Filter\FilterInput',
275+
'exclude' => []
276+
],
277+
'Zend_Filter_Interface' => [
278+
'warning_code' => 'ZendFilterIsRestricted',
279+
'replacement' => 'Laminas\Filter\FilterInterface',
280+
'exclude' => []
281+
],
282+
'Zend_Filter_LocalizedToNormalized' => [
283+
'warning_code' => 'ZendFilterIsRestricted',
284+
'replacement' => 'Magento\Framework\Filter\LocalizedToNormalized',
285+
'exclude' => []
286+
],
287+
'Zend_Filter_Decrypt' => [
288+
'warning_code' => 'ZendFilterIsRestricted',
289+
'replacement' => 'Laminas\Filter\Decrypt',
290+
'exclude' => []
291+
],
292+
'Zend_Filter_Encrypt' => [
293+
'warning_code' => 'ZendFilterIsRestricted',
294+
'replacement' => 'Laminas\Filter\Encrypt',
295+
'exclude' => []
296+
],
297+
'Zend_Filter_Encrypt_Interface' => [
298+
'warning_code' => 'ZendFilterIsRestricted',
299+
'replacement' => 'Laminas\Filter\Encrypt\EncryptionAlgorithmInterface',
300+
'exclude' => []
301+
],
302+
'Zend_Filter_Alnum' => [
303+
'warning_code' => 'ZendFilterIsRestricted',
304+
'replacement' => 'Laminas\I18n\Filter\Alnum',
305+
'exclude' => []
306+
],
307+
'Zend_Translate_Adapter' => [
308+
'warning_code' => 'ZendTranslateIsRestricted',
309+
'replacement' => 'Laminas\I18n\View\Helper\AbstractTranslatorHelper',
310+
'exclude' => []
311+
],
312+
'Zend_File_Transfer_Exception' => [
313+
'warning_code' => 'ZendFileIsRestricted',
314+
'replacement' => 'Laminas\File\Transfer\Exception\PhpEnvironmentException',
315+
'exclude' => []
316+
],
317+
'Zend_File_Transfer_Adapter_Http' => [
318+
'warning_code' => 'ZendFileIsRestricted',
319+
'replacement' => 'Magento\Framework\File\Http',
320+
'exclude' => []
321+
],
322+
'Zend_File_Transfer' => [
323+
'warning_code' => 'ZendFileIsRestricted',
324+
'replacement' => 'Laminas\File\Transfer\Transfer',
325+
'exclude' => []
326+
],
327+
'Zend_Date' => [
328+
'warning_code' => 'ZendDateIsRestricted',
329+
'replacement' => '\IntlDateFormatter',
330+
'exclude' => []
331+
],
332+
'Zend_Locale_Format' => [
333+
'warning_code' => 'ZendLocaleFormatIsRestricted',
334+
'replacement' => 'Laminas\I18n\Filter\NumberParse, \NumberFormatter, \IntlDateFormatter',
335+
'exclude' => []
336+
],
32337
'Magento\Framework\Serialize\Serializer\Serialize' => [
33338
'warning_code' => 'SerializerSerializeIsRestricted',
34339
'replacement' => 'Magento\Framework\Serialize\SerializerInterface',

‎Magento2/Sniffs/Less/ClassNamingSniff.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ public function process(File $phpcsFile, $stackPtr)
6666
[implode("", $matches[0])]
6767
);
6868
}
69-
if (strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false) {
69+
70+
if (strlen($className) > 1 && strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false
71+
&& !str_starts_with($className, 'admin__')
72+
) {
7073
$phpcsFile->addError(
7174
'CSS class names should be separated with "-" (dash) instead of "_" (underscore)',
7275
$stackPtr,

‎Magento2/Sniffs/PHP/ShortEchoSyntaxSniff.php

+20-1
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,30 @@ public function process(File $phpcsFile, $stackPtr)
3737

3838
$nextToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
3939
if ($tokens[$nextToken]['code'] == T_ECHO) {
40-
$phpcsFile->addWarning(
40+
$fix = $phpcsFile->addFixableWarning(
4141
'Short echo tag syntax must be used; expected "<?=" but found "<?php echo"',
4242
$stackPtr,
4343
'ShortEchoTag'
4444
);
45+
46+
if ($fix) {
47+
$phpcsFile->fixer->beginChangeset();
48+
49+
if (($nextToken - $stackPtr) === 1) {
50+
$phpcsFile->fixer->replaceToken($stackPtr, '<?=');
51+
} else {
52+
$phpcsFile->fixer->replaceToken($stackPtr, '<?= ');
53+
}
54+
55+
for ($i = $stackPtr + 1; $i < $nextToken; $i++) {
56+
if ($tokens[$i]['code'] === T_WHITESPACE) {
57+
$phpcsFile->fixer->replaceToken($i, '');
58+
}
59+
}
60+
61+
$phpcsFile->fixer->replaceToken($nextToken, '');
62+
$phpcsFile->fixer->endChangeset();
63+
}
4564
}
4665
}
4766
}

‎Magento2/Sniffs/Security/XssTemplateSniff.php

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ public function process(File $phpcsFile, $stackPtr)
135135
$statement = array_shift($this->statements);
136136
$this->detectUnescapedString($statement);
137137
}
138+
$this->hasDisallowedAnnotation = false;
138139
}
139140

140141
/**

‎Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.inc

+20
Original file line numberDiff line numberDiff line change
@@ -369,4 +369,24 @@ class MethodAnnotationFixture
369369
{
370370
return true;
371371
}
372+
373+
/**
374+
* This deprecated function is correct even though it only contains the @deprecated tag.
375+
*
376+
* @deprecated This method will be removed in version 1.0.0 without replacement
377+
*/
378+
public function correctBecauseOfKeywordPhrase()
379+
{
380+
return false;
381+
}
382+
383+
/**
384+
* This deprecated function is correct even though it only contains the @deprecated tag.
385+
*
386+
* @deprecated WOW! This method will be removed in version 1.0.0 without replacement
387+
*/
388+
public function alsoCorrectBecauseOfKeywordPhrase()
389+
{
390+
return false;
391+
}
372392
}

‎Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc

+19-2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ class EmptyHandler
6060
* @api is ok here
6161
* @deprecated can be used in this context
6262
* @see is ok here
63-
* @author is actually ok
63+
* @author should not be used
6464
* @category is irrelevant
65-
* @package is not ment to be used
65+
* @package should not be used
6666
* @subpackage does not belong here
6767
*/
6868
class ExampleHandler
@@ -162,3 +162,20 @@ class OldHandler
162162
{
163163

164164
}
165+
166+
/**
167+
* @deprecated This class will be removed in version 1.0.0 without replacement
168+
*/
169+
class DeprecatedButHandler
170+
{
171+
172+
}
173+
174+
/**
175+
* @deprecated It's also deprecated - This class will be removed in version 1.0.0 without replacement
176+
*/
177+
class AlsoDeprecatedButHandler
178+
{
179+
180+
}
181+

‎Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc

+18-2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ interface EmptyHandler
6060
* @api is ok here
6161
* @deprecated can be used in this context
6262
* @see is ok here
63-
* @author is actually ok
63+
* @author should not be used
6464
* @category is irrelevant
65-
* @package is not ment to be used
65+
* @package should not be used
6666
* @subpackage does not belong here
6767
*/
6868
interface ExampleHandler
@@ -153,3 +153,19 @@ interface DoNotCareHandler
153153
{
154154

155155
}
156+
157+
/**
158+
* @deprecated This interface will be removed in version 1.0.0 without replacement
159+
*/
160+
interface DeprecatedButHandler
161+
{
162+
163+
}
164+
165+
/**
166+
* @deprecated Yeah! This interface will be removed in version 1.0.0 without replacement
167+
*/
168+
interface AlsoDeprecatedButHandler
169+
{
170+
171+
}

‎Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function getWarningList($testFile = '')
2929
35 => 1,
3030
44 => 1,
3131
52 => 1,
32+
63 => 1,
3233
64 => 1,
3334
65 => 1,
3435
66 => 1,

‎Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc

+9-2
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ class correctlyFormattedClassMemberDocBlock
194194
* @see Message with some reference
195195
*/
196196
protected string $itIsCorrect;
197+
198+
/**
199+
* @var string
200+
* @deprecated This property will be removed in version 1.0.0 without replacement
201+
*/
202+
protected string $deprecatedWithKeyword;
203+
197204
private string $typedPropertyWithoutComment;
198205

199206
private string $typedPropertyWithoutComment2;
@@ -205,6 +212,6 @@ class correctlyFormattedClassMemberDocBlock
205212
private Test $typedPropertyWithoutComment5;
206213

207214
private Test|Test2 $typedPropertyWithoutComment6;
208-
209-
private ?Test $typedPropertyWithoutComment7;
215+
216+
private ?Test $typedPropertyWithoutComment7;
210217
}

‎Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.2.inc

+10
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,14 @@ class Profiler
6363
* @see
6464
*/
6565
const d = 100;
66+
67+
/**
68+
* @deprecated This constant will be removed in version 1.0.0 without replacement
69+
*/
70+
const KEYWORD_PHRASE = false;
71+
72+
/**
73+
* @deprecated It's awesome - This constant will be removed in version 1.0.0 without replacement
74+
*/
75+
const WITH_KEYWORD_PHRASE = false;
6676
}

‎Magento2/Tests/Legacy/TableNameUnitTest.inc

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ $select = $connection->select()->from(
2828
['main_table' => 'magento_sample_table']
2929
);
3030

31+
$fooBar=array(0=>array(125,0,875,750),'33' =>array(85,0,194,716), 10 => 100);
32+
3133
class Collection extends \Magento\Sales\Model\ResourceModel\Report\Order\Collection
3234
{
3335
/**

‎Magento2/Tests/Legacy/TableNameUnitTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function getErrorList($testFile = '')
1919
7 => 1,
2020
16 => 1,
2121
20 => 1,
22-
38 => 1,
22+
40 => 1,
2323
];
2424
}
2525

‎Magento2/Tests/Less/ClassNamingUnitTest.less

+10
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,13 @@
3030
.category-title {
3131
background: green;
3232
}
33+
34+
// @see https://github.com/magento/magento-coding-standard/issues/425
35+
.a {
36+
text-decoration: none;
37+
}
38+
39+
// @see https://github.com/magento/magento-coding-standard/issues/409
40+
.admin__allowed {
41+
background: green;
42+
}

‎Magento2/Tests/PHP/ShortEchoSyntaxUnitTest.inc

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
<?php $foo = bar; ?>
44

55
<?php echo "foo" ?>
6+
7+
<?php /* @noEscape */ echo 'baz'; ?>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?= "foo" ?>
2+
3+
<?php $foo = bar; ?>
4+
5+
<?= "foo" ?>
6+
7+
<?= /* @noEscape */ 'baz'; ?>

‎Magento2/Tests/PHP/ShortEchoSyntaxUnitTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function getWarningList()
2424
{
2525
return [
2626
5 => 1,
27+
7 => 1,
2728
];
2829
}
2930
}

‎composer.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
"AFL-3.0"
77
],
88
"type": "phpcodesniffer-standard",
9-
"version": "25",
9+
"version": "31",
1010
"require": {
11-
"php": ">=7.3",
12-
"webonyx/graphql-php": "^14.9",
11+
"php": ">=7.4",
12+
"webonyx/graphql-php": "^15.0",
1313
"ext-simplexml": "*",
1414
"ext-dom": "*",
1515
"phpcompatibility/php-compatibility": "^9.3",
1616
"squizlabs/php_codesniffer": "^3.6.1",
17-
"rector/rector": "^0.13.0"
17+
"rector/rector": "^0.15.10",
18+
"symfony/polyfill": "^1.16"
1819
},
1920
"require-dev": {
2021
"phpunit/phpunit": "^9.5.8"

‎composer.lock

+212-381
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.