Skip to content

Conversation

@ondrejmirtes
Copy link
Member

No description provided.

@ondrejmirtes
Copy link
Member Author

 Would it help if this is only done for BooleanType? That's what I had in mind

I don't think it's necessary.

@ondrejmirtes
Copy link
Member Author

I think we're really close here. Would you mind if I merge this into your PR so we can continue? And could you please look into these failures?

1) PHPStan\Rules\Comparison\ImpossibleCheckTypeMethodCallRuleEqualsTest::testRule
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
 81: Call to method ImpossibleMethodCall\Foo::isNotSame() with stdClass and stdClass will always evaluate to false.
 101: Call to method ImpossibleMethodCall\Foo::isSame() with 'foo' and 'foo' will always evaluate to true.
 104: Call to method ImpossibleMethodCall\Foo::isNotSame() with 'foo' and 'foo' will always evaluate to false.
-113: Call to method ImpossibleMethodCall\Foo::isSame() with array{} and array{} will always evaluate to true.
-116: Call to method ImpossibleMethodCall\Foo::isNotSame() with array{} and array{} will always evaluate to false.
 174: Call to method ImpossibleMethodCall\Foo::isSame() with '' and '' will always evaluate to true.
 175: Call to method ImpossibleMethodCall\Foo::isNotSame() with '' and '' will always evaluate to false.
 191: Call to method ImpossibleMethodCall\Foo::isSame() with 1 and 1 will always evaluate to true.
 194: Call to method ImpossibleMethodCall\Foo::isNotSame() with 2 and 2 will always evaluate to false.
 '

/Users/ondrej/Development/phpstan/src/Testing/RuleTestCase.php:131
/Users/ondrej/Development/phpstan/tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeMethodCallRuleEqualsTest.php:32

2) PHPStan\Rules\Comparison\ImpossibleCheckTypeMethodCallRuleTest::testRule
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
 81: Call to method ImpossibleMethodCall\Foo::isNotSame() with stdClass and stdClass will always evaluate to false.
 101: Call to method ImpossibleMethodCall\Foo::isSame() with 'foo' and 'foo' will always evaluate to true.
 104: Call to method ImpossibleMethodCall\Foo::isNotSame() with 'foo' and 'foo' will always evaluate to false.
-113: Call to method ImpossibleMethodCall\Foo::isSame() with array{} and array{} will always evaluate to true.
-116: Call to method ImpossibleMethodCall\Foo::isNotSame() with array{} and array{} will always evaluate to false.
-119: Call to method ImpossibleMethodCall\Foo::isSame() with array{1, 3} and array{1, 3} will always evaluate to true.
-122: Call to method ImpossibleMethodCall\Foo::isNotSame() with array{1, 3} and array{1, 3} will always evaluate to false.
 126: Call to method ImpossibleMethodCall\Foo::isSame() with 1 and stdClass will always evaluate to false.
 130: Call to method ImpossibleMethodCall\Foo::isNotSame() with 1 and stdClass will always evaluate to true.
 133: Call to method ImpossibleMethodCall\Foo::isSame() with '1' and stdClass will always evaluate to false.

@ondrejmirtes
Copy link
Member Author

The one Composer failure is expected (the method has typehint @return false), and all the extension failures I think are connected with the one above in the comment.

@ondrejmirtes
Copy link
Member Author

Oh I know what's causing them - we need to implement Identical and NotIdentical in MutatingScope::resolveType() for ConstantArrayType!

@herndlm
Copy link
Contributor

herndlm commented Apr 27, 2022

Oh nice, sure go ahead and merge it. I'll try to finish it. If you're not already doing that xD

@herndlm
Copy link
Contributor

herndlm commented Apr 27, 2022

I picked your commits to my branch, thx! I'll take a quick look, but might not have time to finish it today, will continue tomorrow then

@herndlm
Copy link
Contributor

herndlm commented Apr 27, 2022

shall I close my original PR? might speed up things if you're going to merge this one afterwards

@ondrejmirtes
Copy link
Member Author

I'm gonna merge yours so that you get the credit :)

@ondrejmirtes
Copy link
Member Author

I'm looking forward to the issue bot :) My bet is between 10-20 solved issues, we'll see :)

@herndlm
Copy link
Contributor

herndlm commented Apr 27, 2022

ok, now while writing that it started to speed up..
sorry, I was getting excited about all the cleanups you did. I'm more than happy about removing some of those type specifier blocks

@ondrejmirtes ondrejmirtes deleted the pr1254-ideas branch April 27, 2022 20:37
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