When run output: Access to an undefined property libXMLError::$message
See version 0.8.5 level 2 very simple example: https://phpstan.org/r/dce63cd81e516ef0949f49eee4b31e3a but it fails from first version 0.5 and master.
<?php declare(strict_types = 1);
function foo(\libXMLError $error): void
{
// http://php.net/manual/en/class.libxmlerror.php
echo $error->message;
}
The error goes away if previously check if the variable is set. The following example pass without error:
<?php declare(strict_types = 1);
function foo(\libXMLError $error): void
{
if (isset($error->message)) {
echo $error->message;
}
}
Note:
These properties are not properly declared and reflected: https://3v4l.org/aq3Nn
PHP adds them dynamically :https://github.com/php/php-src/blob/44e0b79ac64b344fc1335c126e548f00d8308602/ext/libxml/libxml.c#L1016
I suppose it won't be fixed, it is not a bug.
The only way I could think to improve and be according to PHP documentation is creating fake declaration files like NetBeans does...
anyhow is good to have this issue (closed) for the record.
PS: Thanks for phpstan! I just meet it and is awesome!
You can add it to PhpDefectClassReflectionExtension along with other
defects like this and send a PR 😊
On Fri, 29 Sep 2017 at 03:20, Carlos C Soto notifications@github.com
wrote:
I suppose it won't be fixed, it is not a bug.
The only way I could think to improve and be according to PHP
documentation is creating fake declaration files like NetBeans does...anyhow is good to have this issue (closed) for the record.
PS: Thanks for phpstan! I just meet it and is awesome!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/phpstan/phpstan/issues/526#issuecomment-333005563,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAGZuG9pGfHXWflpYYIoiFOxgf3nZ8pDks5snEX3gaJpZM4PoCZP
.>
Ondřej Mirtes