Skip to content

Commit

Permalink
Query engine yields results
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapio committed Apr 3, 2022
1 parent 47fe891 commit 57645ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/phpDocumentor/Transformer/Writer/PathGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
use UnexpectedValueException;

use function array_map;
use function current;
use function explode;
use function get_class;
use function implode;
use function is_string;
use function iterator_to_array;
use function preg_replace_callback;
use function sprintf;
use function strpos;
Expand Down Expand Up @@ -105,7 +107,9 @@ function (array $query) use ($path, $descriptor) {
}

// Find value in Descriptor's properties / methods
$value = (string) $this->queryEngine->perform($descriptor, '$.' . $variable);
$value = (string) current(
iterator_to_array($this->queryEngine->perform($descriptor, '$.' . $variable))
);

// strip any special characters and surrounding \ or /
$filepart = trim(trim($value), '\\/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected function setUp(): void
$engine = $this->prophesize(Engine::class);
//phpcs:ignore SlevomatCodingStandard.Functions.StaticClosure.ClosureNotStatic
$engine->perform(Argument::type(FileDescriptor::class), Argument::any())->will(function ($arguments) {
return $arguments[0]->getPath();
yield $arguments[0]->getPath();
});

$this->generator = new PathGenerator(
Expand Down

0 comments on commit 57645ea

Please sign in to comment.