Completed
Push — master ( 55b21a...aec22b )
by Thomas
06:20
created

ConstantBuilder   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 12
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 6 1
1
<?php
2
namespace gossi\codegen\generator\builder;
3
4
use gossi\codegen\model\AbstractModel;
5
use gossi\codegen\generator\builder\parts\ValueBuilderPart;
6
7
class ConstantBuilder extends AbstractBuilder {
8
	
9
	use ValueBuilderPart;
10
	
11 3
	public function build(AbstractModel $model) {
12 3
		$this->buildDocblock($model);
1 ignored issue
show
Documentation introduced by
$model is of type object<gossi\codegen\model\AbstractModel>, but the function expects a object<gossi\codegen\model\DocblockInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
13 3
		$this->writer->write('const ' . $model->getName() . ' = ');
14 3
		$this->writeValue($model);
1 ignored issue
show
Documentation introduced by
$model is of type object<gossi\codegen\model\AbstractModel>, but the function expects a object<gossi\codegen\model\ValueInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
15 3
		$this->writer->writeln(';');
16 3
	}
17
18
}