Skip to content

Commit 7c196db

Browse files
committed
minor #5824 Deprecate v2 (keradus)
This PR was squashed before being merged into the 2.19 branch. Discussion ---------- Deprecate v2 Commits ------- cfa2df6 Deprecate v2
2 parents 0d01a51 + cfa2df6 commit 7c196db

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/Console/WarningsDetector.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ public function __construct(ToolInfoInterface $toolInfo)
3939

4040
public function detectOldMajor()
4141
{
42-
// @TODO 2.99 to be activated with new MAJOR release
43-
// $this->warnings[] = 'You are running PHP CS Fixer v2, which is not maintained anymore. Please update to v3.';
42+
$currentMajorVersion = \intval(explode('.', Application::VERSION)[0], 10);
43+
$nextMajorVersion = $currentMajorVersion + 1;
44+
$this->warnings[] = "You are running PHP CS Fixer v{$currentMajorVersion}, which is not maintained anymore. Please update to v{$nextMajorVersion}.";
4445
}
4546

4647
public function detectOldVendor()

tests/Smoke/CiIntegrationTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,19 @@ public function testIntegration(
140140
$steps[4],
141141
]);
142142

143+
$optionalDeprecatedVersionWarning = 'You are running PHP CS Fixer v2, which is not maintained anymore. Please update to v3.
144+
';
145+
143146
$optionalIncompatibilityWarning = 'PHP needs to be a minimum version of PHP 5.6.0 and maximum version of PHP 7.4.*.
144147
Current PHP version: '.PHP_VERSION.'.
145148
Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable.
146149
';
147150

148151
$optionalXdebugWarning = 'You are running PHP CS Fixer with xdebug enabled. This has a major impact on runtime performance.
149-
If you need help while solving warnings, ask at https://gitter.im/PHP-CS-Fixer, we will help you!
152+
';
153+
154+
$optionalWarningsHelp = 'If you need help while solving warnings, ask at https://gitter.im/PHP-CS-Fixer, we will help you!
155+
150156
';
151157

152158
/** @phpstan-ignore-next-line to avoid `Ternary operator condition is always true|false.` */
@@ -155,9 +161,11 @@ public function testIntegration(
155161
: 'PHP CS Fixer '.preg_quote(Application::VERSION, '/').' by Fabien Potencier and Dariusz Ruminski';
156162

157163
$pattern = sprintf(
158-
'/^(?:%s)?(?:%s)?%s\n%s\n%s\n([\.S]{%d})\n%s$/',
164+
'/^(?:%s)?(?:%s)?(?:%s)?(?:%s)?%s\n%s\n%s\n([\.S]{%d})\n%s$/',
165+
preg_quote($optionalDeprecatedVersionWarning, '/'),
159166
preg_quote($optionalIncompatibilityWarning, '/'),
160167
preg_quote($optionalXdebugWarning, '/'),
168+
preg_quote($optionalWarningsHelp, '/'),
161169
$aboutSubpattern,
162170
preg_quote(sprintf('Runtime: PHP %s', PHP_VERSION), '/'),
163171
preg_quote('Loaded config default from ".php-cs-fixer.dist.php".', '/'),

0 commit comments

Comments
 (0)