Hi
this code gives 3 warnings:

$rdi = new RecursiveDirectoryIterator(app_path('Helpers'.DIRECTORY_SEPARATOR.'Global'));
$it = new RecursiveIteratorIterator($rdi);

while ($it->valid()) {
        if (
            ! $it->isDot() &&
            $it->isFile() &&
            $it->isReadable() &&
            'php' === $it->current()->getExtension() &&
            mb_strpos($it->current()->getFilename(), 'Helper')
        ) {
            require $it->key();
    }

    $it->next();
}

rabol Thank you for the test case, I'll take a look on that.

    rabol implemented for most common cases;

    We've annotated both RecursiveIteratorIterator and IteratorIterator with a generic argument that will be inferred in most cases automatically, and added a @mixin annotation.

    The code above will work out of the box.

    In case, the PHP editor won't be able to infer the inner iterator, please annotate the $it variable with doc comment, i.e.:

    /** @var RecursiveIteratorIterator&RecursiveDirectoryIterator $it */
      Write a Reply...