Skip to content

Commit ef03be2

Browse files
committed
Improve source executor
1 parent 3e79912 commit ef03be2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Internal/Runtime/SourceExecutor.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,13 @@ private function lookup(ReadableInterface $source, string $file, bool $withLocal
365365
{
366366
$file = $this->normalizeRelativePathname($file);
367367

368+
// Local overridden sources should be a priority
369+
foreach ($this->sources as $name => $out) {
370+
if ($this->normalizeRelativePathname($name) === $file) {
371+
return $out;
372+
}
373+
}
374+
368375
if ($source instanceof FileInterface && $withLocal) {
369376
$pathname = \dirname($source->getPathname()) . \DIRECTORY_SEPARATOR . $file;
370377

@@ -381,12 +388,6 @@ private function lookup(ReadableInterface $source, string $file, bool $withLocal
381388
}
382389
}
383390

384-
foreach ($this->sources as $name => $source) {
385-
if ($this->normalizeRelativePathname($name) === $file) {
386-
return $source;
387-
}
388-
}
389-
390391
throw new \LogicException(\sprintf('"%s": No such file or directory', $file));
391392
}
392393

0 commit comments

Comments
 (0)