Truncate::assemble()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 1
cp 0
crap 2
rs 10
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