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

Set::map() unknown even though it's in the stub #6373

Closed
simPod opened this issue Jan 15, 2022 · 7 comments
Closed

Set::map() unknown even though it's in the stub #6373

simPod opened this issue Jan 15, 2022 · 7 comments
Labels

Comments

@simPod
Copy link
Contributor

simPod commented Jan 15, 2022

Bug report

PHPStan says the \Ds\Set::map() does not exists

I see the method is there https://github.com/phpstan/phpstan-src/blob/e40eff0a8e34ceae776e38d48a31efbe67ea399a/stubs/ext-ds.stub#L686-L692 added in phpstan/phpstan-src#855

Code snippet that reproduces the problem

https://phpstan.org/r/9b25b205-df92-41a2-8acb-5b28419faf6e

Expected output

No errors

@ondrejmirtes
Copy link
Member

PHPStan stub files are only for overriding PHPDocs. They're not for creating new methods.

The method is either missing in https://github.com/phpstan/phpstan-src/blob/master/resources/functionMap.php or https://github.com/JetBrains/phpstorm-stubs/blob/master/ds/ds.php or both.

@simPod
Copy link
Contributor Author

simPod commented Jan 15, 2022 via email

@ondrejmirtes
Copy link
Member

Didn't help, needs to be in phpstorm-stubs too.

@simPod
Copy link
Contributor Author

simPod commented Jan 15, 2022 via email

@simPod
Copy link
Contributor Author

simPod commented Jan 15, 2022

@phpstan-bot
Copy link
Contributor

@simPod After the latest commit in dev-master, PHPStan now reports different result with your code snippet:

@@ @@
-PHP 8.0 – 8.1 (1 error)
+PHP 8.0 – 8.1
 ==========
 
-11: Call to an undefined method Ds\Set<Stringable>::map().
+No errors
 
-PHP 7.1 – 7.4 (2 errors)
+PHP 7.1 – 7.4 (1 error)
 ==========
 
- 9: Parameter $ids of method A::x() has invalid type Stringable.
-11: Call to an undefined method Ds\Set<Stringable>::map().
+ 9: Parameter $ids of method A::x() has invalid type Stringable.
Full report

PHP 8.0 – 8.1

No errors

PHP 7.1 – 7.4 (1 error)

Line Error
9 Parameter $ids of method A::x() has invalid type Stringable.

@simPod simPod closed this as completed Jan 25, 2022
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants