Skip to content

Commit 365526c

Browse files
committed
Fix PHP 8.4
1 parent 944f94a commit 365526c

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

src/main/php/lang/meta/MetaInformation.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function propertyComment($reflect) {
193193
}
194194

195195
/**
196-
* Returns (non-literal) modifiers for a given property
196+
* Returns modifiers for a given property, including non-declared
197197
*
198198
* @param \ReflectionProperty $reflect
199199
* @return int
@@ -202,10 +202,10 @@ public function propertyModifiers($reflect) {
202202
$name= $reflect->getDeclaringClass()->name;
203203
$c= \xp::$cn[$name] ?? strtr($name, '\\', '.');
204204
if ($meta= \xp::$meta[$c][0][$reflect->getName()][DETAIL_ARGUMENTS] ?? null) {
205-
return (int)$meta[0];
205+
return $reflect->getModifiers() | (int)$meta[0];
206206
} else {
207207
$tags= $this->tags($reflect);
208-
return isset($tags['final']) ? MODIFIER_FINAL : 0;
208+
return $reflect->getModifiers() | isset($tags['final']) ? MODIFIER_FINAL : 0;
209209
}
210210
}
211211

src/main/php/lang/reflection/Property.class.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,9 @@ public function modifiers($hook= null) {
5353
];
5454

5555
// Readonly implies protected(set)
56-
$bits= $this->reflect->getModifiers();
56+
$bits= Reflection::meta()->propertyModifiers($this->reflect);
5757
$bits & Modifiers::IS_READONLY && $bits|= Modifiers::IS_PROTECTED_SET;
5858

59-
// Final properties cannot be declared in PHP < 8.4, fetch from meta information
60-
if (PHP_VERSION_ID <= 80400) {
61-
$bits|= Reflection::meta()->propertyModifiers($this->reflect);
62-
}
63-
6459
switch ($hook) {
6560
case null: return new Modifiers($bits);
6661
case 'get': return new Modifiers(($bits & ~Modifiers::SET_MASK) & Modifiers::GET_MASK);

0 commit comments

Comments
 (0)