Installing `phpmyadmin/sql-parser` breaks squashed migration parsing
Author: FeBe95Created Jul 21, 2026Updated Jul 21, 2026
Labelsbug
- Larastan Version: 3.9.6
- Laravel Version: 12.64.0
Description
We installed phpmyadmin/sql-parser while working on a new feature in our project. Immediately afterwards, PHPStan started reporting more than 8,000 new errors.
After some debugging, we discovered that Larastan automatically uses phpmyadmin/sql-parser whenever it is installed. Unfortunately, if the parser fails to parse a schema dump, the exception is silently suppressed:
In our case, the schema dump was generated by MariaDB, and the parser throws the following exception:
The name of the CTE was expected.
Because the exception is swallowed, Larastan falls back to an incomplete state, resulting in a large number of seemingly unrelated analysis errors that are difficult to diagnose.
Proposed solution
- Add a configuration option to explicitly enable or disable the use of
phpmyadmin/sql-parser. This would allow projects to depend on the package for other purposes without Larastan automatically using it. - Surface the parser exception as an analysis error (or otherwise report it) instead of suppressing it silently. This would make the root cause much easier to identify.
Source: larastan/larastan