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

Fix native type on unset #2107

Merged
merged 3 commits into from Dec 14, 2022
Merged

Fix native type on unset #2107

merged 3 commits into from Dec 14, 2022

Conversation

rajyan
Copy link
Contributor

@rajyan rajyan commented Dec 13, 2022

Two fixes

  1. Previously added native type test forgot to use assertNativeType and wasn't working correctly
  2. getType was used for native type as mentioned in Remove redundant getType() calls in MutatingScope #2102

I'm sorry that I didn't add enough tests when adding these native type changes...

proof of wrong native type on unset
https://phpstan.org/r/85d3f157-6989-4e60-90f3-9aa7a90546ee

@rajyan rajyan marked this pull request as ready for review December 13, 2022 22:59
@rajyan rajyan changed the title Fix pr 2102 Fix native type on unset Dec 13, 2022
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes ondrejmirtes merged commit 21703b3 into phpstan:1.9.x Dec 14, 2022
@ondrejmirtes
Copy link
Member

Thank you, don't worry about it 😊

@ondrejmirtes
Copy link
Member

Regression test please 😊 phpstan/phpstan#7805 (comment)

Comment on lines 5 to +6
use function PHPStan\Testing\assertType;
use function PHPStan\Testing\assertNativeType;
Copy link
Contributor

Choose a reason for hiding this comment

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

@ondrejmirtes wdyt about adding a rule/check which verifies that tests included by TypeInferenceTestCase contain proper full-qualified method calls or imports when assertType or assertNativeType is contained?

Copy link
Member

Choose a reason for hiding this comment

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

@staabm We can make TypeInferenceTestCase crash on the supported functions with correct names but without (or with a wrong) namespace :)

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