psalm
psalm copied to clipboard
False positive UnusedMethodCall for ReflectionProperty::setAccessible
https://psalm.dev/r/14e6e58931
I found these snippets:
https://psalm.dev/r/14e6e58931
<?php
$conn = new \stdClass();
$connReflection = new ReflectionClass($conn);
$ioProperty = $connReflection->getProperty('foo');
$ioProperty->setAccessible(true);
Psalm output (using commit 16b24bd):
ERROR: UnusedMethodCall - 7:14 - The call to ReflectionProperty::setAccessible is not used
Maybe it is because it is no longer necessary to call setAccessible.
Note: As of PHP 8.1.0, calling this method has no effect; all properties are accessible by default.
https://www.php.net/manual/en/reflectionproperty.setaccessible.php
@M393 oh wow, didn't know that. In that case it possibly would be a room to improve the error message?