Bug report
phpstan 0.12.33, bleeding edge
Phpstan shows Property HelloWorld::$foo is never read, only written. error despite the fact that props are indirectly read by get_object_vars
Code snippet that reproduces the problem
https://phpstan.org/r/1d118150-3781-41f7-9924-2e0a03721a00
<?php declare(strict_types = 1);
class HelloWorld implements JsonSerializable
{
private string $foo;
public function __construct(string $foo) {
$this->foo = $foo;
}
public function jsonSerialize() {
return get_object_vars($this);
}
}
// Usage
$foo = new HelloWorld('fizzbuzz');
echo json_encode($foo); // prints '{"foo":"fizzbuzz"}'
Expected output
No error
Not sure if it's a bug report or rather feature request ¯\_(ツ)_/¯
Bug report
phpstan 0.12.33, bleeding edge
Phpstan shows
Property HelloWorld::$foo is never read, only written.error despite the fact that props are indirectly read byget_object_varsCode snippet that reproduces the problem
https://phpstan.org/r/1d118150-3781-41f7-9924-2e0a03721a00
Expected output
No error
Not sure if it's a bug report or rather feature request ¯\_(ツ)_/¯