Skip to content

Commit 9d4c6d1

Browse files
committed
File::getMemberProperties(): minor tweaks after readonly merge
Follow up on 3480 I realized after the merge that I had not published a few follow up comments. Addressing those here. * The new `is_readonly` key still needed to be added to the documentation for the `File::getMemberProperties()` method. * For consistency in how the method is tested, adding the `is_readonly` property to all other test expectations, which makes the `testPHP81NotReadonly` test case redundant. * Adding two additional test cases. In particular I wanted to verify (and safeguard) that the retokenization of the `?` to `T_NULLABLE` after a `readonly` keyword would not be broken (which it partially was, but that has now been fixed in 3513).
1 parent b314140 commit 9d4c6d1

File tree

3 files changed

+83
-8
lines changed

3 files changed

+83
-8
lines changed

src/Files/File.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,6 +1759,7 @@ public function getMethodProperties($stackPtr)
17591759
* 'scope' => string, // Public, private, or protected.
17601760
* 'scope_specified' => boolean, // TRUE if the scope was explicitly specified.
17611761
* 'is_static' => boolean, // TRUE if the static keyword was found.
1762+
* 'is_readonly' => boolean, // TRUE if the readonly keyword was found.
17621763
* 'type' => string, // The type of the var (empty if no type specified).
17631764
* 'type_token' => integer, // The stack pointer to the start of the type
17641765
* // or FALSE if there is no type.

tests/Core/File/GetMemberPropertiesTest.inc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,14 @@ $anon = class() {
240240
// Intentional fatal error - duplicate types are not allowed in union types, but that's not the concern of the method.
241241
public int |string| /*comment*/ INT $duplicateTypeInUnion;
242242

243-
/* testPHP81NotReadonly */
244-
private string $notReadonly;
245243
/* testPHP81Readonly */
246244
public readonly int $readonly;
245+
246+
/* testPHP81ReadonlyWithNullableType */
247+
public readonly ?array $array;
248+
249+
/* testPHP81ReadonlyWithUnionType */
250+
protected ReadOnly string|null $array;
247251
};
248252

249253
$anon = class {

0 commit comments

Comments
 (0)