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

Narrow Closure::bind $newScope param #2817

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

mvorisek
Copy link
Contributor

@mvorisek mvorisek commented Dec 10, 2023

Same change as in JetBrains/phpstorm-stubs#1591.

Am I right the phpstorm-stubs are used for Pure metadata only?

The default type of newScope arg is 'static' which is not subtype of class-string, does phpstan imply that from the real reflection?

@phpstan-bot
Copy link
Collaborator

You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x.

@mvorisek mvorisek changed the base branch from 1.11.x to 1.10.x December 10, 2023 17:03
@mvorisek mvorisek marked this pull request as ready for review December 10, 2023 17:03
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@staabm
Copy link
Contributor

staabm commented Dec 10, 2023

The default type of newScope arg is 'static' which is not subtype of class-string, does phpstan imply that from the real reflection?

You could use NodeScopeResolverTest to check your assumptions

Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not rename parameter names

@mvorisek
Copy link
Contributor Author

The default type of newScope arg is 'static' which is not subtype of class-string, does phpstan imply that from the real reflection?

You could use NodeScopeResolverTest to check your assumptions

Did you mean tests/PHPStan/Analyser/NodeScopeResolverTest.php? How can I assert a phpstan error message there if some non-class-string is passed?

@staabm
Copy link
Contributor

staabm commented Dec 14, 2023

In these tests you can only assert types. If you need to assert error messages you have to go with a rule-test

@mvorisek
Copy link
Contributor Author

@ondrejmirtes I can added a test to tests\PHPStan\Rules\Functions\CallToFunctionParametersRuleTest.php, there is one simillar testBug4413 test. Please let me know how to name the testcase and if I should improve also other types like https://github.com/phpstan/phpstan-src/blob/1.10.57/resources/functionMap.php#L9929 which needs class-string too.

Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add whatever test you think is your best idea, I'll review if it's okay or not.

resources/functionMap.php Outdated Show resolved Hide resolved
@mvorisek mvorisek marked this pull request as draft April 22, 2024 09:41
@mvorisek mvorisek force-pushed the fix_function_maps branch 4 times, most recently from 8a4a3c6 to ff35e71 Compare April 22, 2024 10:34
@mvorisek mvorisek marked this pull request as ready for review April 22, 2024 10:40
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes ondrejmirtes merged commit 542cb0a into phpstan:1.10.x Apr 22, 2024
443 of 444 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@mvorisek mvorisek deleted the fix_function_maps branch April 22, 2024 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants