Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use TypeSystem in AssertSameBooleanExpectedRule #254

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
ondrejmirtes merged 5 commits into phpstan:2.0.x from staabm:clean
Nov 4, 2025

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Nov 2, 2025
edited
Loading

I think it makes sense that we get the same error when working with constants and known value.

public function testConstants(): void
{
\PHPUnit\Framework\Assert::assertSame(PHPSTAN_PHPUNIT_TRUE, 'foo');
\PHPUnit\Framework\Assert::assertSame(PHPSTAN_PHPUNIT_FALSE, 'foo');
}

@staabm staabm marked this pull request as ready for review November 2, 2025 07:36
Copy link
Contributor Author

staabm commented Nov 2, 2025

another case in which infection made me add new tests:

grafik

Copy link
Member

I disagree with this. I feel like that when someones does:

$this->assertSame(Foo::BAR, $expected);

It's there on purpose and it means "expected should be the same as Foo::BAR". The value of Foo::BAR might be true right now but it's there so that the value can change.

Changing the code to:

$this->assertTrue($expected);

would lose information.

Copy link
Contributor Author

staabm commented Nov 2, 2025

ok. reduced it to the new tests

Copy link
Contributor Author

staabm commented Nov 3, 2025

remaining tests are here to kill mutants

@ondrejmirtes ondrejmirtes merged commit a4abfc1 into phpstan:2.0.x Nov 4, 2025
70 checks passed
Copy link
Member

Thank you!

@staabm staabm deleted the clean branch November 4, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /