From ffd087106ff4075296b79b4197053c0ffbdfa90c Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Thu, 21 May 2026 21:34:35 +0200 Subject: [PATCH] chore(canonical): ship baseline-include pattern + pilot fixes Three follow-ups discovered during the decidesk pilot of the fleetwide canonical (#48): 1. Ship empty phpstan-baseline.neon and include it from phpstan.neon. This is the canonical tracked-debt entry point. The fleet directive forbids per-app validation rules, but baselines remain acceptable as temporary tracked-debt markers (with an open GitHub issue + removal timeline). Apps without debt ship the empty baseline file as-is. 2. Fix the JSONResponse statusCode ignoreErrors regex to match both `Parameter $statusCode` and the more common `Parameter #N $statusCode` forms that phpstan actually emits. The previous regex only matched the first form, which is why decidesk needed a per-app suppression (and several other apps too). 3. Add OCA\OpenRegister\Service\CalendarEventService to the psalm referencedClass whitelist. Currently only decidesk uses it, but it's an OpenRegister-shipped class loaded at runtime; whitelisting it fleetwide is no-op for apps that don't depend on it. --- phpstan-baseline.neon | 12 ++++++++++++ phpstan.neon | 9 ++++++++- psalm.xml | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 phpstan-baseline.neon diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..bf2ceb9 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,12 @@ +# Per-app phpstan lint debt baseline. +# +# Regenerate with: ./vendor/bin/phpstan analyse --generate-baseline +# Apps without lint debt ship this file empty. +# +# Tracked-debt entries here MUST have an open GitHub issue. The directive for the +# Conduction fleet is "no per-app validation rules; if we need exceptions then +# they are for all apps." A baseline entry is acceptable only as a temporary +# tracked-debt marker with a removal timeline. + +parameters: + ignoreErrors: [] diff --git a/phpstan.neon b/phpstan.neon index e99f01f..26974c2 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,9 @@ +includes: + # Per-app tracked lint debt lives here (auto-generated via `phpstan --generate-baseline`). + # Apps without debt ship an empty baseline file; canonical includes are otherwise byte-identical + # across the fleet. + - phpstan-baseline.neon + parameters: level: 5 paths: @@ -42,7 +48,8 @@ parameters: - '#Doctrine\\DBAL\\[a-zA-Z\\]+.*not found#' - '#on an unknown class Doctrine\\DBAL\\#' # Dynamic HTTP status codes from business rule validation results - - '#Parameter \$statusCode of class OCP\\AppFramework\\Http\\JSONResponse constructor expects#' + # (matches both `Parameter $statusCode` and `Parameter #N $statusCode` forms emitted by phpstan) + - '#Parameter (#\d+ )?\$statusCode of class OCP\\AppFramework\\Http\\JSONResponse constructor expects#' # registerRepairStep exists on server; not yet in nextcloud/ocp stub used for analysis - '#Call to an undefined method OCP\\AppFramework\\Bootstrap\\IRegistrationContext::registerRepairStep#' # OCP stub gaps for methods that exist at runtime diff --git a/psalm.xml b/psalm.xml index 7a7ddaf..8c46a06 100644 --- a/psalm.xml +++ b/psalm.xml @@ -73,6 +73,7 @@ +