Larastan: Unsupported field type: CLOB

Recently I upgraded the Composer dependencies on one of our Laravel projects, all the tests passed but the phpstan/larastan abruptly failed:

Some parallel worker jobs have not finished. while running parallel worker

Not very helpful. Running again with --debug:

...
/app/Http/Middleware/TrustProxies.php
/app/Http/Controllers/Controller.php
/app/Http/Kernel.php
/app/Providers/AuthServiceProvider.php
Unsupported field type: CLOB

Well that's something to go on at least. Searching the Larastan issue tracker for the exact error message didn't return anything but searching for "Unsupported field type" returned a similar issue for UUID fields. This pointed the finger at the iamcal/sql-parser dependency introduced in v3.2.0/v2.10.0. This change meant that when larastan scanned squashed migration files to get the database structures it would fail for non-MySQL dialects like SQLite and Postgres. Most of the syntax is the same between them but there were outliers like UUID and CLOB.

In out case the fix was simple, we just needed to replace the CLOB column types in the sqlite SQL with text

 

Why did they change?

Larastan moved away from more complete phpmyadmin/sql-parser package due to concerns around it using a 'viral' licence, it seems phpmyadmin is interested in re-licencing however progress seems slow:

Popular Reads

Subscribe

Keep up to date

Please provide your email address
Please provide your name
Please provide your name
No thanks