nette / database

💾 A database layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.
https://doc.nette.org/database
Other
492 stars 105 forks source link

Improved phpstan phpDoc #271

Closed lulco closed 3 years ago

lulco commented 3 years ago

This change could help developers using nette/database with phpstan to avoid error "Negative offset or limit" thrown in drivers

dg commented 3 years ago

0 is accepted to and is not positive.

lulco commented 3 years ago

hm why would I do query with limit 0?

MartinMystikJonas commented 3 years ago

LIMIT 0 quickly returns an empty set. This can be useful for checking the validity of a query. It can also be employed to obtain the types of the result columns if you are using a MySQL API that makes result set metadata available.

https://dev.mysql.com/doc/refman/5.7/en/limit-optimization.html

lulco commented 3 years ago

OK, so I've added 0, now it is positive-int|0

lulco commented 3 years ago

@dg any other problem here? I resolved your objection, so if it will not be accepted because whatever reason, please say it :) I will try to add this check to phpstan-nette stubs

dg commented 3 years ago

Well, there are no @phpstan-param annotations in the framework and I'm not sure if this is such an important thing to add it.

lulco commented 3 years ago

OK, I understand, but this is something you could write week ago :)