Wulfheart / laravel-actions-ide-helper

MIT License
18 stars 26 forks source link

LogicException You must call one of in() or append() methods before iterating over a Finder. #13

Closed misog closed 8 months ago

misog commented 2 years ago

Hi, after running php artisan ide-helper:actions this error occurs:

   LogicException 

  You must call one of in() or append() methods before iterating over a Finder.

  at vendor/symfony/finder/Finder.php:611
    607▕      */
    608▕     public function getIterator(): \Iterator
    609▕     {
    610▕         if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  ➜ 611▕             throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
    612▕         }
    613▕ 
    614▕         if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
    615▕             $iterator = $this->searchInDirectory($this->dirs[0]);

      +8 vendor frames 
  9   [internal]:0
      Illuminate\Support\LazyCollection::Illuminate\Support\{closure}()

      +2 vendor frames 
  12  [internal]:0
      Wulfheart\LaravelActionsIdeHelper\Service\ActionInfoFactory::Wulfheart\LaravelActionsIdeHelper\Service\{closure}()

Laravel 9.16.0 PHP 8.1.3

Wulfheart commented 2 years ago

Do you have a demo repo where this issue happens?

misog commented 2 years ago

No, but it happens also on a fresh project without app/Actions directory. When I create app/Actions directory then it works:

IDE Helpers generated for Laravel Actions at ...

I think it should not throw the error if no Actions directory is found.

Also Laravel Actions 2 can be placed everywhere so there should be a way how to configure paths or the IDE helper just could rescan all folders recursively.

Wulfheart commented 8 months ago

This project is in YOLO-mode now. Please feel free to re-open if you think it still applies.