Skip to content
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

Parameter $line does not exist on function ErrorException::__construct #7658

Closed
zopsicle opened this issue Feb 12, 2022 · 4 comments · Fixed by #7659
Closed

Parameter $line does not exist on function ErrorException::__construct #7658

zopsicle opened this issue Feb 12, 2022 · 4 comments · Fixed by #7659

Comments

@zopsicle
Copy link

zopsicle commented Feb 12, 2022

The ErrorException constructor takes a parameter called line, but Psalm disagrees.

Source code: https://github.com/php/php-src/blob/0b524a56f5ed1fa878a7f1f402643eb0aa52b09b/Zend/zend_exceptions_arginfo.h#L51-L58
3v4l example (runs fine): https://3v4l.org/E6A1i
Psalm example (fails type checking): https://psalm.dev/r/acebce1efa

<?php

new ErrorException(line: 1);

The other parameters (message, severity, filename) are all known to Psalm; only line appears to be problematic.

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/acebce1efa
<?php

new ErrorException(line: 1);
Psalm output (using commit f7779f8):

ERROR: InvalidNamedArgument - 3:20 - Parameter $line does not exist on function ErrorException::__construct

@weirdan
Copy link
Collaborator

weirdan commented Feb 13, 2022

If you're up for a PR you can find a guide on callmap editing here: https://psalm.dev/docs/contributing/editing_callmaps/

@zopsicle
Copy link
Author

Seems like the parameter was renamed in this commit: php/php-src@4c821cf

I’ll add it to the relevant callmap delta and make a PR.

@weirdan
Copy link
Collaborator

weirdan commented Feb 13, 2022

You can omit delta in this case. The rename happened prior to 8.0 stable, and before 8.0 parameter names were ignored anyway. So it's safe to update Callmap_historical instead of putting this into a delta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants