[PHPStan] Namespaces erronés dans UserRepository #1

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

Erreurs PHPStan détectées

Fichier : src/Repository/UserRepository.php

  • Instantiated class App\\Repository\\InvalidArgumentException not found
  • Throwing object of an unknown class App\\Repository\\InvalidArgumentException
  • Caught class App\\Repository\\PDOException not found
  • Call to method getCode() on an unknown class App\\Repository\\PDOException
  • Throwing object of an unknown class App\\Repository\\PDOException
  • Method nullIfEmpty() is unused

Cause

Les exceptions PDOException et InvalidArgumentException sont utilisées sans namespace, mais PHP les cherche dans App\\Repository\\ au lieu de l'espace global \\.

Correction

Remplacer PDOException par \\PDOException et InvalidArgumentException par \\InvalidArgumentException.
Supprimer ou utiliser la méthode nullIfEmpty().

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

## Erreurs PHPStan détectées Fichier : `src/Repository/UserRepository.php` - `Instantiated class App\\Repository\\InvalidArgumentException not found` - `Throwing object of an unknown class App\\Repository\\InvalidArgumentException` - `Caught class App\\Repository\\PDOException not found` - `Call to method getCode() on an unknown class App\\Repository\\PDOException` - `Throwing object of an unknown class App\\Repository\\PDOException` - `Method nullIfEmpty() is unused` ## Cause Les exceptions `PDOException` et `InvalidArgumentException` sont utilisées sans namespace, mais PHP les cherche dans `App\\Repository\\` au lieu de l'espace global `\\`. ## Correction Remplacer `PDOException` par `\\PDOException` et `InvalidArgumentException` par `\\InvalidArgumentException`. Supprimer ou utiliser la méthode `nullIfEmpty()`. _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#1