barryvdh/laravel-ide-helper

Error in `getValidAliases()` when running with swoole installed

TimoFrenzel opened this issue · 1 comments

Since the package cannot work with swoole,
It would make sense in the Generator.php method getValidAliases()

Not only to skip predis, but also swoole.

if ($facade == 'SwooleTW\Http\Server\Facades\Server' && $name == 'Server' && !class_exists('Swoole\Http\Server')) {
                 continue;
             }
mfn commented

I understand this pattern is also used this way, e.g.

// Skip the Redis facade, if not available (otherwise Fatal PHP Error)
if ($facade == 'Illuminate\Support\Facades\Redis' && $name == 'Redis' && !class_exists('Predis\Client')) {
continue;

Isn't there a way to more generically solve this?

Can you show a complete stacktrace? Maybe it's smarter to just add a try/catch in the foreach and emit a brief console message (instead of aborting) everything, WDYT?