diff --git a/src/Files/FilesEntry.php b/src/Files/FilesEntry.php index 06a8b5c..975e919 100644 --- a/src/Files/FilesEntry.php +++ b/src/Files/FilesEntry.php @@ -28,7 +28,7 @@ class FilesEntry */ public function knowsNamespace($namespace) { - $classes = $this->getClassesInFile(); + $classes = $this->getClassesInFile(ClassFinder::ALLOW_CLASSES | ClassFinder::ALLOW_INTERFACES | ClassFinder::ALLOW_TRAITS); foreach($classes as $class) { if (strpos($class, $namespace) !== false) { @@ -83,7 +83,7 @@ class FilesEntry * * @return array */ - private function getClassesInFile($options = ClassFinder::ALLOW_INTERFACES | ClassFinder::ALLOW_TRAITS) + private function getClassesInFile($options) { // get_declared_*() returns a bunch of classes|interfaces|traits that are built into PHP. So we need a control here. list($initialInterfaces, diff --git a/src/PSR4/PSR4Namespace.php b/src/PSR4/PSR4Namespace.php index 6d00a71..f2599c5 100644 --- a/src/PSR4/PSR4Namespace.php +++ b/src/PSR4/PSR4Namespace.php @@ -166,7 +166,7 @@ class PSR4Namespace * @param int $options * @return string[] */ - public function findClasses($namespace, $options = ClassFinder::STANDARD_MODE) + public function findClasses($namespace, $options) { $allowAdditional = $options & ~ClassFinder::MODE_MASK; $options &= ClassFinder::MODE_MASK; diff --git a/test/unit/Files/FilesEntryTest.php b/test/unit/Files/FilesEntryTest.php index 20a221a..91fe3cf 100644 --- a/test/unit/Files/FilesEntryTest.php +++ b/test/unit/Files/FilesEntryTest.php @@ -2,6 +2,7 @@ namespace HaydenPierce\ClassFinder\UnitTest\Files; +use HaydenPierce\ClassFinder\ClassFinder; use HaydenPierce\ClassFinder\Files\FilesEntry; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; @@ -46,7 +47,7 @@ EOL $files = new FilesEntry($tmpFilename, $this->findPHP()); - $classes = $files->getClasses($namespace, 0); + $classes = $files->getClasses($namespace, ClassFinder::ALLOW_CLASSES); $this->assertEquals($expected, $classes, 'FilesEntry should be able to determine the classes defined in a given file.'); }