Skip to content

Commit

Permalink
Fixed a bug where classes without a Handler annotation where also mapped
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Oct 14, 2018
1 parent cde496b commit 0672ddb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Mapper.php
Expand Up @@ -22,7 +22,7 @@ public static function map(string $path, ?Reader $reader = null): iterable
foreach (listClassesInDirectory($path) as $class) {
$handler = self::getHandlerByCommand($class, $reader);

if ($handler !== null && !class_exists($handler)) {
if ($handler === null || !class_exists($handler)) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/MapperTest.php
Expand Up @@ -14,7 +14,7 @@ final class MapperTest extends TestCase
{
public function testMapInstantiated()
{
$path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'test-app' . DIRECTORY_SEPARATOR . 'Commands' . DIRECTORY_SEPARATOR;
$path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'test-app' . DIRECTORY_SEPARATOR;
$map = iterator_to_array(Mapper::mapInstantiated($path));

self::assertSame(1, count($map));
Expand All @@ -24,7 +24,7 @@ public function testMapInstantiated()

public function testMap()
{
$path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'test-app' . DIRECTORY_SEPARATOR . 'Commands' . DIRECTORY_SEPARATOR;
$path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'test-app' . DIRECTORY_SEPARATOR;
$map = iterator_to_array(Mapper::map($path));

self::assertSame(
Expand Down

0 comments on commit 0672ddb

Please sign in to comment.