This commit is contained in:
2020-12-17 14:12:44 +08:00
parent 9516baef92
commit 33e5416dda
38 changed files with 100 additions and 101 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ namespace Database\Base;
use ArrayIterator;
use Database\ActiveQuery;
use JetBrains\PhpStorm\Pure;
use ReflectionException;
use Snowflake\Abstracts\Component;
use Database\ActiveRecord;
@@ -55,7 +55,7 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
/**
* @return int
*/
#[Pure] public function getLength(): int
public function getLength(): int
{
return count($this->_item);
}
+4 -5
View File
@@ -11,7 +11,6 @@ namespace Database;
use Database\Base\AbstractCollection;
use Exception;
use JetBrains\PhpStorm\Pure;
/**
* Class Collection
@@ -80,7 +79,7 @@ class Collection extends AbstractCollection
*
* @return array
*/
#[Pure] public function slice($start = 0, $length = 20): array
public function slice($start = 0, $length = 20): array
{
if (empty($this->_item) || !is_array($this->_item)) {
return [];
@@ -128,7 +127,7 @@ class Collection extends AbstractCollection
/**
* @return ActiveRecord|array
*/
#[Pure] public function current(): ActiveRecord|array
public function current(): ActiveRecord|array
{
return current($this->_item);
}
@@ -136,7 +135,7 @@ class Collection extends AbstractCollection
/**
* @return int
*/
#[Pure] public function size(): int
public function size(): int
{
return (int)count($this->_item);
}
@@ -240,7 +239,7 @@ class Collection extends AbstractCollection
/**
* @return bool
*/
#[Pure] public function isEmpty(): bool
public function isEmpty(): bool
{
return $this->size() < 1;
}
+2 -2
View File
@@ -7,7 +7,7 @@ namespace Database\Condition;
use Database\ActiveQuery;
use Database\Base\ConditionClassMap;
use Exception;
use JetBrains\PhpStorm\Pure;
use Snowflake\Core\Str;
use Snowflake\Snowflake;
@@ -59,7 +59,7 @@ class ArrayCondition extends Condition
* @param $value
* @return bool
*/
#[Pure] private function isMath($value): bool
private function isMath($value): bool
{
return isset($value[0]) && in_array($value[0], $this->math);
}
+2 -2
View File
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Database\Condition;
use JetBrains\PhpStorm\Pure;
use Snowflake\Abstracts\BaseObject;
use Snowflake\Core\Str;
@@ -127,7 +127,7 @@ abstract class Condition extends BaseObject
* @param string $oprea
* @return string
*/
#[Pure] public function typeBuilder($column, $value = null, $oprea = '='): string
public function typeBuilder($column, $value = null, $oprea = '='): string
{
if (is_numeric($value)) {
if ($value != (int)$value) {
+2 -2
View File
@@ -11,7 +11,7 @@ declare(strict_types=1);
namespace Database;
use JetBrains\PhpStorm\Pure;
use ReflectionException;
use Snowflake\Abstracts\Component;
use Database\Mysql\Schema;
@@ -152,7 +152,7 @@ class Connection extends Component
* @param $sql
* @return bool
*/
#[Pure] public function isWrite($sql): bool
public function isWrite($sql): bool
{
if (empty($sql)) return false;
+6 -6
View File
@@ -11,7 +11,7 @@ declare(strict_types=1);
namespace Database\Mysql;
use JetBrains\PhpStorm\Pure;
use Snowflake\Abstracts\Component;
use Database\Connection;
use Exception;
@@ -163,7 +163,7 @@ class Columns extends Component
* @param $format
* @return bool
*/
#[Pure] public function isInt($format): bool
public function isInt($format): bool
{
return in_array($format, ['int', 'bigint', 'tinyint', 'smallint', 'mediumint']);
}
@@ -172,7 +172,7 @@ class Columns extends Component
* @param $format
* @return bool
*/
#[Pure] public function isFloat($format): bool
public function isFloat($format): bool
{
return in_array($format, ['float', 'double', 'decimal']);
}
@@ -181,7 +181,7 @@ class Columns extends Component
* @param $format
* @return bool
*/
#[Pure] public function isJson($format): bool
public function isJson($format): bool
{
return in_array($format, ['json']);
}
@@ -190,7 +190,7 @@ class Columns extends Component
* @param $format
* @return bool
*/
#[Pure] public function isString($format): bool
public function isString($format): bool
{
return in_array($format, ['varchar', 'char', 'text', 'longtext', 'tinytext', 'mediumtext']);
}
@@ -232,7 +232,7 @@ class Columns extends Component
*
* @throws Exception
*/
#[Pure] public function getFirstPrimary(): array|string|null
public function getFirstPrimary(): array|string|null
{
if (isset($this->_auto_increment[$this->table])) {
return $this->_auto_increment[$this->table];
+2 -2
View File
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Database\Orm;
use JetBrains\PhpStorm\Pure;
use Snowflake\Abstracts\BaseObject;
use Database\ActiveQuery;
use Exception;
@@ -206,7 +206,7 @@ class Change extends BaseObject
* @return string
* 构建SQL语句
*/
#[Pure] private function inserts($table, $fields, $data): string
private function inserts($table, $fields, $data): string
{
$query = [
'INSERT IGNORE INTO', '%s', '(%s)', 'VALUES %s'
+2 -2
View File
@@ -3,7 +3,7 @@ declare(strict_types=1);
namespace Database\Orm;
use JetBrains\PhpStorm\Pure;
use ReflectionException;
use Snowflake\Core\JSON;
use Snowflake\Core\Str;
@@ -61,7 +61,7 @@ trait Condition
* @param $join
* @return string
*/
#[Pure] private function builderJoin($join): string
private function builderJoin($join): string
{
if (!empty($join)) {
return ' ' . implode(' ', $join);
+2 -2
View File
@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Database\Orm;
use JetBrains\PhpStorm\Pure;
use Snowflake\Abstracts\BaseObject;
use Database\ActiveQuery;
use Database\Sql;
@@ -79,7 +79,7 @@ class Select extends BaseObject
* @param bool $isCount
* @return string
*/
#[Pure] private function builderSelect($select = NULL, $isCount = false): string
private function builderSelect($select = NULL, $isCount = false): string
{
if ($isCount === true) {
return 'SELECT COUNT(*)';