Issues (119)

src/Query/Truncate.php (1 issue)

1
<?php
2
3
namespace Nip\Database\Query;
4
5
/**
6
 * Class Truncate
7
 .
8
 */
9
class Truncate extends AbstractQuery
10
{
11
    /**
12
     * @return string
13
     */
14
    public function assemble()
15
    {
16
        return 'TRUNCATE TABLE ' . $this->getTable();
0 ignored issues
show
Bug Best Practice introduced by
The expression return 'TRUNCATE TABLE ' . $this->getTable() returns the type string which is incompatible with the return type mandated by Nip\Database\Query\AbstractQuery::assemble() of null.

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
17
    }
18
}
19