1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/property_hooks/cpp.phpt
2024-07-14 11:55:03 +02:00

35 lines
530 B
PHP

--TEST--
Constructor property promotion
--FILE--
<?php
class Test {
public function __construct(
public $prop = 42 {
get => print("Getting\n");
set { print("Setting\n"); }
}
) {
echo "Constructor\n";
}
}
echo "Pre-test\n";
$test = new Test;
$test->prop;
$test->prop = 42;
$r = (new ReflectionProperty(Test::class, 'prop'));
var_dump($r->hasDefaultValue());
var_dump($r->getDefaultValue());
?>
--EXPECT--
Pre-test
Setting
Constructor
Getting
Setting
bool(false)
NULL