Completed
Push — master ( 928248...a75adc )
by Wilmer
14s queued 11s
created

ProfileWithConstructor::tableName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\ActiveRecord\Tests\Stubs\ActiveRecord;
6
7
use Yiisoft\ActiveRecord\ActiveRecord;
8
9
/**
10
 * ProfileWithConstructor.
11
 *
12
 * @property int $id
13
 * @property string $description
14
 */
15
class ProfileWithConstructor extends ActiveRecord
16
{
17
    public static function tableName(): string
18
    {
19
        return 'profile';
20
    }
21
22
    public function __construct($description)
23
    {
24
        $this->description = $description;
25
        parent::__construct();
0 ignored issues
show
Bug introduced by
The method __construct() does not exist on Yiisoft\ActiveRecord\ActiveRecord. It seems like you code against a sub-type of Yiisoft\ActiveRecord\ActiveRecord such as Yiisoft\ActiveRecord\Tes...rd\OrderWithConstructor or Yiisoft\ActiveRecord\Tes...ubs\ActiveRecord\Animal or Yiisoft\ActiveRecord\Tes...CustomerWithConstructor or Yiisoft\ActiveRecord\Tes...\ProfileWithConstructor or Yiisoft\ActiveRecord\Tes...rderItemWithConstructor. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
        parent::/** @scrutinizer ignore-call */ 
26
                __construct();
Loading history...
26
    }
27
28
    public static function instance($refresh = false): ActiveRecord
0 ignored issues
show
Unused Code introduced by
The parameter $refresh is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

28
    public static function instance(/** @scrutinizer ignore-unused */ $refresh = false): ActiveRecord

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
        return self::instantiate([]);
31
    }
32
33
    public static function instantiate($row): ActiveRecord
34
    {
35
        return (new \ReflectionClass(static::class))->newInstanceWithoutConstructor();
36
    }
37
}
38