-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathphpstan.dist.neon
More file actions
87 lines (85 loc) · 4.67 KB
/
Copy pathphpstan.dist.neon
File metadata and controls
87 lines (85 loc) · 4.67 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
77
78
79
80
81
82
83
84
85
86
87
includes:
- phpstan-baseline.neon
# PHPUnit awareness: assertion methods narrow types (so the analyser stops treating a
# passing assertion as an unchecked value) and the rule set catches the assertion smells
# the suite can hide - listed explicitly rather than through phpstan/extension-installer,
# matching how every other service in this config is declared
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
parameters:
level: max
phpVersion: 80400
# Deterministic result-cache location (gitignored, /var/) so CI can cache it
tmpDir: var/phpstan
paths:
- src
- tests
# Executed by every consumer through composer's autoload.files, and by the
# opcache.preload stage respectively - analysed like any other shipped code
- bootstrap.php
- preload.php
- tools/generator/lib
- tools/generator/emit.php
- tools/generator/generate.php
- tools/generator/symbols.php
- tools/generator/validate.php
- tools/examples/worker-loop.php
- tools/phpstan
excludePaths:
- tests/phpstan/specialization-class-stubs.php
# Compiled into the opcache file cache by child processes; the static
# counter and attribute usage are fixture payload, not library code
- tests/OpCache/fixtures/answer.php
# Child driver invoked in a subprocess; calls a dynamic global/method
# target passed on argv, which is not statically typeable
- tests/OpCache/scripts/run-cached.php
# Sacrificial child pinning the ext-ffi abort on zend_throw_exception_hook:
# pokes the raw engine symbol through an ad-hoc FFI::cdef on purpose
- tests/System/Hook/scenarios/throw-hook-ffi-abort.php
# Analysis-only declarations of the runtime-generated specialized classes and the
# deliberately-undefined placeholder type (see the file header for the rationale),
# plus the generated engine struct stubs (ZEngine\Generated\*, emitted by
# tools/generator into stubs/ - never autoloadable, visible to analysis only)
scanFiles:
- tests/phpstan/specialization-class-stubs.php
- stubs/zend-engine-structs.php
# FFI\CData is dynamically typed - the engine structs it wraps are only
# known at runtime from the loaded header, so field/method access on CData
# cannot be statically resolved. Scope the unavoidable ignores tightly to
# CData/FFI so all non-FFI code is still held to level max.
ignoreErrors:
# Direct field reads off a raw CData handle: the generated struct stubs
# (stubs/zend-engine-structs.php) type every field the wrappers touch, but the
# low-level pointer-surgery zones below still read undeclared fields directly.
-
identifier: property.notFound
message: '#Access to an undefined property FFI\\CData::#'
# Raw CData buffers (locally-allocated `T[N]` arrays used with memcpy/addr and
# indexed in place) are genuine C arrays; the generated struct stubs deliberately do
# NOT implement ArrayAccess (they are structs, not arrays - typed contiguous arrays
# go through Type\StructArray instead).
-
identifier: offsetAccess.nonOffsetAccessible
message: '#Cannot access offset .+ on FFI\\CData#'
# Type\StructArray is the single audited pointer-index primitive: its base is a raw
# CData handle at runtime (typed `object` so a stub pointer view is accepted), so the
# two in-class base indexes (offsetGet + the static at() deref) are scoped-ignored here.
-
identifier: offsetAccess.nonOffsetAccessible
path: src/Type/StructArray.php
# The dimension tests exist to prove that a plain `count($object)` reaches the engine's
# count_elements handler on a class that never declared the count itself. Rewriting them
# as assertCount() would measure PHPUnit's Count constraint instead of the language
# construct under test, so phpstan-phpunit's suggestion is declined for this file only.
-
identifier: phpunit.assertCount
path: tests/Reflection/ReflectionClassDimensionTest.php
reportUnmatchedIgnoredErrors: false
treatPhpDocTypesAsCertain: false
# Resolves the typed Core entry points (new/trackedNew/cast/pointerAtAddress) by their
# literal $type argument: stub class-strings type the handle as the generated stub
# class, C type name strings stay FFI\CData (see the extension's class docblock)
services:
-
class: ZEngine\PHPStan\TypedEntryPointReturnExtension
tags: [phpstan.broker.dynamicStaticMethodReturnTypeExtension]