Cphalcon: Incorrect DocBlock and Signature return hint for Collection::count()

Created on 10 Sep 2017  路  2Comments  路  Source: phalcon/cphalcon

Questions should go to https://forum.phalconphp.com
Documentation issues should go to https://github.com/phalcon/docs/issues

Expected and Actual Behavior

I expected an array because the doc block has array as the return type:

    public static function count(array parameters = null) -> array

This line can be found here: https://github.com/phalcon/cphalcon/blob/44ce3c6d5d00cfe0626ff09c0ce4b825e39389d0/phalcon/mvc/collection.zep#L1401

Describe what you are trying to achieve and what goes wrong.
Functionality-wise there is nothing wrong.

Provide minimal script to reproduce the issue

$data = RobotsCollection::count();
expect(gettype($data))->toBeAn('array');//fails for obvious reasons

Details

This is an issue with the docblock currently in master

bug medium

All 2 comments

Looks like at some point it did return an array but was fixed: https://github.com/phalcon/cphalcon/issues/348

https://github.com/phalcon/cphalcon/blob/44ce3c6d5d00cfe0626ff09c0ce4b825e39389d0/phalcon/mvc/collection.zep#L1401-L1411

static::_getGroupResultset returns an int but count is expecting to return an array

public static function count(array parameters = null) -> array
Signature of count should return -> int

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dimak08 picture dimak08  路  3Comments

TimurFlush picture TimurFlush  路  3Comments

mynameisbogdan picture mynameisbogdan  路  3Comments

fonqing picture fonqing  路  3Comments

linxlad picture linxlad  路  3Comments