mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-23 08:35:35 +08:00
Merge pull request #126 from zhamao-robot/add-phpstan-extensions
添加 PHPStan 相关扩展
This commit is contained in:
@@ -36,7 +36,10 @@
|
|||||||
"brainmaestro/composer-git-hooks": "^2.8",
|
"brainmaestro/composer-git-hooks": "^2.8",
|
||||||
"friendsofphp/php-cs-fixer": "^3.2 != 3.7.0",
|
"friendsofphp/php-cs-fixer": "^3.2 != 3.7.0",
|
||||||
"jetbrains/phpstorm-attributes": "^1.0",
|
"jetbrains/phpstorm-attributes": "^1.0",
|
||||||
|
"phpstan/extension-installer": "^1.1",
|
||||||
"phpstan/phpstan": "^1.1",
|
"phpstan/phpstan": "^1.1",
|
||||||
|
"phpstan/phpstan-deprecation-rules": "^1.0",
|
||||||
|
"phpstan/phpstan-phpunit": "^1.1",
|
||||||
"phpunit/phpunit": "^8.5 || ^9.0",
|
"phpunit/phpunit": "^8.5 || ^9.0",
|
||||||
"roave/security-advisories": "dev-latest",
|
"roave/security-advisories": "dev-latest",
|
||||||
"swoole/ide-helper": "^4.5"
|
"swoole/ide-helper": "^4.5"
|
||||||
@@ -72,7 +75,10 @@
|
|||||||
],
|
],
|
||||||
"config": {
|
"config": {
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
"sort-packages": true
|
"sort-packages": true,
|
||||||
|
"allow-plugins": {
|
||||||
|
"phpstan/extension-installer": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ parameters:
|
|||||||
paths:
|
paths:
|
||||||
- ./src/
|
- ./src/
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
- '#Used constant OS_TYPE_(LINUX|WINDOWS) not found#'
|
|
||||||
- '#Constant .* not found#'
|
- '#Constant .* not found#'
|
||||||
- '#PHPDoc tag @throws with type Psr\\Container\\ContainerExceptionInterface is not subtype of Throwable#'
|
- '#PHPDoc tag @throws with type Psr\\Container\\ContainerExceptionInterface is not subtype of Throwable#'
|
||||||
- '#Unsafe usage of new static#'
|
- '#Unsafe usage of new static#'
|
||||||
|
- '#Call to method initTableList\(\) of deprecated class ZM\\DB\\DB#'
|
||||||
dynamicConstantNames:
|
dynamicConstantNames:
|
||||||
- SWOOLE_VERSION
|
- SWOOLE_VERSION
|
||||||
- ZM_TEST_LOG_DEBUG
|
- ZM_TEST_LOG_DEBUG
|
||||||
|
|||||||
@@ -663,7 +663,7 @@ trait ContainerTrait
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// 尝试解析
|
// 尝试解析
|
||||||
return $this->make($parameter->getClass()->name);
|
return $this->make(ReflectionUtil::getParameterClassName($parameter));
|
||||||
} catch (EntryResolutionException $e) {
|
} catch (EntryResolutionException $e) {
|
||||||
// 如果参数是可选的,则返回默认值
|
// 如果参数是可选的,则返回默认值
|
||||||
if ($parameter->isDefaultValueAvailable()) {
|
if ($parameter->isDefaultValueAvailable()) {
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ declare(strict_types=1);
|
|||||||
namespace ZM\MySQL;
|
namespace ZM\MySQL;
|
||||||
|
|
||||||
use Doctrine\DBAL\Driver\Statement;
|
use Doctrine\DBAL\Driver\Statement;
|
||||||
use Doctrine\DBAL\Driver\StatementIterator;
|
|
||||||
use Doctrine\DBAL\ParameterType;
|
use Doctrine\DBAL\ParameterType;
|
||||||
use IteratorAggregate;
|
use IteratorAggregate;
|
||||||
use PDO;
|
use PDO;
|
||||||
use PDOStatement;
|
use PDOStatement;
|
||||||
|
use Traversable;
|
||||||
|
|
||||||
class MySQLStatement implements IteratorAggregate, Statement
|
class MySQLStatement implements IteratorAggregate, Statement
|
||||||
{
|
{
|
||||||
@@ -102,9 +102,11 @@ class MySQLStatement implements IteratorAggregate, Statement
|
|||||||
return $this->statement->rowCount();
|
return $this->statement->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIterator(): StatementIterator
|
public function getIterator(): Traversable
|
||||||
{
|
{
|
||||||
return new StatementIterator($this);
|
while (($result = $this->statement->fetch()) !== false) {
|
||||||
|
yield $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user