- Implement final promoted property parsing with explicit visibility requirement - Add support for exit(message: $value) named argument syntax - Reject unknown named arguments in exit/die function calls - Enforce explicit visibility declaration for final promoted properties - Add test coverage for final promoted property inheritance errors - Update documentation for supported PHP 8.4+ features and limitations - Generate proper reflection metadata for final promoted properties - Support native class final promoted property compilationmaster
parent
9f1cf07511
commit
44095252d2
11 changed files with 147 additions and 0 deletions
@ -0,0 +1,6 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
function main(): void |
||||||
|
{ |
||||||
|
exit(text: 'unsupported'); |
||||||
|
} |
||||||
@ -0,0 +1,9 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
class FinalPromotedPropertyWithoutVisibility |
||||||
|
{ |
||||||
|
public function __construct( |
||||||
|
final int $value, |
||||||
|
) { |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
class FinalPromotedPropertyParent |
||||||
|
{ |
||||||
|
public function __construct( |
||||||
|
public final string $value, |
||||||
|
) { |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
class FinalPromotedPropertyChild extends FinalPromotedPropertyParent |
||||||
|
{ |
||||||
|
public string $value = 'child'; |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
--TEST-- |
||||||
|
exit() accepts the TypePHP message named argument |
||||||
|
--ENV-- |
||||||
|
USE_ZEND_ALLOC=0 |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
|
||||||
|
function main(): void |
||||||
|
{ |
||||||
|
exit(message: "named exit\n"); |
||||||
|
echo "unreachable\n"; |
||||||
|
} |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
named exit |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
--TEST-- |
||||||
|
TypePHP supports explicit-visibility final promoted properties with PHP 8.4 libphp |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
|
||||||
|
class FinalPromotedProperty |
||||||
|
{ |
||||||
|
public function __construct( |
||||||
|
public final string $value, |
||||||
|
) { |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#[Native] |
||||||
|
class NativeFinalPromotedProperty |
||||||
|
{ |
||||||
|
public function __construct( |
||||||
|
public final int $value, |
||||||
|
) { |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function main(): void |
||||||
|
{ |
||||||
|
$object = new FinalPromotedProperty('promoted'); |
||||||
|
var_dump($object->value); |
||||||
|
|
||||||
|
$property = new ReflectionProperty(FinalPromotedProperty::class, 'value'); |
||||||
|
var_dump( |
||||||
|
$property->isPublic(), |
||||||
|
$property->isPromoted(), |
||||||
|
$property->isFinal(), |
||||||
|
); |
||||||
|
|
||||||
|
$native = new NativeFinalPromotedProperty(42); |
||||||
|
var_dump($native->value); |
||||||
|
} |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
string(8) "promoted" |
||||||
|
bool(true) |
||||||
|
bool(true) |
||||||
|
bool(true) |
||||||
|
int(42) |
||||||
Loading…
Reference in new issue