Skip to content

PHP 8.4 | Various sniffs: add tests with abstract properties #1189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ $anon = new ReadOnly class() {};
class FinalProperties {
FINAL int $prop = 1;
}

ABSTRACT class AbstractProperties {
Abstract int $prop {set;}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ $anon = new readonly class() {};
class FinalProperties {
final int $prop = 1;
}

abstract class AbstractProperties {
abstract int $prop {set;}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public function getErrorList()
14 => 1,
16 => 1,
19 => 1,
22 => 1,
23 => 1,
];

return $errors;
Expand Down
7 changes: 7 additions & 0 deletions src/Standards/Squiz/Tests/Commenting/BlockCommentUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,10 @@ class AsymVisibility {
*/
private(set) int $prop = 1;
}

abstract class AbstractProperties {
/**
* Comment should be ignored.
*/
abstract int $prop {get;}
}
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,10 @@ class AsymVisibility {
*/
private(set) int $prop = 1;
}

abstract class AbstractProperties {
/**
* Comment should be ignored.
*/
abstract int $prop {get;}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,16 @@ class AsymVisibility {
*/
private(set) int $prop = 1;
}

/**
* Some info about the class here.
*/
abstract class AbstractClassWithAbstractProp
{
/**
*Some info about the property here.
*
* @var int
*/
abstract $property {get;}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,16 @@ class AsymVisibility {
*/
private(set) int $prop = 1;
}

/**
* Some info about the class here.
*/
abstract class AbstractClassWithAbstractProp
{
/**
* Some info about the property here.
*
* @var int
*/
abstract $property {get;}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ public function getErrorList($testFile='')
$errors[121] = 1;
$errors[125] = 1;
$errors[126] = 1;

$errors[136] = 1;
$errors[137] = 1;
$errors[141] = 2;
$errors[142] = 1;
$errors[143] = 1;
$errors[144] = 1;
}//end if

return $errors;
Expand Down
4 changes: 4 additions & 0 deletions src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,7 @@ class AsymVisibility {
protected(set) public $asymPublicProtected = 'hello';
protected private(set) $asymProtectedPrivate = 'hello';
}

abstract class PHP84AbstractProperties {
abstract string $abstract {get;}
}
1 change: 1 addition & 0 deletions src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function getErrorList()
80 => 1,
81 => 1,
82 => 1,
90 => 1,
];

}//end getErrorList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,8 @@ class AsymVisibility {
protected(set) public $asymPublicProtected = 'hello';
protected private(set) $asymProtectedPrivate = 'hello';
}

abstract class AbstractProperties {
abstract public ?MyType $spacing_correct {get;}
protected abstract $spacing_incorrect { set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,8 @@ class AsymVisibility {
protected(set) public $asymPublicProtected = 'hello';
protected private(set) $asymProtectedPrivate = 'hello';
}

abstract class AbstractProperties {
abstract public ?MyType $spacing_correct {get;}
protected abstract $spacing_incorrect { set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function getErrorList($testFile='')
197 => 1,
198 => 3,
199 => 2,
208 => 2,
];

case 'ScopeKeywordSpacingUnitTest.3.inc':
Expand Down
Loading