Skip to content

Commit cdac0ca

Browse files
#145 - Native function type declarations (#146)
* Native function type declarations * Refactor case casing to PascalCase
1 parent 948963f commit cdac0ca

File tree

6 files changed

+31
-4
lines changed

6 files changed

+31
-4
lines changed

src/Configuration/Defaults/CommonRules.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use PhpCsFixer\Fixer\Casing\MagicConstantCasingFixer;
2525
use PhpCsFixer\Fixer\Casing\MagicMethodCasingFixer;
2626
use PhpCsFixer\Fixer\Casing\NativeFunctionCasingFixer;
27+
use PhpCsFixer\Fixer\Casing\NativeTypeDeclarationCasingFixer;
2728
use PhpCsFixer\Fixer\CastNotation\CastSpacesFixer;
2829
use PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer;
2930
use PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer;
@@ -368,6 +369,7 @@ class CommonRules extends Rules
368369
NoMultilineWhitespaceAroundDoubleArrowFixer::class => true,
369370
CompactEmptyArrayFixer::class => true,
370371
ClassKeywordFixer::class => true,
372+
NativeTypeDeclarationCasingFixer::class => true,
371373
NamedArgumentFixer::class => true,
372374
NoBlankLinesAfterPhpdocFixer::class => true,
373375
ConstantCaseFixer::class => true,

tests/codestyle/CommonRulesetTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public static function providePhp81Fixtures(): array
4848
return [
4949
["enums"],
5050
["readonlies"],
51+
["nativeFunctionTypeDeclarations"],
5152
];
5253
}
5354

tests/fixtures/enums/actual.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
enum Status: string
44
{
5-
case ACTIVE = "active";
6-
case INACTIVE = "inactive";
5+
case Active = "active";
6+
case Inactive = "inactive";
77
}

tests/fixtures/enums/expected.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
enum Status: string
66
{
7-
case ACTIVE = "active";
8-
case INACTIVE = "inactive";
7+
case Active = "active";
8+
case Inactive = "inactive";
99
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
enum Status: String
6+
{
7+
case Active = "active";
8+
}
9+
enum Priority: Int
10+
{
11+
case High = 1;
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
enum Status: string
6+
{
7+
case Active = "active";
8+
}
9+
enum Priority: int
10+
{
11+
case High = 1;
12+
}

0 commit comments

Comments
 (0)