mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
c5401854fc
This should fix most of the remaining issues with tabs and spaces being mixed in tests.
33 lines
592 B
PHP
33 lines
592 B
PHP
--TEST--
|
|
Bug #80037: Typed property must not be accessed before initialization when __get() declared
|
|
--FILE--
|
|
<?php
|
|
|
|
final class A
|
|
{
|
|
public string $a;
|
|
|
|
public static function fromArray(array $props): self
|
|
{
|
|
$me = new static;
|
|
foreach ($props as $k => &$v) {
|
|
$me->{$k} = &$v; # try to remove &
|
|
}
|
|
return $me;
|
|
}
|
|
|
|
public function __get($name)
|
|
{
|
|
throw new \LogicException("Property '$name' is not defined.");
|
|
}
|
|
}
|
|
|
|
var_dump(A::fromArray(['a' => 'foo']));
|
|
|
|
?>
|
|
--EXPECT--
|
|
object(A)#1 (1) {
|
|
["a"]=>
|
|
string(3) "foo"
|
|
}
|