Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -1845,6 +1845,7 @@ public function getMethodProperties($stackPtr)
* 'scope_specified' => boolean, // TRUE if the scope was explicitly specified.
* 'is_static' => boolean, // TRUE if the static keyword was found.
* 'is_readonly' => boolean, // TRUE if the readonly keyword was found.
* 'is_final' => boolean, // TRUE if the final keyword was found.
* 'type' => string, // The type of the var (empty if no type specified).
* 'type_token' => integer|false, // The stack pointer to the start of the type
* // or FALSE if there is no type.
Expand Down Expand Up @@ -1917,6 +1918,7 @@ public function getMemberProperties($stackPtr)
T_STATIC => T_STATIC,
T_VAR => T_VAR,
T_READONLY => T_READONLY,
T_FINAL => T_FINAL,
];

$valid += Tokens::$emptyTokens;
Expand All @@ -1925,6 +1927,7 @@ public function getMemberProperties($stackPtr)
$scopeSpecified = false;
$isStatic = false;
$isReadonly = false;
$isFinal = false;

$startOfStatement = $this->findPrevious(
[
Expand Down Expand Up @@ -1960,7 +1963,10 @@ public function getMemberProperties($stackPtr)
case T_READONLY:
$isReadonly = true;
break;
}
case T_FINAL:
$isFinal = true;
break;
}//end switch
}//end for

$type = '';
Expand Down Expand Up @@ -2016,6 +2022,7 @@ public function getMemberProperties($stackPtr)
'scope_specified' => $scopeSpecified,
'is_static' => $isStatic,
'is_readonly' => $isReadonly,
'is_final' => $isFinal,
'type' => $type,
'type_token' => $typeToken,
'type_end_token' => $typeEndToken,
Expand Down
21 changes: 21 additions & 0 deletions tests/Core/File/GetMemberPropertiesTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -354,3 +354,24 @@ trait DNFTypes {
// Intentional fatal error - nullable operator cannot be combined with DNF.
var ?(A&\Pck\B)|bool $propD;
}

class WithFinalProperties {
/* testPHP84FinalPublicTypedProp */
final public string $val1;
/* testPHP84FinalProtectedTypedProp */
final protected string $val2;
/* testPHP84FinalMiddleTypedProp */
public final string $val3;
/* testPHP84FinalMiddleStaticTypedProp */
public final static string $val4;
/* testPHP84FinalLastTypedProp */
public readonly final string $val5;
/* testPHP84FinalImplicitVisibilityTypedProp */
final string $val6;
/* testPHP84FinalImplicitVisibilityProp */
final $val7;
/* testPHP84FinalNullableTypedProp */
final public ?string $val8;
/* testPHP84FinalComplexTypedProp */
final public (Foo&\Bar)|bool $val9;
}
Loading