This repository has been archived by the owner on Dec 3, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CS] Add allow_classes option to ClassStringToClassConstantFixer [closes
- Loading branch information
1 parent
30127fb
commit 6956252
Showing
5 changed files
with
72 additions
and
14 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
21 changes: 21 additions & 0 deletions
21
...ges/CodingStandard/tests/Fixer/Php/ClassStringToClassConstantFixer/AllowedClassesTest.php
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,21 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Symplify\CodingStandard\Tests\Fixer\Php\ClassStringToClassConstantFixer; | ||
|
||
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase; | ||
|
||
/** | ||
* @see \Symplify\CodingStandard\Fixer\Php\ClassStringToClassConstantFixer | ||
*/ | ||
final class AllowedClassesTest extends AbstractCheckerTestCase | ||
{ | ||
public function testWrongToFixed(): void | ||
{ | ||
$this->doTestCorrectFile(__DIR__ . '/correct/correct2.php.inc'); | ||
} | ||
|
||
protected function provideConfig(): string | ||
{ | ||
return __DIR__ . '/config-with-allowed-classes.yml'; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...gStandard/tests/Fixer/Php/ClassStringToClassConstantFixer/config-with-allowed-classes.yml
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,4 @@ | ||
services: | ||
Symplify\CodingStandard\Fixer\Php\ClassStringToClassConstantFixer: | ||
allow_classes: | ||
- 'DateTimeInterface' |
3 changes: 3 additions & 0 deletions
3
...s/CodingStandard/tests/Fixer/Php/ClassStringToClassConstantFixer/correct/correct2.php.inc
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,3 @@ | ||
<?php | ||
|
||
$classType = 'DateTimeInterface'; |