Upgrade to PSR12 coding standard (#20121)

This commit is contained in:
Razvan Grigore
2024-03-19 16:21:27 +02:00
committed by GitHub
parent b0aa6ab852
commit e2a167028b
521 changed files with 1055 additions and 2409 deletions

View File

@ -1,4 +1,5 @@
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC

View File

@ -1,4 +1,5 @@
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC

View File

@ -1,4 +1,5 @@
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC

View File

@ -1,4 +1,5 @@
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
@ -266,7 +267,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
$columns = [reset($tableSchema->columns)->name];
$defaultValue = 'DEFAULT';
}
foreach ($columns as $name) {
$names[] = $this->db->quoteColumnName($name);
$placeholders[] = $defaultValue;
@ -312,8 +313,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
public function addCommentOnColumn($table, $column, $comment)
{
// Strip existing comment which may include escaped quotes
$definition = trim(preg_replace("/COMMENT '(?:''|[^'])*'/i", '',
$this->getColumnDefinition($table, $column)));
$definition = trim(preg_replace("/COMMENT '(?:''|[^'])*'/i", '', $this->getColumnDefinition($table, $column)));
$checkRegex = '/CHECK *(\(([^()]|(?-2))*\))/';
$check = preg_match($checkRegex, $definition, $checkMatches);

View File

@ -1,4 +1,5 @@
<?php
/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
@ -301,9 +302,11 @@ SQL;
*
* See details here: https://mariadb.com/kb/en/library/now/#description
*/
if (in_array($column->type, ['timestamp', 'datetime', 'date', 'time'])
if (
in_array($column->type, ['timestamp', 'datetime', 'date', 'time'])
&& isset($info['default'])
&& preg_match('/^current_timestamp(?:\(([0-9]*)\))?$/i', $info['default'], $matches)) {
&& preg_match('/^current_timestamp(?:\(([0-9]*)\))?$/i', $info['default'], $matches)
) {
$column->defaultValue = new Expression('CURRENT_TIMESTAMP' . (!empty($matches[1]) ? '(' . $matches[1] . ')' : ''));
} elseif (isset($type) && $type === 'bit') {
$column->defaultValue = bindec(trim(isset($info['default']) ? $info['default'] : '', 'b\''));