database icon indicating copy to clipboard operation
database copied to clipboard

Selection::getPreviousAccessedColumns invalid return annotation

Open hranicka opened this issue 8 years ago • 0 comments

  • bug report? yes
  • feature request? no
  • version: v2.4.2/v3.0.0-alpha

Description

\Nette\Database\Table\SqlBuilder::buildSelectQuery accepts array only or nullable since 14506d0/v2.4.2/v3.0.0-alpha [blame].

It's called internally and gets a value returned e.g. from \Nette\Database\Table\Selection::getPreviousAccessedColumns [link]. And this method returns array (it's OK) but can return bool too (and it's not OK then). See @return annotation of that function.

It seems the annotation is wrong because default (and the one) implementation will return always an array.

I have a problem when I use an overridden \Nette\Database\Table\Selection.

It was OK prior to 14506d0/v2.4.2/v3.0.0-alpha. Since those versions I get Argument 1 passed to Nette\Database\Table\SqlBuilder::buildSelectQuery() must be of the type array, boolean given.

Solution

Fix annotation for v2.x, array return typehint for v3.x in \Nette\Database\Table\Selection::getPreviousAccessedColumns

It should always return an array. As of the default implementation.

hranicka avatar Feb 02 '17 09:02 hranicka