Skip to content

Conversation

@manofstrong
Copy link

@manofstrong manofstrong commented Sep 13, 2022

Running function count at the moment returns this fatal error:

string 'Medoo\Medoo::aggregate(): Return value must be of type ?string, int returned' 

This is caused by private function aggregate requiring a string return:

private function aggregate(string $type, string $table, $join = null, $column = null, $where = null): ?string

while public function count returns (and requires the return of ) an int type

public function count(string $table, $join = null, $column = null, $where = null): ?int
   {
        return (int) $this->aggregate('COUNT', $table, $join, $column, $where);
  }

my solution here is adding int return to private function aggregate

private function aggregate(string $type, string $table, $join = null, $column = null, $where = null): null|string|int

private function aggregate returning only string or null in strict mode is causing  public function count to return a fatal error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant