Issues (46)

example/ExampleDao.php (1 issue)

1
<?php
2
3
use BMorais\Database\Crud;
4
use BMorais\Database\CrudBuilder;
5
6
class ExampleDao extends CrudBuilder {
7
8
9
    public function __construct()
10
    {
11
        $this->setTableName("EXAMPLE");
12
        $this->setClassModel("exampleModel");
13
    }
14
15
    public function findName(): array {
16
        $this->selectBuilder()
17
            ->where("NOME=?",["Joao"])
18
            ->orderBy("NOME")
19
            ->executeQuery()
20
            ->fetchArrayAssoc();
0 ignored issues
show
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return array. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
21
    }
22
}