Skip to content

Add regression test for anonymous class in trait #949

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

Merged
merged 2 commits into from
Jan 28, 2022
Merged

Add regression test for anonymous class in trait #949

merged 2 commits into from
Jan 28, 2022

Conversation

herndlm
Copy link
Contributor

@herndlm herndlm commented Jan 27, 2022

Regression test for phpstan/phpstan#6472 which was also fixed by #946.

Feel free to just close this if not needed.

@ondrejmirtes
Copy link
Member

What’s the error if you revert the fix please?

@herndlm
Copy link
Contributor Author

herndlm commented Jan 27, 2022

1) PHPStan\Analyser\AnalyserIntegrationTest::testBug6472
Failed asserting that actual size 1 matches expected size 0.

Emitted errors:
- Method Bug6472\B::b() has parameter $array with no value type specified in iterable type array
  in <....>/phpstan-src/tests/PHPStan/Analyser/data/bug-6472.php (in context of class Bug6472\B) on line 20

@ondrejmirtes
Copy link
Member

Please move the test to the rule that reports this error.

Usually regresion tests belong either to NodeScopeResolverTest, or to a unit test of a specific rule.

AnalyserIntegrationTest should be reserved only for bugs that crash PHPStan/infinite recursion etc.

@herndlm herndlm marked this pull request as draft January 27, 2022 20:37
@herndlm
Copy link
Contributor Author

herndlm commented Jan 28, 2022

Moved. If the fix is reverted I now get

1) PHPStan\Rules\Methods\MissingMethodParameterTypehintRuleTest::testBug6472
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'
+'20: Method Bug6472\B::b() has parameter $array with no value type specified in iterable type array.
+    💡 See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type
 '

@herndlm herndlm marked this pull request as ready for review January 28, 2022 19:32
@ondrejmirtes ondrejmirtes merged commit 138c4a4 into phpstan:master Jan 28, 2022
@ondrejmirtes
Copy link
Member

Perfect, thank you.

@herndlm herndlm deleted the add-regression-test-for-anon-class-in-trait branch January 28, 2022 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants