Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updating function aggregate to return int too #1062

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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