Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions tests/Unit/PhpStan/IgnoreBooleanAlwaysImpossibleAssertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use PHPStan\Analyser\IgnoreErrorExtension;
use PHPStan\Rules\Comparison\ImpossibleCheckTypeFunctionCallRule;
use PHPStan\Rules\Rule;
use PHPUnit\Framework\Error\Deprecated;

/**
* This covers `function.alreadyNarrowedType` error handling in the `IgnoreBooleanAlways` PHPStan extension class.
Expand Down Expand Up @@ -39,15 +40,22 @@ public function warningIsRetainedForPointlessAssert(): void
self::markTestSkipped('This is testing the testers, and only needs to run whenever possible.');
}

// Second argument is array of expected warnings.
$this->analyse(
[self::FIXTURES_DIR . 'alwaystrue-pointlessassert.php'],
[
// TODO: remove try/catch block when PHPStan is fixed.
try {
// Second argument is array of expected warnings.
$this->analyse(
[self::FIXTURES_DIR . 'alwaystrue-pointlessassert.php'],
[
'Call to function is_int() with int will always evaluate to true.',
7,
[
'Call to function is_int() with int will always evaluate to true.',
7,
],
],
],
);
);
} catch (Deprecated $e) {
self::markTestSkipped(
'PHPStan has a dependency on an Hoa library that triggers a deprecation warning with PHP 8.6.'
);
}
}
}