Skip to content

`getClassesInNamespace()` returns `Traits`

Hi,

maybe it is a normal behavior but should ClassFinder::getClassesInNamespace() returns PHP trait?

When using class_exists() on elements returned by this function, PHP says it is false. But trait_exists() is working (when not class)..

To replicate

  1. Have two name space 'App\Entity' and 'App\Entity\Traits'.
  2. Have App\Entity\User class.
  3. Have App\Entity\Traits\Address trait.
  4. List all classes in name space with Recursive mode: ClassFinder::getClassesInNamespace('App\Entity', ClassFinder::RECURSIVE_MODE);.
  5. Final list looks like this:
  • App\Entity\User
  • App\Entity\Traits\Address

Expected behavior

Only have App\Entity\User when searching for CLASSES in Namespace.

Edited by CAVASIN