Closed jakubvojacek closed 1 year ago
hey,
thx for asking. for SQL AST to work you need to enable it in your phpstan-dba-bootstrap
via RuntimeConfiguration
after thats done and you are using mysql it should work for select count(*) from xx
.
I would love someone doing more testing with it.
such as
CROSS join
or queries with subqueries.
I have open todos regarding joins, which I have expressed here https://github.com/staabm/phpstan-dba/issues/527 if you have concrete examples and concrete expectations - at best already in form of a unit test - that would be really awesome.
But I also tested with simple
select count(*) from xx
and I didnt get aRangeIntegerType
please provide a reproducing case. see https://github.com/staabm/phpstan-dba/blob/main/tests/default/data/sql-ast-narrowing.php for all already existing test-cases
you need to enable it in your phpstan-dba-bootstrap
yeah, I did that
please provide a reproducing case.
will try, perhaps I am still missunderstanding some parts of it and coming up with repro case will help me understand.
Thanks :+1:
Hello @staabm
how far advanced do you think the analysis is, should we start reporting issues? I get errors thrown on some more non-standard queries, such as
CROSS join
or queries with subqueries.But I also tested with simple
select count(*) from xx
and I didnt get aRangeIntegerType
. I tried digging deeper and found that it never got past this condition https://github.com/staabm/phpstan-dba/blob/main/src/SqlAst/ParserInference.php#L102 ($valueType
wasmin: 0, max: null
but it was not merged to$resultType
due tohasOffsetValueType === false
)I am not sure I understand all the parts of the code to start sending PRs though.
Thanks