Skip to content

Commit 6fd4ba6

Browse files
Copilotlisachenko
andcommitted
Fix getModifiers() to not add IS_PRIVATE_SET for readonly properties and prioritize PHP 8.4 in CI
Co-authored-by: lisachenko <[email protected]>
1 parent 2491bc8 commit 6fd4ba6

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

.github/workflows/phpunit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
- "lowest"
1717
- "highest"
1818
php-version:
19-
- "8.2"
20-
- "8.3"
2119
- "8.4"
20+
- "8.3"
21+
- "8.2"
2222
operating-system:
2323
- "ubuntu-latest"
2424

src/ReflectionProperty.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,9 @@ public function getModifiers(): int
201201
}
202202

203203
// Handle PHP 8.4+ asymmetric visibility modifiers
204-
// In PHP 8.4, readonly properties automatically get IS_PRIVATE_SET flag
205-
// because readonly properties can't be set after initialization
206-
if ($this->isReadOnly() && PHP_VERSION_ID >= 80400) {
207-
// PHP 8.4 introduced IS_PRIVATE_SET = 2048 for asymmetric visibility
208-
$modifiers += 2048; // ReflectionProperty::IS_PRIVATE_SET
209-
}
204+
// Note: IS_PRIVATE_SET and IS_PROTECTED_SET are only added for properties with explicit
205+
// asymmetric visibility syntax like "public private(set) $prop", not for regular readonly properties
206+
// TODO: Implement when nikic/php-parser supports asymmetric visibility syntax
210207

211208
return $modifiers;
212209
}

0 commit comments

Comments
 (0)