pgvector / pgvector-php

pgvector support for PHP
MIT License
121 stars 7 forks source link

fix(migration): Fix imports in default migration #2

Closed C0chett0 closed 1 year ago

ankane commented 1 year ago

Hi @C0chett0, can you give some context on this change?

C0chett0 commented 1 year ago

Hi.

Sure !

In the default migration file you import both Illuminate\Database\Schema\Blueprint and Illuminate\Support\Facades\Schema which are both unused in the file. But not importing the Illuminate\Support\Facades\DB which is actually used, making the migration crash when trying to run it.

ankane commented 1 year ago

Thanks, can confirm those imports are unused.

Can you paste the error message and stack trace? DB seems to autoload for me on a fresh app.

C0chett0 commented 1 year ago

Well I'll be damned it is indeed autoloaded.

But both my IDE (VSCode with intelephense) and a few tools (phpstan and php-cs-fixer) still complain about the missing use when not present.

I let you decide if you want to remove the import since it runs fine without it. But my two cents would be to keep it since I (along with my friends VSCode, phpstan and php-cs-fixer) see it as a best practice to explicitly import needed classes.

ankane commented 1 year ago

Good to know, let's keep it.