Skip to content

chore: synchronise phpstan config (resolves #118)#146

Merged
ginkelsoft-development merged 1 commit into
developfrom
chore/phpstan-level-sync
May 12, 2026
Merged

chore: synchronise phpstan config (resolves #118)#146
ginkelsoft-development merged 1 commit into
developfrom
chore/phpstan-level-sync

Conversation

@ginkelsoft-development

Copy link
Copy Markdown
Owner

Samenvatting

Lost inconsistentie op tussen composer.json (level 5 hardcoded) en phpstan.neon (level 0). Vanaf nu is phpstan.neon de enige bron van waarheid.

Wijzigingen

composer.json

  • "analyse" script: vendor/bin/phpstan analyse src/ --level=5vendor/bin/phpstan analyse --memory-limit=512M --no-progress
  • Geen --level flag meer — leest uit phpstan.neon
  • --memory-limit=512M voorkomt OOM-crashes op de default 128M

phpstan.neon

  • Niveau blijft op 0 (huidige werkelijkheid)
  • 4 extra ignores toegevoegd voor pre-existing unresolved external classes:
    • PragmaRX\Google2FA\Google2FA
    • BaconQrCode\*
    • App\Models\User
    • Een specifieke static property mismatch in ModelResource

Deze classes zijn composer require-dependencies, dus de unresolved-meldingen wijzen op een phpstan setup-probleem (geen stubs / autoload context).

Vervolg

Issue #145 is aangemaakt om de nieuwe ignores te vervangen door echte stubs of betere autoload-config. Voor nu zijn de ignores nodig om composer analyse groen te krijgen — een randvoorwaarde voor de CI pipeline (#117).

Verificatie

  • composer analyse[OK] No errors
  • composer test → tests blijven groen (5 tests op develop branch)
  • Diff blijft minimaal: 8 regels totaal

Out of scope

- composer.json: 'analyse' script no longer hardcodes --level=5;
  it now reads the level from phpstan.neon (single source of truth).
- composer.json: add --memory-limit=512M to prevent OOM crashes on
  default 128M limit.
- phpstan.neon: add ignores for known unresolved external classes
  (PragmaRX/Google2FA, BaconQrCode, App\Models\User) so the analysis
  runs cleanly on level 0. These ignores hide real issues and will be
  replaced with proper stubs in a follow-up (#145).

Resolves #118
@ginkelsoft-development
ginkelsoft-development merged commit 33f13ac into develop May 12, 2026
11 of 12 checks passed
@ginkelsoft-development
ginkelsoft-development deleted the chore/phpstan-level-sync branch May 12, 2026 10:15
ginkelsoft-development added a commit that referenced this pull request May 12, 2026
Issue #145: phpstan.neon's ignoreErrors list contained suppression
patterns for symbols that *should* be resolvable but weren't being
picked up — PragmaRX\Google2FA\Google2FA, BaconQrCode\Renderer\*,
BaconQrCode\Writer. The 'Class not found' errors came from those two
packages not always being installed in vendor/ (despite sitting in
composer.json), and the workaround was to hide them with broad regex.

That's the right outcome with the wrong mechanism: regex ignores
suppress every future error that matches, including genuine bugs.

This commit:
- Adds phpstan/stubs/optional-deps.stub — minimal class definitions
  for the surface area Buildora actually uses (Google2FA's
  generateSecretKey/getQRCodeUrl/verifyKey, the four BaconQrCode
  classes wired up in TwoFactorController).
- Wires the stub in via phpstan.neon's scanFiles. Stubs are scanned
  for type info, not executed; if the consumer actually installs the
  real packages the implementations take precedence.
- Removes the now-redundant 'Instantiated class PragmaRX/BaconQrCode
  not found' and 'has unknown class … as its type' ignores that
  were proposed in #146.
- Adds a narrower 'Access to an undefined static property' ignore for
  the ModelResource::$model static property — a real issue (#160-like
  follow-up) that's out of scope here.
- Leaves the App\Models\User ignore in place with a comment pointing
  at Larastan as the proper fix.

Verification:
- composer analyse → [OK] No errors at level 0 without the suppression
  regex for the optional packages.
- composer test → green.

Closes #145
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant