-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpstan.neon.dist
More file actions
76 lines (75 loc) · 4.42 KB
/
Copy pathphpstan.neon.dist
File metadata and controls
76 lines (75 loc) · 4.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
includes:
# Enables PHPStan's @internal enforcement rules (new.internalClass /
# method.internalClass / staticMethod.internalClass / return.internalClass /
# parameter.internalClass / classConstant.internalClass / catch.internalClass).
# These ship under bleedingEdge because they are not part of the standard
# levels yet (PHPStan 2.x); they may graduate in a future major. composer
# require-dev pins phpstan/phpstan to ^2.1.13 — the floor where these rules
# are actually present, so a lockfile downgrade cannot silently disable
# enforcement. Pinned to the vendored .neon so the rule set tracks whichever
# phpstan version composer resolves.
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
parameters:
level: 6
paths:
- src
- tests
# Pest is intentionally not in require-dev (Pest 4 requires PHPUnit ^12
# while the matrix also covers PHPUnit ^13). Without this stub PHPStan
# would surface "unknown class" / "unknown function" errors on every
# Pest-flavoured file. The stub declares Pest\Expectation, the
# HigherOrderTapProxy / TestCall wrappers, and the global
# expect()/test()/it()/uses() functions with just enough type
# information for the type-sensitive static dispatch in
# src/Pest/Expectations.php to analyse cleanly (the file is no longer
# excluded from analysis).
scanFiles:
- stubs/pest.stub
excludePaths:
- src/Laravel
# Pest's `expect()->extend()` and `it(...)` rebind `$this` to the
# Expectation / TestCase instance at runtime — a pattern PHPStan
# cannot follow statically. Every $this access inside those
# closures would surface as "Undefined variable: $this". The
# Autoload file and the Pest test files are excluded for that
# reason; the type-sensitive dispatch logic lives in
# src/Pest/Expectations.php (not excluded) which the stub now
# makes analysable.
- src/Pest/Autoload.php
- tests/Pest.php
- tests/Integration/Pest
# This is an isolated Composer package that deliberately resolves the
# old namespace at runtime and contains an optional adapter whose base
# class must stay unavailable. Its integration test remains analysed;
# analysing the fixture itself would require stubs that invalidate the
# behavior being tested.
- tests/fixtures/namespace-compatibility
# EnumScanner fixture dir holds intentionally-unused trait/abstract
# files so the scanner can walk past them; PHPStan would otherwise
# flag them as `trait.unused`.
- tests/Unit/Internal/Fixture/EnumScanner
tmpDir: .phpstan.cache
ignoreErrors:
# PHPUnit marks AssertionFailedError + Exception @internal, but test code
# legitimately catches and asserts against them (the auto-injection test
# boundary, response-validator failure surfaces). PHPUnit's @internal is
# about THEIR API contract, not ours — our enforcement target is calls
# that cross our root namespace boundary (Studio).
- '#internal class PHPUnit\\Framework\\(AssertionFailedError|Exception)#'
# `TestCase::name()` is PHPUnit's de-facto API for in-test introspection
# (Symfony's TestContainer, Mockery, Pest, and the SpecPriorityOverride
# design all rely on it). Marked @internal upstream but no replacement.
# SkipOpenApiResolver and OpenApiSpecResolver call it to resolve the
# current test method name for attribute lookup.
- '#Call to internal method PHPUnit\\Framework\\TestCase::name\(\)#'
# `TestCase::numberOfAssertionsPerformed()` is PHPUnit's public-but-
# @internal-tagged accessor for the in-test assertion counter. We use
# it in AssertsNoEnumDriftTest to pin the trait's "increment by 1 per
# call" contract — there is no public replacement.
- '#Call to internal method PHPUnit\\Framework\\TestCase::numberOfAssertionsPerformed\(\)#'
# `TestCase::addToAssertionCount()` is the documented hook for
# framework-level helpers (PHPUnit's own ValidatesOpenApiSchema-style
# traits, Pest's expectation API) to register assertions performed via
# custom paths. Marked @internal upstream but no replacement exists.
# AssertsNoEnumDrift uses it for exactly this purpose.
- '#Call to internal method PHPUnit\\Framework\\TestCase::addToAssertionCount\(\)#'