Test Failed
Branch trunk (412648)
by SuperNova.WS
03:40
created

TableSchema::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 2
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by Gorlum 19.06.2017 15:21
4
 */
5
6
namespace DBAL;
7
8
9
class TableSchema {
10
11
  /**
12
   * @var \db_mysql $db
13
   */
14
  protected $db;
15
16
  /**
17
   * @var Schema $dbSchema
18
   */
19
  protected $dbSchema;
20
21
  public $tableName = '';
22
23
  /**
24
   * @var \array[] $fields
25
   */
26
  public $fields;
27
  /**
28
   * @var \array[] $indexes
29
   */
30
  public $indexes;
31
  /**
32
   * @var \array[] $constraints
33
   */
34
  public $constraints;
35
36
  /**
37
   * TableSchema constructor.
38
   *
39
   * @param string         $tableName
40
   * @param \db_mysql|null $db
0 ignored issues
show
Bug introduced by
There is no parameter named $db. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
41
   */
42
  public function __construct($tableName, Schema $dbSchema) {
43
    $this->dbSchema = $dbSchema;
44
    $this->tableName = $tableName;
45
46
    $this->db = $this->dbSchema->getDb();
47
48
    $this->fields = $this->db->mysql_get_fields($this->tableName);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->db->mysql_get_fields($this->tableName) of type array<integer,array> is incompatible with the declared type array<integer,object<array>> of property $fields.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
49
    $this->indexes = $this->db->mysql_get_indexes($this->tableName);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->db->mysql_get_indexes($this->tableName) of type array<integer,array> is incompatible with the declared type array<integer,object<array>> of property $indexes.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
50
    $this->constraints = $this->db->mysql_get_constraints($this->tableName);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->db->mysql_get_con...aints($this->tableName) of type array<integer,array> is incompatible with the declared type array<integer,object<array>> of property $constraints.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
51
  }
52
53
}
54