chore: synchronise phpstan config (resolves #118)#146
Merged
Conversation
- 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
This was referenced May 12, 2026
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Samenvatting
Lost inconsistentie op tussen
composer.json(level 5 hardcoded) enphpstan.neon(level 0). Vanaf nu isphpstan.neonde enige bron van waarheid.Wijzigingen
composer.json"analyse"script:vendor/bin/phpstan analyse src/ --level=5→vendor/bin/phpstan analyse --memory-limit=512M --no-progress--levelflag meer — leest uitphpstan.neon--memory-limit=512Mvoorkomt OOM-crashes op de default 128Mphpstan.neonPragmaRX\Google2FA\Google2FABaconQrCode\*App\Models\UserModelResourceDeze 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 analysegroen te krijgen — een randvoorwaarde voor de CI pipeline (#117).Verificatie
composer analyse→[OK] No errorscomposer test→ tests blijven groen (5 tests op develop branch)Out of scope
src/→ aparte cleanup