-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Add supported PHP versions section to the README (#6768)
Co-authored-by: Kuba Werłos <werlos@gmail.com> Co-authored-by: Grzegorz Korba <wirone@gmail.com>
- Loading branch information
1 parent
fb62107
commit 3d13b83
Showing
2 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of PHP CS Fixer. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* Dariusz Rumiński <dariusz.ruminski@gmail.com> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace PhpCsFixer\Tests\AutoReview; | ||
|
||
use PhpCsFixer\Tests\TestCase; | ||
|
||
/** | ||
* @author Victor Bocharsky <bocharsky.bw@gmail.com> | ||
* | ||
* @internal | ||
* | ||
* @coversNothing | ||
* | ||
* @group auto-review | ||
* @group covers-nothing | ||
*/ | ||
final class ReadmeTest extends TestCase | ||
{ | ||
public function testSupportedPhpVersions(): void | ||
{ | ||
$phpVersionIdLines = []; | ||
|
||
$file = new \SplFileObject(__DIR__.'/../../php-cs-fixer'); | ||
while (!$file->eof()) { | ||
$line = $file->fgets(); | ||
if (str_contains($line, 'PHP_VERSION_ID')) { | ||
$phpVersionIdLines[] = $line; | ||
} | ||
} | ||
// Unset the file to call __destruct(), closing the file handle. | ||
$file = null; | ||
|
||
static::assertEqualsCanonicalizing([ | ||
' if (\PHP_VERSION_ID === 80000) {'."\n", | ||
' if (\PHP_VERSION_ID < 70400 || \PHP_VERSION_ID >= 80200) {'."\n", | ||
], $phpVersionIdLines, 'Seems supported PHP versions changed in "./php-cs-fixer" - edit the README.md (and this test file) to match them!'); | ||
} | ||
} |