Skip to content
This repository has been archived by the owner on Sep 8, 2022. It is now read-only.

Commit

Permalink
ignore Traits and Interfaces in the reflection factory (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
newLoki authored Jul 10, 2017
1 parent d5659b1 commit fed0154
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Knp/JsonSchemaBundle/Reflection/ReflectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@ public function createFromDirectory($directory, $namespace)
return array();
}

$this->finder->files();
$this->finder->name('*.php');
$this->finder->in($directory);
$finder = clone $this->finder;
$finder->files();
$finder->name('*.php');
$finder->in($directory);

$refClasses = array();

foreach ($this->finder->getIterator() as $name) {
foreach ($finder->getIterator() as $name) {
$baseName = substr($name, strlen($directory)+1, -4);
$baseClassName = str_replace('/', '\\', $baseName);

if (preg_match('/Interface/', $baseClassName) > 0 || preg_match('/Trait/', $baseClassName) > 0) {
continue;
}

$refClasses[] = $this->create($namespace.'\\'.$baseClassName);
}

Expand Down

0 comments on commit fed0154

Please sign in to comment.