1
0
mirror of https://github.com/danog/class-finder.git synced 2025-01-22 13:51:42 +01:00

Dont identify sub-namespaces (intended for later)

This commit is contained in:
Hayden Pierce 2018-10-20 21:33:55 -05:00
parent ea97ae9550
commit 2a9d51931a

View File

@ -36,7 +36,13 @@ class FilesEntry
$classes = $this->getClassesInFile();
return array_filter($classes, function($class) use ($namespace) {
return strpos($class, $namespace) !== false;
$classNameFragments = explode('\\', $class);
array_pop($classNameFragments);
$classNamespace = implode('\\', $classNameFragments);
$namespace = trim($namespace, '\\');
return $namespace === $classNamespace;
});
}