mirror of
https://github.com/elyby/php-code-style.git
synced 2025-05-31 14:12:05 +05:30
Migrate to PHP-CS-Fixer 3. Upgrade custom rules. Upgrade ruleset.
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user