PHPStan issue with where() method
odan opened this issue · 3 comments
Hi!
I have an issue with PHPStan in combination with the where method and the variable-length argument lists.
Example code:
$query = new QueryFactory('mysql');
$select = $query->newSelect();
$select->cols(['*'])->from('users')->where('id = ?', 1);
PHPStan output:
[exec] 118 Method Aura\SqlQuery\Common\WhereInterface::where() invoked with 2
[exec] parameters, 1 required.
The same issue with scrutinizer-ci:
$update->where("$key = ?", $value);
> Unused Code: The call to UpdateInterface::where() has too many arguments starting with $value.
$delete->where("$key = ?", $value);
> Unused Code: The call to DeleteInterface::where() has too many arguments starting with $value.
The current signature of the where
method in the WhereInterface
is defined like this:
interface WhereInterface
{
public function where($cond);
PHP has support for variable-length argument lists in user-defined functions. This is implemented using the ...
token in PHP 5.6 and later.
Possible fix:
interface WhereInterface
{
public function where(...$cond);
- Question: Would it be possible to update the required PHP version from 5.3.9 to 5.6 (or better 7.x)?
- Question: Would it be possible to add the
...
token to allwhere
methods?
Sorry that the issue was missed by me.
Regarding your questions : All are BC breaks. Also there will be no longer another version of this library. Please see https://github.com/atlasphp or newer versions, if you are interested.
Okay, good to know. You should let others know that this library is no longer actively maintained.