Skip to content

Commit 401a322

Browse files
authored
Merge pull request #1185 from PHPCSStandards/php-8.4/generic-loweruppercaseconstant-support-abstract-properties
PHP 8.4 | Generic/[Lower|Upper]CaseConstant: add support for abstract properties
2 parents df03d8a + d55748b commit 401a322

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

src/Standards/Generic/Sniffs/PHP/LowerCaseConstantSniff.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public function register()
7878
$targets[] = T_STATIC;
7979
$targets[] = T_READONLY;
8080
$targets[] = T_FINAL;
81+
$targets[] = T_ABSTRACT;
8182

8283
// Register function keywords to filter out param/return type declarations.
8384
$targets[] = T_FUNCTION;
@@ -139,6 +140,7 @@ public function process(File $phpcsFile, $stackPtr)
139140
|| $tokens[$stackPtr]['code'] === T_STATIC
140141
|| $tokens[$stackPtr]['code'] === T_READONLY
141142
|| $tokens[$stackPtr]['code'] === T_FINAL
143+
|| $tokens[$stackPtr]['code'] === T_ABSTRACT
142144
) {
143145
$skipOver = (Tokens::$emptyTokens + $this->propertyTypeTokens);
144146
$skipTo = $phpcsFile->findNext($skipOver, ($stackPtr + 1), null, true);

src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.1.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,8 @@ class WithAsym {
172172

173173
public protected(set) Type|NULL|bool $asym4 = TRUE;
174174
}
175+
176+
abstract class SkipOverPHP84AbstractProperties {
177+
abstract MyType|TRUE $propA {get;}
178+
protected abstract NULL|MyClass $propB {set;}
179+
}

src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.1.inc.fixed

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,8 @@ class WithAsym {
172172

173173
public protected(set) Type|NULL|bool $asym4 = true;
174174
}
175+
176+
abstract class SkipOverPHP84AbstractProperties {
177+
abstract MyType|TRUE $propA {get;}
178+
protected abstract NULL|MyClass $propB {set;}
179+
}

src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,8 @@ class WithAsym {
113113
protected(set) false|string|null $asym3 = null;
114114
public protected(set) Type|null|bool $asym4 = true;
115115
}
116+
117+
abstract class SkipOverPHP84AbstractProperties {
118+
abstract MyType|true $propA {get;}
119+
protected abstract null|MyClass $propB {set;}
120+
}

src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc.fixed

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,8 @@ class WithAsym {
113113
protected(set) false|string|null $asym3 = NULL;
114114
public protected(set) Type|null|bool $asym4 = TRUE;
115115
}
116+
117+
abstract class SkipOverPHP84AbstractProperties {
118+
abstract MyType|true $propA {get;}
119+
protected abstract null|MyClass $propB {set;}
120+
}

0 commit comments

Comments
 (0)