Skip to content

Commit 8d9f63c

Browse files
committed
PHP 8.5 | File::getMemberProperties(): add tests with asymmetric visibility for static properties
Looks to be handled correctly already. Just safeguarding this with some tests.
1 parent 8fd3d21 commit 8d9f63c

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

tests/Core/Files/File/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/Core/Files/File/GetMemberPropertiesTest.php

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,12 +1667,12 @@ public static function dataGetMemberProperties()
16671667
'nullable_type' => false,
16681668
],
16691669
],
1670-
'php8.4-illegal-asym-public-protected-set-static' => [
1671-
'identifier' => '/* testPHP84IllegalAsymPublicProtectedSetStaticProperty */',
1670+
'php8.5-asym-private-set-static' => [
1671+
'identifier' => '/* testPHP85AsymPrivateSetStaticProperty */',
16721672
'expected' => [
16731673
'scope' => 'public',
1674-
'scope_specified' => true,
1675-
'set_scope' => 'protected',
1674+
'scope_specified' => false,
1675+
'set_scope' => 'private',
16761676
'is_static' => true,
16771677
'is_readonly' => false,
16781678
'is_final' => false,
@@ -1683,6 +1683,39 @@ public static function dataGetMemberProperties()
16831683
'nullable_type' => false,
16841684
],
16851685
],
1686+
'php8.5-asym-final-public-protected-set-static' => [
1687+
'identifier' => '/* testPHP85AsymFinalPublicProtectedSetStaticProperty */',
1688+
'expected' => [
1689+
'scope' => 'public',
1690+
'scope_specified' => true,
1691+
'set_scope' => 'protected',
1692+
'is_static' => true,
1693+
'is_readonly' => false,
1694+
'is_final' => true,
1695+
'is_abstract' => false,
1696+
'type' => 'Union|Type',
1697+
'type_token' => -4,
1698+
'type_end_token' => -2,
1699+
'nullable_type' => false,
1700+
],
1701+
],
1702+
'php8.5-asym-static-public-set' => [
1703+
'identifier' => '/* testPHP85AsymPublicSetStaticProperty */',
1704+
'expected' => [
1705+
'scope' => 'public',
1706+
'scope_specified' => false,
1707+
'set_scope' => 'public',
1708+
'is_static' => true,
1709+
'is_readonly' => false,
1710+
'is_final' => false,
1711+
'is_abstract' => false,
1712+
'type' => '?array',
1713+
'type_token' => -2,
1714+
'type_end_token' => -2,
1715+
'nullable_type' => true,
1716+
],
1717+
],
1718+
16861719
'php8.4-abstract-public-property' => [
16871720
'identifier' => '/* testPHP84AbstractPublicTypedProp */',
16881721
'expected' => [

0 commit comments

Comments
 (0)