-
Notifications
You must be signed in to change notification settings - Fork 50
Add AssertSameDifferentTypesRuleTest #3
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks! I found a few minor issues 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should also be a few examples of positive cases - comparing int/int and probably also comparing some unions against simple type and unions against unions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added bellow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put declare on the same line as <?php :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a different namespace, something like namespace ExampleTestCase is fine 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention was to make it consistent with https://github.com/phpstan/phpstan-strict-rules/blob/master/tests/Rules/StrictCalls/data/strict-calls.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but PHPUnit is a well known and used namespace :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ondrejmirtes this line breaks PHPStan
PHPStan\ShouldNotHappenException : Internal error.
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Type\TypeCombinator.php:23
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Type\ArrayType.php:28
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Analyser\Scope.php:575
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Analyser\Scope.php:323
C:\devweb\htdocs\phpstan-phpunit\src\Rules\PHPUnit\AssertSameDifferentTypesRule.php:62
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Analyser\Analyser.php:162
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Analyser\NodeScopeResolver.php:316
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Analyser\NodeScopeResolver.php:176
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Analyser\NodeScopeResolver.php:686
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Analyser\NodeScopeResolver.php:176
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Analyser\NodeScopeResolver.php:686
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Analyser\NodeScopeResolver.php:176
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Analyser\NodeScopeResolver.php:686
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Analyser\NodeScopeResolver.php:176
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Analyser\Analyser.php:166
C:\devweb\htdocs\phpstan-phpunit\vendor\phpstan\phpstan\src\Testing\RuleTestCase.php:64
C:\devweb\htdocs\phpstan-phpunit\tests\Rules\PHPUnit\AssertSameDifferentTypesRuleTest.php:19
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed by enabling union types in tests bootstrap
1c68990 to
5ee4083
Compare
76741b1 to
e192e57
Compare
R4R @ondrejmirtes
Awesome! :)
I wanted to have a look on how to write PHPStan rules tests and I found none in this repository. So I created one.