SCA: use 'yield from' where it does make sense
This commit is contained in:
parent
9253199de1
commit
dc1b24a8eb
@ -281,9 +281,7 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte
|
||||
}
|
||||
|
||||
if ($fallbackKeys) {
|
||||
foreach ($this->pool->getItems($fallbackKeys) as $key => $item) {
|
||||
yield $key => $item;
|
||||
}
|
||||
yield from $this->pool->getItems($fallbackKeys);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,9 +242,7 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt
|
||||
}
|
||||
|
||||
if ($fallbackKeys) {
|
||||
foreach ($this->pool->getMultiple($fallbackKeys, $default) as $key => $item) {
|
||||
yield $key => $item;
|
||||
}
|
||||
yield from $this->pool->getMultiple($fallbackKeys, $default);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -122,9 +122,7 @@ abstract class FileLoader extends Loader
|
||||
}
|
||||
$resource = new GlobResource($prefix, $pattern, $recursive, $forExclusion, $excluded);
|
||||
|
||||
foreach ($resource as $path => $info) {
|
||||
yield $path => $info;
|
||||
}
|
||||
yield from $resource;
|
||||
}
|
||||
|
||||
private function doImport($resource, $type = null, bool $ignoreErrors = false, $sourceResource = null)
|
||||
|
@ -78,9 +78,7 @@ class InputStream implements \IteratorAggregate
|
||||
$current = array_shift($this->input);
|
||||
|
||||
if ($current instanceof \Iterator) {
|
||||
foreach ($current as $cur) {
|
||||
yield $cur;
|
||||
}
|
||||
yield from $current;
|
||||
} else {
|
||||
yield $current;
|
||||
}
|
||||
|
@ -115,9 +115,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
throw new \LogicException(sprintf('%s object holds non-iterable type "%s".', self::class, \gettype($value)));
|
||||
}
|
||||
|
||||
foreach ($value as $k => $v) {
|
||||
yield $k => $v;
|
||||
}
|
||||
yield from $value;
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
|
Reference in New Issue
Block a user