[PHPStan] Constante BASE_PATH non reconnue dans auth.php et db.php #4

Closed
opened 2026-05-08 11:20:52 +00:00 by cedricAbonnel · 0 comments
Owner

Erreurs PHPStan détectées

  • src/auth.php:6Constant BASE_PATH not found
  • src/db.php:5Constant BASE_PATH not found

Cause

BASE_PATH est définie à runtime dans public/index.php (define("BASE_PATH", ...)) mais PHPStan ne peut pas le savoir lors de l'analyse statique de src/.

Correction

Ajouter un fichier bootstrap PHPStan dans phpstan.neon :

parameters:
    bootstrapFiles:
        - phpstan-bootstrap.php

avec phpstan-bootstrap.php qui définit la constante.

Détecté par PHPStan level 5 — baseline commit 70304d3

## Erreurs PHPStan détectées - `src/auth.php:6` — `Constant BASE_PATH not found` - `src/db.php:5` — `Constant BASE_PATH not found` ## Cause `BASE_PATH` est définie à runtime dans `public/index.php` (`define("BASE_PATH", ...)`) mais PHPStan ne peut pas le savoir lors de l'analyse statique de `src/`. ## Correction Ajouter un fichier bootstrap PHPStan dans `phpstan.neon` : ```neon parameters: bootstrapFiles: - phpstan-bootstrap.php ``` avec `phpstan-bootstrap.php` qui définit la constante. _Détecté par PHPStan level 5 — baseline commit 70304d3_
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cedricAbonnel/varlog#4