Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e752f28
Parse @pure-unless-callable-is-impure PHPDoc tag
zonuexe Jul 2, 2026
53727b9
Thread pure-unless-callable-is-impure through the reflection layer
zonuexe Jul 2, 2026
7b0f228
Wire pure-unless-callable-is-impure into the analyser
zonuexe Jul 2, 2026
da3fbca
Mark callback-accepting builtins as pure-unless-callable-is-impure
zonuexe Jul 2, 2026
e5f4c50
Add tests for @pure-unless-callable-is-impure
zonuexe Jul 2, 2026
d354666
Fix pure-unless-callable-is-impure parameter flag propagation
zonuexe Jul 2, 2026
3fe1829
Suppress call impure points when pure-unless-callable-is-impure callb…
zonuexe Jul 2, 2026
bd3febf
Fix CI: avoid named arguments, adjust no-effect fixture
zonuexe Jul 2, 2026
03e7ea4
Cover pure-unless-callable-is-impure verdict for maybe-null and maybe…
zonuexe Jul 3, 2026
dbe4eaf
Simplify pure-unless-callable-is-impure metadata reads
zonuexe Jul 3, 2026
498783b
Document the shape of the function metadata array
zonuexe Jul 3, 2026
8d7b559
Mark array_all() and array_any() as pure-unless-callable-is-impure
zonuexe Jul 3, 2026
9bdc1ea
Honor pure-unless-callable-is-impure metadata for stub-reflected func…
zonuexe Jul 3, 2026
4fd839e
Add lint version comment to the PHP 8.4 pure-unless fixture
zonuexe Jul 3, 2026
9d64ec1
Honor @pure-unless-callable-is-impure on methods
zonuexe Jul 5, 2026
d1a253d
Note the two paths that intentionally don't thread pure-unless yet
zonuexe Jul 5, 2026
0a6650a
Honor @pure-unless-callable-is-impure on constructor calls
zonuexe Jul 5, 2026
ae0e28f
Drop the native mixed property type from the pure-unless fixture
zonuexe Jul 5, 2026
1bc68ff
Restructure NewHandler pure-unless branching to match createFromVariant
zonuexe Jul 5, 2026
92e24b2
Cover a union pure-callable|callable argument on a pure-unless constr…
zonuexe Jul 6, 2026
3ec51f1
Return TrinaryLogic from isPureUnlessCallableIsImpureParameter()
zonuexe Jul 7, 2026
33926fe
Check the body of @pure-unless-callable-is-impure functions for purity
zonuexe Jul 7, 2026
160db8c
Report redundant @pure-unless-callable-is-impure on a pure callable
zonuexe Jul 7, 2026
43f61e8
Return TrinaryLogic from getPureUnlessCallableIsImpureParameters()
zonuexe Jul 7, 2026
b6f0d66
Report impure methods overriding @pure-unless-callable-is-impure methods
zonuexe Jul 7, 2026
33f825a
Add a direct unit test for resolvePureUnlessCallableIsImpureVerdict()
zonuexe Jul 7, 2026
f0cf3d4
Make SimpleImpurePointTest a self-contained unit test
zonuexe Jul 7, 2026
4859c2f
Share the pure-unless-callable verdict-to-certainty decision
zonuexe Jul 7, 2026
07722d2
Revert the direct mutation-testing unit test and verdict helper
zonuexe Jul 7, 2026
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
Prev Previous commit
Next Next commit
Make SimpleImpurePointTest a self-contained unit test
Extend plain TestCase and pass a mocked Scope instead of booting the DI
container and creating a real analyser Scope. The verdict method never
consults the scope when no arguments are passed, so this keeps the test
fully isolated (avoids interfering with other tests' shared state) while
still killing the parameter-flag mutant.
  • Loading branch information
zonuexe committed Jul 7, 2026
commit f0cf3d496dc297d0c852db27f68ace7255198528
11 changes: 5 additions & 6 deletions tests/PHPStan/Reflection/Callables/SimpleImpurePointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

namespace PHPStan\Reflection\Callables;

use PHPStan\Analyser\ScopeContext;
use PHPStan\Analyser\ScopeFactory;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\FunctionVariant;
use PHPStan\Reflection\PassedByReference;
use PHPStan\Reflection\Php\ExtendedDummyParameter;
use PHPStan\Testing\PHPStanTestCase;
use PHPStan\TrinaryLogic;
use PHPStan\Type\Generic\TemplateTypeMap;
use PHPStan\Type\MixedType;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

class SimpleImpurePointTest extends PHPStanTestCase
class SimpleImpurePointTest extends TestCase
{

public static function dataResolvePureUnlessCallableIsImpureVerdict(): iterable
Expand Down Expand Up @@ -63,8 +62,8 @@ public function testResolvePureUnlessCallableIsImpureVerdict(TrinaryLogic $param
new MixedType(),
);

$scopeFactory = self::getContainer()->getByType(ScopeFactory::class);
$scope = $scopeFactory->create(ScopeContext::create('dummy.php'));
// The callback is omitted (no args), so the scope is never consulted.
$scope = $this->createMock(Scope::class);

$verdict = SimpleImpurePoint::resolvePureUnlessCallableIsImpureVerdict($variant, $scope, []);

Expand Down
Loading