Skip to content

Commit d7a7cca

Browse files
authored
Merge pull request #1189 from PHPCSStandards/php-8.4/various-sniffs-add-tests-for-abstract-properties
PHP 8.4 | Various sniffs: add tests with abstract properties
2 parents edf4757 + ec28ee6 commit d7a7cca

13 files changed

+73
-0
lines changed

src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ $anon = new ReadOnly class() {};
1818
class FinalProperties {
1919
FINAL int $prop = 1;
2020
}
21+
22+
ABSTRACT class AbstractProperties {
23+
Abstract int $prop {set;}
24+
}

src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.inc.fixed

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ $anon = new readonly class() {};
1818
class FinalProperties {
1919
final int $prop = 1;
2020
}
21+
22+
abstract class AbstractProperties {
23+
abstract int $prop {set;}
24+
}

src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public function getErrorList()
4242
14 => 1,
4343
16 => 1,
4444
19 => 1,
45+
22 => 1,
46+
23 => 1,
4547
];
4648

4749
return $errors;

src/Standards/Squiz/Tests/Commenting/BlockCommentUnitTest.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,3 +331,10 @@ class AsymVisibility {
331331
*/
332332
private(set) int $prop = 1;
333333
}
334+
335+
abstract class AbstractProperties {
336+
/**
337+
* Comment should be ignored.
338+
*/
339+
abstract int $prop {get;}
340+
}

src/Standards/Squiz/Tests/Commenting/BlockCommentUnitTest.inc.fixed

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,10 @@ class AsymVisibility {
333333
*/
334334
private(set) int $prop = 1;
335335
}
336+
337+
abstract class AbstractProperties {
338+
/**
339+
* Comment should be ignored.
340+
*/
341+
abstract int $prop {get;}
342+
}

src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,16 @@ class AsymVisibility {
131131
*/
132132
private(set) int $prop = 1;
133133
}
134+
135+
/**
136+
* Some info about the class here.
137+
*/
138+
abstract class AbstractClassWithAbstractProp
139+
{
140+
/**
141+
*Some info about the property here.
142+
*
143+
* @var int
144+
*/
145+
abstract $property {get;}
146+
}

src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc.fixed

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,16 @@ class AsymVisibility {
131131
*/
132132
private(set) int $prop = 1;
133133
}
134+
135+
/**
136+
* Some info about the class here.
137+
*/
138+
abstract class AbstractClassWithAbstractProp
139+
{
140+
/**
141+
* Some info about the property here.
142+
*
143+
* @var int
144+
*/
145+
abstract $property {get;}
146+
}

src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ public function getErrorList($testFile='')
6868
$errors[121] = 1;
6969
$errors[125] = 1;
7070
$errors[126] = 1;
71+
72+
$errors[136] = 1;
73+
$errors[137] = 1;
74+
$errors[141] = 2;
75+
$errors[142] = 1;
76+
$errors[143] = 1;
77+
$errors[144] = 1;
7178
}//end if
7279

7380
return $errors;

src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,7 @@ class AsymVisibility {
8585
protected(set) public $asymPublicProtected = 'hello';
8686
protected private(set) $asymProtectedPrivate = 'hello';
8787
}
88+
89+
abstract class PHP84AbstractProperties {
90+
abstract string $abstract {get;}
91+
}

src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function getErrorList()
4343
80 => 1,
4444
81 => 1,
4545
82 => 1,
46+
90 => 1,
4647
];
4748

4849
}//end getErrorList()

0 commit comments

Comments
 (0)