Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Nov 2, 2025

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
@staabm
Copy link
Contributor Author

staabm commented Nov 2, 2025

another case in which infection made me add new tests:

grafik

@ondrejmirtes
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.

@staabm
Copy link
Contributor Author

staabm commented Nov 2, 2025

ok. reduced it to the new tests

@staabm
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
@ondrejmirtes
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants