Migrate to PHP-CS-Fixer 3. Upgrade custom rules. Upgrade ruleset.

This commit is contained in:
ErickSkrauch
2022-09-20 01:37:57 +02:00
parent ad25ce897b
commit 18806e41e2
22 changed files with 2676 additions and 1680 deletions

View File

@ -1,9 +1,10 @@
<?php
declare(strict_types=1);
namespace Ely\CS\Test\Fixer\Operator;
namespace Ely\CS\Test\Fixer\LanguageConstruct;
use Ely\CS\Fixer\LanguageConstruct\RemoveClassNameMethodUsagesFixer;
use PhpCsFixer\AbstractFixer;
use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
/**
@ -12,55 +13,53 @@ use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
class RemoveClassNameMethodUsagesFixerTest extends AbstractFixerTestCase {
/**
* @param string $expected
* @param null|string $input
*
* @dataProvider provideFixCases
*/
public function testFix($expected, $input = null) {
public function testFix(string $expected, ?string $input = null): void {
$this->doTest($expected, $input);
}
public function provideFixCases() {
return [
[
'<?php echo className();',
],
[
'<?php
public function provideFixCases(): iterable {
yield [
'<?php echo className();',
];
yield [
'<?php
use Foo\Bar\Baz;
$exceptionString = Baz::classname();
',
],
[
'<?php
];
yield [
'<?php
use Foo\Bar\Baz;
$className = Baz::class;
',
'<?php
'<?php
use Foo\Bar\Baz;
$className = Baz::className();
',
],
[
'<?php
];
yield [
'<?php
use Foo\Bar\Baz;
$exceptionString = "The class should be instance of " . Baz::class . " and nothing else";
',
'<?php
'<?php
use Foo\Bar\Baz;
$exceptionString = "The class should be instance of " . Baz::className() . " and nothing else";
',
],
];
}
protected function createFixer() {
protected function createFixer(): AbstractFixer {
return new RemoveClassNameMethodUsagesFixer();
}