Issues (1369)

classes/DBAL/TableSchema.php (2 issues)

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 \DBAL\db_mysql $db
13
   */
14
  protected $db;
15
16
  public $tableName = '';
17
18
  /**
19
   * @var DbFieldDescription[] $fields
20
   */
21
  public $fields = [];
22
  /**
23
   * @var DbIndexDescription[] $indexesObject
24
   */
25
  public $indexes = [];
26
  /**
27
   * @var \array[] $constraints
28
   */
29
  public $constraints = [];
30
31
  /**
32
   * TableSchema constructor.
33
   *
34
   * @param string $tableName
35
   * @param Schema $dbSchema
36
   */
37
  public function __construct($tableName, Schema $dbSchema) {
38
    $this->db = $dbSchema->getDb();
39
40
    $this->tableName = $tableName;
41
42
    $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<mixed,array> is incompatible with the declared type DBAL\DbFieldDescription[] 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...
43
    $this->indexes     = $this->db->mysql_get_indexes($this->tableName);
44
    $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<mixed,array> is incompatible with the declared type 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...
45
  }
46
47
  public function isFieldExists($field) {
48
    return isset($this->fields[$field]);
49
  }
50
51
  public function isIndexExists($index) {
52
    return isset($this->indexes[$index]);
53
  }
54
55
  public function isConstrainExists($index) {
56
    return isset($this->constraints[$index]);
57
  }
58
59
}
60