Issue #3316198 by mondrake: Fix Database\Schema PHPStan-0 issues
parent
428d60ecad
commit
c42342d31c
|
@ -605,6 +605,8 @@ abstract class Schema implements PlaceholderInterface {
|
|||
*
|
||||
* @throws \Drupal\Core\Database\SchemaObjectExistsException
|
||||
* If the specified table already exists.
|
||||
* @throws \BadMethodCallException
|
||||
* When ::createTableSql() is not implemented in the concrete driver class.
|
||||
*/
|
||||
public function createTable($name, $table) {
|
||||
if ($this->tableExists($name)) {
|
||||
|
@ -616,6 +618,32 @@ abstract class Schema implements PlaceholderInterface {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate SQL to create a new table from a Drupal schema definition.
|
||||
*
|
||||
* This method should be implemented in extending classes.
|
||||
*
|
||||
* @param string $name
|
||||
* The name of the table to create.
|
||||
* @param array $table
|
||||
* A Schema API table definition array.
|
||||
*
|
||||
* @return array
|
||||
* An array of SQL statements to create the table.
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
* If the method is not implemented in the concrete driver class.
|
||||
*
|
||||
* @todo This method is called by Schema::createTable on the abstract class, and
|
||||
* therefore should be defined as well on the abstract class to prevent static
|
||||
* analysis errors. In D11, consider changing it to an abstract method, or to
|
||||
* make it private for each driver, and ::createTable actually an abstract
|
||||
* method here for implementation in each driver.
|
||||
*/
|
||||
protected function createTableSql($name, $table) {
|
||||
throw new \BadMethodCallException(get_class($this) . '::createTableSql() not implemented.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of field names from an array of key/index column specifiers.
|
||||
*
|
||||
|
|
|
@ -81,15 +81,7 @@ class Schema extends DatabaseSchema {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generate SQL to create a new table from a Drupal schema definition.
|
||||
*
|
||||
* @param $name
|
||||
* The name of the table to create.
|
||||
* @param $table
|
||||
* A Schema API table definition array.
|
||||
*
|
||||
* @return string[]
|
||||
* An array of SQL statements to create the table.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function createTableSql($name, $table) {
|
||||
$info = $this->connection->getConnectionOptions();
|
||||
|
|
|
@ -271,15 +271,7 @@ EOD;
|
|||
}
|
||||
|
||||
/**
|
||||
* Generate SQL to create a new table from a Drupal schema definition.
|
||||
*
|
||||
* @param string $name
|
||||
* The name of the table to create.
|
||||
* @param array $table
|
||||
* A Schema API table definition array.
|
||||
*
|
||||
* @return array
|
||||
* An array of SQL statements to create the table.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function createTableSql($name, $table) {
|
||||
$sql_fields = [];
|
||||
|
|
|
@ -44,15 +44,7 @@ class Schema extends DatabaseSchema {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generate SQL to create a new table from a Drupal schema definition.
|
||||
*
|
||||
* @param $name
|
||||
* The name of the table to create.
|
||||
* @param $table
|
||||
* A Schema API table definition array.
|
||||
*
|
||||
* @return array
|
||||
* An array of SQL statements to create the table.
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createTableSql($name, $table) {
|
||||
if (!empty($table['primary key']) && is_array($table['primary key'])) {
|
||||
|
|
|
@ -160,11 +160,6 @@ parameters:
|
|||
count: 1
|
||||
path: lib/Drupal/Core/Database/Query/Merge.php
|
||||
|
||||
-
|
||||
message: "#^Call to an undefined method Drupal\\\\Core\\\\Database\\\\Schema\\:\\:createTableSql\\(\\)\\.$#"
|
||||
count: 1
|
||||
path: lib/Drupal/Core/Database/Schema.php
|
||||
|
||||
-
|
||||
message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:10\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#"
|
||||
count: 2
|
||||
|
|
Loading…
Reference in New Issue