Skip to content

Commit 5bc329e

Browse files
authored
Merge pull request #724 from PHPCSStandards/php-8.5/bcfile-variable-getmemberproperties-add-tests-static-aviz-props
PHP 8.5 | BCFile/Variables::getMemberProperties(): add tests with asymmetric visibility for static properties
2 parents 560cc27 + 2656ed7 commit 5bc329e

File tree

2 files changed

+42
-6
lines changed

2 files changed

+42
-6
lines changed

Tests/BackCompat/BCFile/GetMemberPropertiesTest.inc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,12 @@ class AsymVisibility {
398398
/* testPHP84AsymPrivateSetPublicProperty */
399399
private(set) public mixed $prop9;
400400

401-
/* testPHP84IllegalAsymPublicProtectedSetStaticProperty */
402-
public protected(set) static mixed $prop10;
401+
/* testPHP85AsymPrivateSetStaticProperty */
402+
private(set) static mixed $prop10;
403+
/* testPHP85AsymFinalPublicProtectedSetStaticProperty */
404+
final public protected(set) static Union|Type $prop11;
405+
/* testPHP85AsymPublicSetStaticProperty */
406+
static public(set) ?array $prop12;
403407
}
404408

405409
abstract class WithAbstractProperties {

Tests/BackCompat/BCFile/GetMemberPropertiesTest.php

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,12 +1694,12 @@ public static function dataGetMemberProperties()
16941694
'nullable_type' => false,
16951695
],
16961696
],
1697-
'php8.4-illegal-asym-public-protected-set-static' => [
1698-
'identifier' => '/* testPHP84IllegalAsymPublicProtectedSetStaticProperty */',
1697+
'php8.5-asym-private-set-static' => [
1698+
'identifier' => '/* testPHP85AsymPrivateSetStaticProperty */',
16991699
'expected' => [
17001700
'scope' => 'public',
1701-
'scope_specified' => true,
1702-
'set_scope' => 'protected',
1701+
'scope_specified' => false,
1702+
'set_scope' => 'private',
17031703
'is_static' => true,
17041704
'is_readonly' => false,
17051705
'is_final' => false,
@@ -1710,6 +1710,38 @@ public static function dataGetMemberProperties()
17101710
'nullable_type' => false,
17111711
],
17121712
],
1713+
'php8.5-asym-final-public-protected-set-static' => [
1714+
'identifier' => '/* testPHP85AsymFinalPublicProtectedSetStaticProperty */',
1715+
'expected' => [
1716+
'scope' => 'public',
1717+
'scope_specified' => true,
1718+
'set_scope' => 'protected',
1719+
'is_static' => true,
1720+
'is_readonly' => false,
1721+
'is_final' => true,
1722+
'is_abstract' => false,
1723+
'type' => 'Union|Type',
1724+
'type_token' => -4,
1725+
'type_end_token' => -2,
1726+
'nullable_type' => false,
1727+
],
1728+
],
1729+
'php8.5-asym-static-public-set' => [
1730+
'identifier' => '/* testPHP85AsymPublicSetStaticProperty */',
1731+
'expected' => [
1732+
'scope' => 'public',
1733+
'scope_specified' => false,
1734+
'set_scope' => 'public',
1735+
'is_static' => true,
1736+
'is_readonly' => false,
1737+
'is_final' => false,
1738+
'is_abstract' => false,
1739+
'type' => '?array',
1740+
'type_token' => -2,
1741+
'type_end_token' => -2,
1742+
'nullable_type' => true,
1743+
],
1744+
],
17131745
'php8.4-abstract-public-property' => [
17141746
'identifier' => '/* testPHP84AbstractPublicTypedProp */',
17151747
'expected' => [

0 commit comments

Comments
 (0)