-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpstan.neon
More file actions
74 lines (71 loc) · 4.55 KB
/
Copy pathphpstan.neon
File metadata and controls
74 lines (71 loc) · 4.55 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
# Hermiq — Conduction PHPStan config.
#
# The shared base is the single source of truth. Everything here is either the
# app's own tracked debt or an ignore naming a symbol that exists in no other
# fleet app. Anything you are tempted to add that another app would also need
# belongs in the base, not here.
includes:
- vendor/conduction/hydra-gates/quality-config/phpstan-base.neon
# Per-app tracked lint debt (auto-generated via `phpstan --generate-baseline`).
- phpstan-baseline.neon
parameters:
# `lib/Resources/template` USED to be excluded by the shared base. It left the
# base in conduction/hydra-gates v1.7.3, because a conditional path has no
# spelling that is safe on both PHPStan majors: plain aborts 2.x (it validates
# the entry), the `(?)` marker makes NEON parse it as an entity and aborts 2.x
# differently, and quoting stops 1.x stripping the marker so the exclusion
# silently matches nothing — which would have started analysing this snapshot
# with nobody told. Only the apps that actually ship the directory carry it.
excludePaths:
- lib/Resources/template
# App-specific only. The base already sets level, paths, bootstrapFiles,
# excludePaths, scanDirectories and every fleet-wide ignore.
scanDirectories:
# Declaration-only stubs for OpenRegister/Talk contracts (soft runtime
# dependencies, resolved only when those apps are installed). Scanned —
# never analysed, never autoloaded at runtime (PSR-4 maps only
# OCA\Hermiq\ -> lib/); the real classes win whenever OpenRegister is
# enabled. Same "share the contract" pattern as nldesign (2e0eab2):
# phpstan refuses to ignoreErrors the "implements unknown interface"
# category, so the contract must be resolvable.
# This now also covers tests/Stubs/Service/Capability — the ADR-099 §5
# grammar that moved to OpenRegister. Those stubs are DECLARATION-ONLY and
# every body throws, which is what keeps the split honest: static analysis
# needs the class to resolve (the `php-quality` job does NOT check out
# OpenRegister, so without them thirteen call sites are unknown-class
# errors and the gate goes quiet on all of them), while every test runs
# against the REAL source that tests/bootstrap.php maps under a longer
# PSR-4 prefix. A signature drift therefore surfaces in the test run; it
# cannot hide behind a stub that answers.
- tests/Stubs
ignoreErrors:
# OC\Security\CSRF is server-internal (no OCP equivalent yet for CsrfTokenManager etc.)
- '#unknown class OC\\Security\\CSRF\\#'
- '#OC\\Security\\CSRF\\#'
# An OpenRegister *RequestedEvent (e.g. AgentRunRequestedEvent) dispatched via
# IEventDispatcher::dispatchTyped(): the real event extends OCP\EventDispatcher\Event,
# but the class is not resolvable in static analysis (OR is not a composer require),
# so phpstan cannot verify the subtype. Same root cause as the OR ignores in the base.
- '#dispatchTyped\(\) expects OCP\\EventDispatcher\\Event, OCA\\OpenRegister\\Event\\[a-zA-Z]+ given#'
# Nextcloud Talk (spreed) — optional runtime dependency, resolved lazily; not in static analysis
- '#unknown class OCA\\Talk\\#'
- '#OCA\\Talk\\[a-zA-Z\\]+.*not found#'
- '#on an unknown class OCA\\Talk\\#'
- '#has invalid return type OCA\\Talk\\#'
- '#should return OCA\\Talk\\[a-zA-Z\\]+ but returns mixed#'
# Nextcloud Mail (OCA\Mail) — the same optional-runtime-dependency shape
# as OCA\Talk above, but it surfaces differently. MailReadService probes
# for the Mail service classes with class_exists() before resolving them
# from the container. Because the Mail app is not in static analysis and
# MAIL_CLASSES holds literal class-name strings, PHPStan 2 can prove the
# probe is always FALSE and reports function.impossibleType.
#
# That verdict is correct about the analysis environment and wrong about
# production: the probe is precisely what makes the soft dependency safe,
# and deleting it would turn "Mail is not installed" from a null return
# into a container exception. Scoped to the one file and identifier so it
# cannot mask an impossible condition anywhere else.
-
message: '#Call to function class_exists\(\) with .* will always evaluate to false#'
identifier: function.impossibleType
path: lib/Service/NcNative/MailReadService.php