-
-
Notifications
You must be signed in to change notification settings - Fork 882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assign to property by reference ignores functionMap.php #11777
Comments
This one is tricky. Basically my fear is that for by-ref parameters, those types in functionMap don't mean anything. I don't want to research that now, but the problem is that for some functions, these types do not enforce the incoming type, and for some functions, these types are different from those assigned by-ref when the function call ends. That's why "isBuiltin" is mentioned in these places:
My bet is that if you remove those conditions, some tests will fail, and you'll see why. The path forward for this issue and #11791 is definitely a stub with |
I tied this param-out stub and it did not work but maybe I dont get how to work with it. I tried here https://phpstan.org/r/df08d92f-b46e-45c5-88fe-4235a42a0bf6 this <?php declare(strict_types = 1);
$openSslSignature = '';
/**
* @param-out string &$openSslSignature
*/
openssl_sign(
'data',
$openSslSignature,
'key contents',
'SHA256',
);
PHPStan\dumpType($openSslSignature); with and without |
Register the signature as a stub file and send a PR to phpstan-src: https://phpstan.org/user-guide/stub-files |
@ondrejmirtes Done here phpstan/phpstan-src#3532 |
Bug report
When a class property is assigned via a function that takes a reference, the type specified in
functionMap.php
seems to not be taken into account. Or at least it's the case withproc_open()
. Although I'm not sure if the types given infunctionMap.php
are understood to be equivalent to@param-out
.functionMap.php
:Code snippet that reproduces the problem
https://phpstan.org/r/a76b47ab-8e57-40da-b76e-60fd02c2470e
Expected output
No error.
Did PHPStan help you today? Did it make you happy in any way?
No response
The text was updated successfully, but these errors were encountered: