diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bd04f3090..0faed432c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,8 @@ name: build +permissions: + contents: read + on: pull_request: paths-ignore: &ignore-paths diff --git a/Makefile b/Makefile index beb3bc7a8..f90e968dd 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ static-analyze: ## Run code static analyze. Params: {{ v=8.3 }}. Default latest make down clean: - docker compose down + make down rm -rf tests/runtime/* rm -rf composer.lock rm -rf vendor/ diff --git a/docker-compose.yml b/docker-compose.yml index b88aa4e16..3f306ac95 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -63,7 +63,6 @@ services: # https://hub.docker.com/_/mysql/ mysql: image: mysql:5.7.44 - platform: linux/amd64 ports: - "3307:3306" environment: diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 69ce97708..287583f1d 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,922 +1,22 @@ parameters: ignoreErrors: - - message: '#^Class yii\\queue\\LogBehavior extends generic class yii\\base\\Behavior but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: src/LogBehavior.php - - - - message: '#^Method yii\\queue\\LogBehavior\:\:events\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/LogBehavior.php - - - - message: '#^Method yii\\queue\\Queue\:\:unserializeMessage\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Queue.php - - - - message: '#^Property yii\\queue\\Queue\:\:\$serializer type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/Queue.php - - - - message: '#^Class yii\\queue\\cli\\Action extends generic class yii\\base\\Action but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: src/cli/Action.php - - - - message: '#^Instanceof between yii\\queue\\cli\\Queue and yii\\queue\\cli\\Queue will always evaluate to true\.$#' - identifier: instanceof.alwaysTrue - count: 1 - path: src/cli/Action.php - - - - message: '#^Parameter \#1 \$callback of function call_user_func_array expects callable\(\)\: mixed, array\{yii\\base\\Controller, ''ansiFormat''\} given\.$#' - identifier: argument.type - count: 1 - path: src/cli/Action.php - - - - message: '#^Property yii\\queue\\cli\\Action\:\:\$controller with generic class yii\\base\\Controller does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: src/cli/Action.php - - - - message: '#^Class yii\\queue\\cli\\Command extends generic class yii\\console\\Controller but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: src/cli/Command.php - - - - message: '#^Method yii\\queue\\cli\\Command\:\:optionAliases\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/cli/Command.php - - - - message: '#^Parameter \#2 \$message of method yii\\queue\\cli\\Queue\:\:execute\(\) expects string, string\|false given\.$#' - identifier: argument.type - count: 1 - path: src/cli/Command.php - - - - message: '#^Property yii\\queue\\cli\\Command\:\:\$verboseConfig type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/cli/Command.php - - - - message: '#^Variable \$_ENV in isset\(\) always exists and is not nullable\.$#' - identifier: isset.variable - count: 1 - path: src/cli/Command.php - - - - message: '#^PHPDoc tag @property for property yii\\queue\\cli\\InfoAction\:\:\$controller contains generic class yii\\console\\Controller but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: src/cli/InfoAction.php - - - - message: '#^Parameter \#1 \$type of static method yii\\BaseYii\\:\:createObject\(\) expects array\{class\?\: class\-string\, __class\?\: class\-string\\}\|\(callable\(\)\: mixed\)\|class\-string\, array\|string given\.$#' - identifier: argument.type - count: 1 - path: src/cli/Queue.php - - - - message: '#^Property yii\\queue\\cli\\Queue\:\:\$commandOptions type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/cli/Queue.php - - - - message: '#^Property yii\\queue\\cli\\Queue\:\:\$loopConfig type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/cli/Queue.php - - - - message: '#^Property yii\\queue\\cli\\Queue\:\:\$workerPid \(int\|null\) does not accept int\|false\.$#' - identifier: assign.propertyType - count: 1 - path: src/cli/Queue.php - - - - message: '#^Strict comparison using \=\=\= between null and null will always evaluate to true\.$#' - identifier: identical.alwaysTrue - count: 1 - path: src/cli/Queue.php - - - - message: '#^Unable to resolve the template type T in call to static method yii\\BaseYii\\:\:createObject\(\)$#' - identifier: argument.templateType - count: 1 - path: src/cli/Queue.php - - - - message: '#^Class yii\\queue\\cli\\VerboseBehavior extends generic class yii\\base\\Behavior but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: src/cli/VerboseBehavior.php - - - - message: '#^Method yii\\queue\\cli\\VerboseBehavior\:\:events\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/cli/VerboseBehavior.php - - - - message: '#^Property yii\\queue\\cli\\VerboseBehavior\:\:\$command with generic class yii\\console\\Controller does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: src/cli/VerboseBehavior.php - - - - message: '#^Class yii\\queue\\closure\\Behavior extends generic class yii\\base\\Behavior but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: src/closure/Behavior.php - - - - message: '#^Method yii\\queue\\closure\\Behavior\:\:events\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/closure/Behavior.php - - - - message: '#^Cannot access property \$data on array\\.$#' - identifier: property.nonObject - count: 2 - path: src/debug/Panel.php - - - - message: '#^Cannot call method getUrl\(\) on array\\.$#' - identifier: method.nonObject - count: 1 - path: src/debug/Panel.php - - - - message: '#^Method yii\\queue\\debug\\Panel\:\:getPushData\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/debug/Panel.php - - - - message: '#^PHPDoc tag @var for variable \$this has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 2 - path: src/debug/Panel.php - - - - message: '#^PHPDoc tag @var with type array\ is not subtype of native type \$this\(yii\\queue\\debug\\Panel\)\.$#' - identifier: varTag.nativeType - count: 2 - path: src/debug/Panel.php - - - - message: '#^Parameter \#3 \$context of method yii\\base\\View\:\:render\(\) expects object\|null, array\ given\.$#' - identifier: argument.type - count: 2 - path: src/debug/Panel.php - - - - message: '#^Property yii\\queue\\debug\\Panel\:\:\$jobs type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/debug/Panel.php - - - - message: '#^PHPDoc tag @var for variable \$jobs has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/debug/views/detail.php - - - - message: '#^Anonymous function never returns callable\(\)\: mixed so it can be removed from the return type\.$#' - identifier: return.unusedType - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^Callable callable\(\)\: mixed invoked with 1 parameter, 0 required\.$#' - identifier: arguments.count - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^Cannot call method bind\(\) on Interop\\Queue\\Context\|null\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^Cannot call method createMessage\(\) on Interop\\Queue\\Context\|null\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^Cannot call method createProducer\(\) on Interop\\Queue\\Context\|null\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^Cannot call method createQueue\(\) on Interop\\Queue\\Context\|null\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^Cannot call method createTopic\(\) on Interop\\Queue\\Context\|null\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^Cannot call method declareQueue\(\) on Interop\\Queue\\Context\|null\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^Cannot call method declareTopic\(\) on Interop\\Queue\\Context\|null\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^Comparison operation "\>\=" between 8 and 7 is always true\.$#' - identifier: greaterOrEqual.alwaysTrue - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^PHPDoc tag @var with type Interop\\Amqp\\AmqpConnectionFactory is not subtype of native type Enqueue\\AmqpBunny\\AmqpConnectionFactory\|Enqueue\\AmqpExt\\AmqpConnectionFactory\|Enqueue\\AmqpLib\\AmqpConnectionFactory\.$#' - identifier: varTag.nativeType - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^Property yii\\queue\\amqp_interop\\Queue\:\:\$queueOptionalArguments type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^Property yii\\queue\\amqp_interop\\Queue\:\:\$setMessageHeaders type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/amqp_interop/Queue.php - - - - message: '#^Argument of an invalid type Pheanstalk\\Values\\TubeStats supplied for foreach, only iterables are supported\.$#' - identifier: foreach.nonIterable - count: 1 - path: src/drivers/beanstalk/InfoAction.php - - - - message: '#^Method yii\\queue\\db\\Queue\:\:release\(\) has parameter \$payload with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/db/Queue.php - - - - message: '#^Method yii\\queue\\db\\Queue\:\:reserve\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/db/Queue.php - - - - message: '#^Property yii\\queue\\db\\Queue\:\:\$db type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/db/Queue.php - - - - message: '#^Property yii\\queue\\db\\Queue\:\:\$mutex type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/db/Queue.php - - - - message: '#^Access to an undefined property yii\\db\\Connection\:\:\$queue\.$#' - identifier: property.notFound - count: 12 - path: src/drivers/db/StatisticsProvider.php - - - - message: '#^PHPDoc tag @var with type yii\\db\\Connection is not subtype of native type \$this\(yii\\queue\\db\\StatisticsProvider\)\.$#' - identifier: varTag.nativeType - count: 4 - path: src/drivers/db/StatisticsProvider.php - - - - message: '#^Return type \(void\) of method yii\\queue\\db\\migrations\\M161119140200Queue\:\:down\(\) should be compatible with return type \(bool\) of method yii\\db\\MigrationInterface\:\:down\(\)$#' - identifier: method.childReturnType - count: 1 - path: src/drivers/db/migrations/M161119140200Queue.php - - - - message: '#^Return type \(void\) of method yii\\queue\\db\\migrations\\M161119140200Queue\:\:up\(\) should be compatible with return type \(bool\) of method yii\\db\\MigrationInterface\:\:up\(\)$#' - identifier: method.childReturnType - count: 1 - path: src/drivers/db/migrations/M161119140200Queue.php - - - - message: '#^Parameter \#3 \$type of method yii\\db\\Migration\:\:addColumn\(\) expects string, yii\\db\\ColumnSchemaBuilder given\.$#' - identifier: argument.type - count: 1 - path: src/drivers/db/migrations/M170307170300Later.php - - - - message: '#^Return type \(void\) of method yii\\queue\\db\\migrations\\M170307170300Later\:\:down\(\) should be compatible with return type \(bool\) of method yii\\db\\MigrationInterface\:\:down\(\)$#' - identifier: method.childReturnType - count: 1 - path: src/drivers/db/migrations/M170307170300Later.php - - - - message: '#^Return type \(void\) of method yii\\queue\\db\\migrations\\M170307170300Later\:\:up\(\) should be compatible with return type \(bool\) of method yii\\db\\MigrationInterface\:\:up\(\)$#' - identifier: method.childReturnType - count: 1 - path: src/drivers/db/migrations/M170307170300Later.php - - - - message: '#^Cannot access property \$driverName on array\|string\|yii\\db\\Connection\.$#' - identifier: property.nonObject - count: 2 - path: src/drivers/db/migrations/M170509001400Retry.php - - - - message: '#^Parameter \#3 \$type of method yii\\db\\Migration\:\:addColumn\(\) expects string, yii\\db\\ColumnSchemaBuilder given\.$#' - identifier: argument.type - count: 2 - path: src/drivers/db/migrations/M170509001400Retry.php - - - - message: '#^Return type \(void\) of method yii\\queue\\db\\migrations\\M170509001400Retry\:\:down\(\) should be compatible with return type \(bool\) of method yii\\db\\MigrationInterface\:\:down\(\)$#' - identifier: method.childReturnType - count: 1 - path: src/drivers/db/migrations/M170509001400Retry.php - - - - message: '#^Return type \(void\) of method yii\\queue\\db\\migrations\\M170509001400Retry\:\:up\(\) should be compatible with return type \(bool\) of method yii\\db\\MigrationInterface\:\:up\(\)$#' - identifier: method.childReturnType - count: 1 - path: src/drivers/db/migrations/M170509001400Retry.php - - - - message: '#^Parameter \#3 \$type of method yii\\db\\Migration\:\:addColumn\(\) expects string, yii\\db\\ColumnSchemaBuilder given\.$#' - identifier: argument.type - count: 1 - path: src/drivers/db/migrations/M170601155600Priority.php - - - - message: '#^Return type \(void\) of method yii\\queue\\db\\migrations\\M170601155600Priority\:\:down\(\) should be compatible with return type \(bool\) of method yii\\db\\MigrationInterface\:\:down\(\)$#' - identifier: method.childReturnType - count: 1 - path: src/drivers/db/migrations/M170601155600Priority.php - - - - message: '#^Return type \(void\) of method yii\\queue\\db\\migrations\\M170601155600Priority\:\:up\(\) should be compatible with return type \(bool\) of method yii\\db\\MigrationInterface\:\:up\(\)$#' - identifier: method.childReturnType - count: 1 - path: src/drivers/db/migrations/M170601155600Priority.php - - - - message: '#^Cannot access property \$driverName on array\|string\|yii\\db\\Connection\.$#' - identifier: property.nonObject - count: 2 - path: src/drivers/db/migrations/M211218163000JobQueueSize.php - - - - message: '#^Parameter \#3 \$type of method yii\\db\\Migration\:\:alterColumn\(\) expects string, yii\\db\\ColumnSchemaBuilder given\.$#' - identifier: argument.type - count: 1 - path: src/drivers/db/migrations/M211218163000JobQueueSize.php - - - - message: '#^Return type \(void\) of method yii\\queue\\db\\migrations\\M211218163000JobQueueSize\:\:down\(\) should be compatible with return type \(bool\) of method yii\\db\\MigrationInterface\:\:down\(\)$#' - identifier: method.childReturnType - count: 1 - path: src/drivers/db/migrations/M211218163000JobQueueSize.php - - - - message: '#^Return type \(void\) of method yii\\queue\\db\\migrations\\M211218163000JobQueueSize\:\:up\(\) should be compatible with return type \(bool\) of method yii\\db\\MigrationInterface\:\:up\(\)$#' - identifier: method.childReturnType - count: 1 - path: src/drivers/db/migrations/M211218163000JobQueueSize.php - - - - message: '#^Offset ''lastId'' on array\{lastId\: int\} on left side of \?\? always exists and is not nullable\.$#' - identifier: nullCoalesce.offset - count: 1 - path: src/drivers/file/InfoAction.php - - - - message: '#^PHPDoc tag @var for variable \$data has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 3 - path: src/drivers/file/InfoAction.php - - - - message: '#^Argument of an invalid type list\\|false supplied for foreach, only iterables are supported\.$#' - identifier: foreach.nonIterable - count: 1 - path: src/drivers/file/Queue.php - - - - message: '#^Method yii\\queue\\file\\Queue\:\:delete\(\) has parameter \$payload with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/file/Queue.php - - - - message: '#^Method yii\\queue\\file\\Queue\:\:reserve\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/file/Queue.php - - - - message: '#^Offset ''lastId'' on array\{lastId\: int, waiting\: array, delayed\: array\} in isset\(\) always exists and is not nullable\.$#' - identifier: isset.offset - count: 1 - path: src/drivers/file/Queue.php - - - - message: '#^PHPDoc tag @var for variable \$data has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 9 - path: src/drivers/file/Queue.php - - - - message: '#^PHPDoc tag @var for variable \$payload has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 5 - path: src/drivers/file/Queue.php - - - - message: '#^PHPDoc tag @var with type int\|string\|null is not subtype of native type int\.$#' - identifier: varTag.nativeType - count: 1 - path: src/drivers/file/Queue.php - - - - message: '#^Strict comparison using \!\=\= between false and string will always evaluate to true\.$#' - identifier: notIdentical.alwaysTrue - count: 1 - path: src/drivers/file/Queue.php - - - - message: '#^Variable \$data in PHPDoc tag @var does not match any variable in the foreach loop\: \$key, \$payload$#' - identifier: varTag.differentVariable - count: 1 - path: src/drivers/file/Queue.php - - - - message: '#^Method yii\\queue\\file\\StatisticsProvider\:\:getIndexData\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/drivers/file/StatisticsProvider.php - - - - message: '#^Offset ''lastId'' on array\{lastId\: int\} in isset\(\) always exists and is not nullable\.$#' - identifier: isset.offset - count: 1 - path: src/drivers/file/StatisticsProvider.php - - - - message: '#^PHPDoc tag @var for variable \$data has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 3 - path: src/drivers/file/StatisticsProvider.php - - - - message: '#^Cannot call method get\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/InfoAction.php - - - - message: '#^Cannot call method llen\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/InfoAction.php - - - - message: '#^Cannot call method zcount\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 2 - path: src/drivers/redis/InfoAction.php - - - - message: '#^Cannot call method brpop\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method executeCommand\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method hdel\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 4 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method hexists\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 2 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method hget\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method hincrby\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method hset\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method incr\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method keys\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method lpush\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method lrem\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method rpop\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method rpush\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method set\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 3 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method zadd\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 2 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method zrem\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 3 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method zremrangebyscore\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method zrevrangebyscore\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Method yii\\queue\\redis\\Queue\:\:reserve\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^PHPDoc tag @var for variable \$result has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Property yii\\queue\\redis\\Queue\:\:\$redis type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/redis/Queue.php - - - - message: '#^Cannot call method get\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/StatisticsProvider.php - - - - message: '#^Cannot call method llen\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: src/drivers/redis/StatisticsProvider.php - - - - message: '#^Cannot call method zcount\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 2 - path: src/drivers/redis/StatisticsProvider.php - - - - message: '#^Method yii\\queue\\sqs\\Payload\:\:__construct\(\) has parameter \$response with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/sqs/Payload.php - - - - message: '#^Offset ''Messages'' on array\{Messages\: array\} on left side of \?\? always exists and is not nullable\.$#' - identifier: nullCoalesce.offset - count: 1 - path: src/drivers/sqs/Payload.php - - - - message: '#^PHPDoc tag @var for variable \$message has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 2 - path: src/drivers/sqs/Payload.php - - - - message: '#^Property yii\\queue\\sqs\\Payload\:\:\$messages type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/sqs/Payload.php - - - - message: '#^PHPDoc tag @var for variable \$response has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/sqs/Queue.php - - - - message: '#^Property yii\\queue\\sqs\\Queue\:\:\$serializer type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/sqs/Queue.php - - - - message: '#^Property yii\\queue\\sync\\Queue\:\:\$payloads type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/drivers/sync/Queue.php - - - - message: '#^Method yii\\queue\\gii\\Generator\:\:hints\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/gii/Generator.php - - - - message: '#^Method yii\\queue\\gii\\Generator\:\:requiredTemplates\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/gii/Generator.php - - - - message: '#^Method yii\\queue\\gii\\Generator\:\:stickyAttributes\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/gii/Generator.php - - - - message: '#^Parameter \#1 \$array of function array_unique expects array, list\\|false given\.$#' - identifier: argument.type - count: 1 - path: src/gii/Generator.php - - - - message: '#^Strict comparison using \=\=\= between false and string will always evaluate to false\.$#' - identifier: identical.alwaysFalse - count: 1 - path: src/gii/Generator.php - - - - message: '#^PHPDoc tag @var with type string\|false\|null is not subtype of native type string\|null\.$#' - identifier: varTag.nativeType - count: 1 - path: src/serializers/IgbinarySerializer.php - - - - message: '#^Unable to resolve the template type T in call to static method yii\\BaseYii\\:\:createObject\(\)$#' - identifier: argument.templateType - count: 1 - path: src/serializers/JsonSerializer.php - - - - message: '#^Parameter \#1 \$filename of function file_put_contents expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/app/PriorityJob.php - - - - message: '#^Parameter \#1 \$filename of function file_put_contents expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/app/RetryJob.php - - - - message: '#^Parameter \#1 \$filename of function file_put_contents expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/app/SimpleJob.php - - - - message: '#^Class tests\\app\\benchmark\\Controller extends generic class yii\\console\\Controller but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: tests/app/benchmark/Controller.php - - - - message: '#^Class tests\\app\\benchmark\\waiting\\Action extends generic class yii\\base\\Action but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: tests/app/benchmark/waiting/Action.php - - - - message: '#^Method tests\\app\\benchmark\\waiting\\Action\:\:calcResult\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/app/benchmark/waiting/Action.php - - - - message: '#^Method tests\\app\\benchmark\\waiting\\Action\:\:startWorkers\(\) has parameter \$command with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/app/benchmark/waiting/Action.php - - - - message: '#^PHPDoc tag @throws has invalid value \(\)\: Unexpected token "\\n ", expected type at offset 313 on line 8$#' - identifier: phpDoc.parseError - count: 1 - path: tests/app/benchmark/waiting/Action.php - - - - message: '#^PHPDoc tag @var with type array\ is not subtype of native type list\\.$#' - identifier: varTag.nativeType - count: 1 - path: tests/app/benchmark/waiting/Action.php - - - - message: '#^Parameter \#1 \$string of function trim expects string, string\|false given\.$#' - identifier: argument.type - count: 1 - path: tests/app/benchmark/waiting/Action.php - - - - message: '#^Parameter \#1 \.\.\.\$arg1 of function max expects non\-empty\-array, list\ given\.$#' - identifier: argument.type - count: 1 - path: tests/app/benchmark/waiting/Action.php - - - - message: '#^Parameter \#1 \.\.\.\$arg1 of function min expects non\-empty\-array, list\ given\.$#' - identifier: argument.type - count: 1 - path: tests/app/benchmark/waiting/Action.php - - - - message: '#^Property tests\\app\\benchmark\\waiting\\Action\:\:\$modes type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/app/benchmark/waiting/Action.php - - - - message: '#^Access to constant ATTR_INIT_COMMAND on an unknown class Pdo\\Mysql\.$#' - identifier: class.notFound - count: 1 - path: tests/app/config/main.php - - - - message: '#^Comparison operation "\>\=" between \-1 and 0 is always false\.$#' - identifier: greaterOrEqual.alwaysFalse - count: 1 - path: tests/app/config/main.php - - - - message: '#^Argument of an invalid type list\\|false supplied for foreach, only iterables are supported\.$#' - identifier: foreach.nonIterable - count: 1 - path: tests/closure/ClosureTest.php - - - - message: '#^Property tests\\closure\\ClosureTest\:\:\$_queue has no type specified\.$#' - identifier: missingType.property - count: 1 - path: tests/closure/ClosureTest.php - - - - message: '#^Parameter \#2 \$username of class PDO constructor expects string\|null, string\|false given\.$#' - identifier: argument.type - count: 1 - path: tests/docker/mysql-lock.php - - - - message: '#^Parameter \#3 \$password of class PDO constructor expects string\|null, string\|false given\.$#' - identifier: argument.type - count: 1 - path: tests/docker/mysql-lock.php - - - - message: '#^Method tests\\drivers\\CliTestCase\:\:prepareCmd\(\) has parameter \$cmd with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/drivers/CliTestCase.php - - - - message: '#^Method tests\\drivers\\CliTestCase\:\:prepareCmd\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/drivers/CliTestCase.php - - - - message: '#^Method tests\\drivers\\CliTestCase\:\:runProcess\(\) has parameter \$cmd with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/drivers/CliTestCase.php - - - - message: '#^Method tests\\drivers\\CliTestCase\:\:startProcess\(\) has parameter \$cmd with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/drivers/CliTestCase.php - - - - message: '#^Parameter \#1 \$filename of function file_exists expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/CliTestCase.php - - - - message: '#^Parameter \#1 \$filename of function unlink expects string, bool\|string given\.$#' - identifier: argument.type + message: '#^Callable callable\(\)\: mixed invoked with 1 parameter, 0 required\.$#' + identifier: arguments.count count: 1 - path: tests/drivers/CliTestCase.php + path: src/drivers/amqp_interop/Queue.php - - message: '#^Argument of an invalid type list\\|false supplied for foreach, only iterables are supported\.$#' - identifier: foreach.nonIterable + message: '#^PHPDoc tag @var with type array\ is not subtype of native type list\\.$#' + identifier: varTag.nativeType count: 1 - path: tests/drivers/TestCase.php - - - - message: '#^Parameter \#1 \$filename of function file_exists expects string, bool\|string given\.$#' - identifier: argument.type - count: 2 - path: tests/drivers/TestCase.php + path: tests/app/benchmark/waiting/Action.php - - message: '#^Parameter \#1 \$filename of function filemtime expects string, bool\|string given\.$#' - identifier: argument.type + message: '#^Access to constant ATTR_INIT_COMMAND on an unknown class Pdo\\Mysql\.$#' + identifier: class.notFound count: 1 - path: tests/drivers/TestCase.php - - - - message: '#^Parameter \#1 \$filename of method PHPUnit\\Framework\\Assert\:\:assertFileExists\(\) expects string, bool\|string given\.$#' - identifier: argument.type - count: 2 - path: tests/drivers/TestCase.php + path: tests/app/config/main.php - message: '#^Access to an undefined property yii\\console\\Application\|yii\\web\\Application\\:\:\$amqpInteropQueue\.$#' @@ -924,84 +24,12 @@ parameters: count: 1 path: tests/drivers/amqp_interop/AmqpTestCase.php - - - message: '#^Method tests\\drivers\\amqp_interop\\AmqpTestCase\:\:getConnectionConfig\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/drivers/amqp_interop/AmqpTestCase.php - - - - message: '#^Parameter \#1 \$name of method Enqueue\\AmqpLib\\AmqpContext\:\:createQueue\(\) expects string, string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/amqp_interop/AmqpTestCase.php - - - - message: '#^Parameter \#1 \$name of method Enqueue\\AmqpLib\\AmqpContext\:\:createTopic\(\) expects string, string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/amqp_interop/AmqpTestCase.php - - - - message: '#^Parameter \#2 \$port of class PhpAmqpLib\\Connection\\AMQPStreamConnection constructor expects int, int\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/amqp_interop/AmqpTestCase.php - - - - message: '#^Unable to resolve the template type T in call to static method yii\\BaseYii\\:\:createObject\(\)$#' - identifier: argument.templateType - count: 1 - path: tests/drivers/amqp_interop/AmqpTestCase.php - - - - message: '#^Parameter \#1 \$filename of function file_get_contents expects string, bool\|string given\.$#' - identifier: argument.type - count: 2 - path: tests/drivers/amqp_interop/QueueTest.php - - - - message: '#^Parameter \#1 \$filename of method PHPUnit\\Framework\\Assert\:\:assertFileExists\(\) expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/amqp_interop/QueueTest.php - - message: '#^Access to an undefined property yii\\console\\Application\|yii\\web\\Application\\:\:\$beanstalkQueue\.$#' identifier: property.notFound count: 1 path: tests/drivers/beanstalk/QueueTest.php - - - message: '#^Parameter \#1 \$filename of function file_get_contents expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/beanstalk/QueueTest.php - - - - message: '#^Parameter \#1 \$id of class Pheanstalk\\Values\\JobId constructor expects int\|Pheanstalk\\Contract\\JobIdInterface\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/beanstalk/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isDone\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/beanstalk/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isWaiting\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/beanstalk/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\beanstalk\\Queue\:\:remove\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/beanstalk/QueueTest.php - - message: '#^Access to an undefined property yii\\console\\Application\|yii\\web\\Application\\:\:\$mysqlQueue\.$#' identifier: property.notFound @@ -1020,326 +48,44 @@ parameters: count: 1 path: tests/drivers/db/SqliteQueueTest.php - - - message: '#^Access to an undefined property yii\\queue\\Queue\:\:\$channel\.$#' - identifier: property.notFound - count: 2 - path: tests/drivers/db/TestCase.php - - - - message: '#^Access to an undefined property yii\\queue\\Queue\:\:\$db\.$#' - identifier: property.notFound - count: 3 - path: tests/drivers/db/TestCase.php - - - - message: '#^Access to an undefined property yii\\queue\\Queue\:\:\$messageHandler\.$#' - identifier: property.notFound - count: 3 - path: tests/drivers/db/TestCase.php - - - - message: '#^Access to an undefined property yii\\queue\\Queue\:\:\$tableName\.$#' - identifier: property.notFound - count: 3 - path: tests/drivers/db/TestCase.php - - - - message: '#^Call to an undefined method yii\\queue\\Queue\:\:getStatisticsProvider\(\)\.$#' - identifier: method.notFound - count: 4 - path: tests/drivers/db/TestCase.php - - - - message: '#^Call to an undefined method yii\\queue\\Queue\:\:run\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/drivers/db/TestCase.php - - - - message: '#^Parameter \#1 \$filename of function file_get_contents expects string, bool\|string given\.$#' - identifier: argument.type - count: 2 - path: tests/drivers/db/TestCase.php - - - - message: '#^Parameter \#1 \$filename of method PHPUnit\\Framework\\Assert\:\:assertFileExists\(\) expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/db/TestCase.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isDone\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/db/TestCase.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isWaiting\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/db/TestCase.php - - message: '#^Access to an undefined property yii\\console\\Application\|yii\\web\\Application\\:\:\$fileQueue\.$#' identifier: property.notFound count: 1 path: tests/drivers/file/QueueTest.php - - - message: '#^Argument of an invalid type list\\|false supplied for foreach, only iterables are supported\.$#' - identifier: foreach.nonIterable - count: 1 - path: tests/drivers/file/QueueTest.php - - - - message: '#^Call to an undefined method yii\\queue\\interfaces\\StatisticsInterface\:\:getDelayedCount\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/drivers/file/QueueTest.php - - - - message: '#^Call to an undefined method yii\\queue\\interfaces\\StatisticsInterface\:\:getDoneCount\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/drivers/file/QueueTest.php - - - - message: '#^Call to an undefined method yii\\queue\\interfaces\\StatisticsInterface\:\:getReservedCount\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/drivers/file/QueueTest.php - - - - message: '#^Call to an undefined method yii\\queue\\interfaces\\StatisticsInterface\:\:getWaitingCount\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/drivers/file/QueueTest.php - - - - message: '#^Parameter \#1 \$filename of function file_get_contents expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/file/QueueTest.php - - - - message: '#^Parameter \#1 \$filename of method PHPUnit\\Framework\\Assert\:\:assertFileExists\(\) expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/file/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isDone\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/file/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isWaiting\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/file/QueueTest.php - - message: '#^Access to an undefined property yii\\console\\Application\|yii\\web\\Application\\:\:\$gearmanQueue\.$#' identifier: property.notFound count: 1 path: tests/drivers/gearman/QueueTest.php - - - message: '#^Parameter \#1 \$filename of function file_get_contents expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/gearman/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isDone\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/gearman/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isWaiting\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/gearman/QueueTest.php - - message: '#^Access to an undefined property yii\\console\\Application\|yii\\web\\Application\\:\:\$redisQueue\.$#' identifier: property.notFound count: 1 path: tests/drivers/redis/QueueTest.php - - - message: '#^Call to an undefined method yii\\queue\\interfaces\\StatisticsInterface\:\:getDelayedCount\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/drivers/redis/QueueTest.php - - - - message: '#^Call to an undefined method yii\\queue\\interfaces\\StatisticsInterface\:\:getDoneCount\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/drivers/redis/QueueTest.php - - - - message: '#^Call to an undefined method yii\\queue\\interfaces\\StatisticsInterface\:\:getReservedCount\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/drivers/redis/QueueTest.php - - - - message: '#^Call to an undefined method yii\\queue\\interfaces\\StatisticsInterface\:\:getWaitingCount\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/drivers/redis/QueueTest.php - - - - message: '#^Cannot call method flushdb\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 1 - path: tests/drivers/redis/QueueTest.php - - - - message: '#^Cannot call method hexists\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 2 - path: tests/drivers/redis/QueueTest.php - - - - message: '#^Cannot call method keys\(\) on array\|string\|yii\\redis\\Connection\.$#' - identifier: method.nonObject - count: 2 - path: tests/drivers/redis/QueueTest.php - - - - message: '#^Parameter \#1 \$filename of function file_get_contents expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/redis/QueueTest.php - - - - message: '#^Parameter \#1 \$filename of method PHPUnit\\Framework\\Assert\:\:assertFileExists\(\) expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/redis/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isDone\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/redis/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isWaiting\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/redis/QueueTest.php - - - - message: '#^Method tests\\drivers\\redis\\RedisCrashMock\:\:executeCommand\(\) has parameter \$params with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/drivers/redis/RedisCrashMock.php - - - - message: '#^Method tests\\drivers\\redis\\RedisCrashMock\:\:executeCommand\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/drivers/redis/RedisCrashMock.php - - - - message: '#^Property tests\\drivers\\redis\\RedisCrashMock\:\:\$crashOnCommand has no type specified\.$#' - identifier: missingType.property - count: 1 - path: tests/drivers/redis/RedisCrashMock.php - - message: '#^Access to an undefined property yii\\console\\Application\|yii\\web\\Application\\:\:\$sqsFifoQueue\.$#' identifier: property.notFound count: 1 path: tests/drivers/sqs/FifoQueueTest.php - - - message: '#^Parameter \#1 \$filename of function file_get_contents expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/sqs/FifoQueueTest.php - - - - message: '#^Parameter \#1 \$filename of method PHPUnit\\Framework\\Assert\:\:assertFileExists\(\) expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/sqs/FifoQueueTest.php - - message: '#^Access to an undefined property yii\\console\\Application\|yii\\web\\Application\\:\:\$sqsQueue\.$#' identifier: property.notFound count: 1 path: tests/drivers/sqs/QueueTest.php - - - message: '#^Parameter \#1 \$filename of function file_get_contents expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/sqs/QueueTest.php - - - - message: '#^Parameter \#1 \$filename of method PHPUnit\\Framework\\Assert\:\:assertFileExists\(\) expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/sqs/QueueTest.php - - message: '#^Access to an undefined property yii\\console\\Application\|yii\\web\\Application\\:\:\$stompQueue\.$#' identifier: property.notFound count: 1 path: tests/drivers/stomp/QueueTest.php - - - message: '#^Parameter \#1 \$filename of function file_get_contents expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/stomp/QueueTest.php - - - - message: '#^Parameter \#1 \$filename of method PHPUnit\\Framework\\Assert\:\:assertFileExists\(\) expects string, bool\|string given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/stomp/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isWaiting\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/stomp/QueueTest.php - - message: '#^Access to an undefined property yii\\console\\Application\|yii\\web\\Application\\:\:\$syncQueue\.$#' identifier: property.notFound count: 1 path: tests/drivers/sync/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isDone\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/sync/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isReserved\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/sync/QueueTest.php - - - - message: '#^Parameter \#1 \$id of method yii\\queue\\Queue\:\:isWaiting\(\) expects int\|string, int\|string\|null given\.$#' - identifier: argument.type - count: 1 - path: tests/drivers/sync/QueueTest.php - - - - message: '#^Method tests\\serializers\\TestCase\:\:providerSerialize\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/serializers/TestCase.php diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 566da01b6..12e98aa1e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -26,9 +26,5 @@ ./src - - ./src/debug - ./src/gii - diff --git a/src/Queue.php b/src/Queue.php index c1cb87a10..96222f03c 100644 --- a/src/Queue.php +++ b/src/Queue.php @@ -317,7 +317,7 @@ abstract public function status(int|string $id): int; private function getSerializer(): SerializerInterface { - /** @psalm-var SerializerInterface */ + /** @var SerializerInterface */ return Instance::ensure($this->serializer, SerializerInterface::class); } } diff --git a/src/cli/Command.php b/src/cli/Command.php index 62d1ac244..1793f423d 100644 --- a/src/cli/Command.php +++ b/src/cli/Command.php @@ -26,11 +26,11 @@ abstract class Command extends Controller /** * The exit code of the exec action which is returned when job was done. */ - public const EXEC_DONE = 0; + public const int EXEC_DONE = 0; /** * The exit code of the exec action which is returned when job wasn't done and wanted next attempt. */ - public const EXEC_RETRY = 3; + public const int EXEC_RETRY = 3; /** * @var Queue @@ -187,7 +187,7 @@ protected function handleMessage(int|string|null $id, string $message, ?int $ttr if (!in_array('color', $this->getPassedOptions(), true)) { $cmd[] = '--color=' . $this->isColorEnabled(); } - $env = isset($_ENV) ? $_ENV : null; + $env = [] !== $_ENV ? $_ENV : null; $process = new Process($cmd, null, $env, $message, $ttr); try { $result = $process->run(function (string $type, string $buffer) { diff --git a/src/cli/InfoAction.php b/src/cli/InfoAction.php index cd47a4d9b..a17a8e086 100644 --- a/src/cli/InfoAction.php +++ b/src/cli/InfoAction.php @@ -12,12 +12,8 @@ use yii\base\NotSupportedException; use yii\console\Controller; -use yii\helpers\Console; -use yii\queue\interfaces\DelayedCountInterface; -use yii\queue\interfaces\DoneCountInterface; -use yii\queue\interfaces\ReservedCountInterface; +use yii\helpers\BaseConsole; use yii\queue\interfaces\StatisticsProviderInterface; -use yii\queue\interfaces\WaitingCountInterface; /** * Info about queue status. @@ -42,27 +38,19 @@ public function run(): void throw new NotSupportedException('Queue does not support ' . StatisticsProviderInterface::class); } - $this->controller->stdout('Jobs' . PHP_EOL, Console::FG_GREEN); + $this->controller->stdout('Jobs' . PHP_EOL, BaseConsole::FG_GREEN); $statisticsProvider = $this->queue->getStatisticsProvider(); - if ($statisticsProvider instanceof WaitingCountInterface) { - $this->controller->stdout('- waiting: ', Console::FG_YELLOW); - $this->controller->stdout($statisticsProvider->getWaitingCount() . PHP_EOL); - } + $this->controller->stdout('- waiting: ', BaseConsole::FG_YELLOW); + $this->controller->stdout($statisticsProvider->getWaitingCount() . PHP_EOL); - if ($statisticsProvider instanceof DelayedCountInterface) { - $this->controller->stdout('- delayed: ', Console::FG_YELLOW); - $this->controller->stdout($statisticsProvider->getDelayedCount() . PHP_EOL); - } + $this->controller->stdout('- delayed: ', BaseConsole::FG_YELLOW); + $this->controller->stdout($statisticsProvider->getDelayedCount() . PHP_EOL); - if ($statisticsProvider instanceof ReservedCountInterface) { - $this->controller->stdout('- reserved: ', Console::FG_YELLOW); - $this->controller->stdout($statisticsProvider->getReservedCount() . PHP_EOL); - } + $this->controller->stdout('- reserved: ', BaseConsole::FG_YELLOW); + $this->controller->stdout($statisticsProvider->getReservedCount() . PHP_EOL); - if ($statisticsProvider instanceof DoneCountInterface) { - $this->controller->stdout('- done: ', Console::FG_YELLOW); - $this->controller->stdout($statisticsProvider->getDoneCount() . PHP_EOL); - } + $this->controller->stdout('- done: ', BaseConsole::FG_YELLOW); + $this->controller->stdout($statisticsProvider->getDoneCount() . PHP_EOL); } } diff --git a/src/closure/Job.php b/src/closure/Job.php index 8a9cfe83a..149aa2edd 100644 --- a/src/closure/Job.php +++ b/src/closure/Job.php @@ -42,7 +42,7 @@ public function execute(Queue $queue) return $nativeClosure(); } - /** @psalm-var JobInterface $nativeClosure */ + /** @var JobInterface $nativeClosure */ return $nativeClosure->execute($queue); } } diff --git a/src/debug/Panel.php b/src/debug/Panel.php index 43f77187c..c4fe214ec 100644 --- a/src/debug/Panel.php +++ b/src/debug/Panel.php @@ -99,7 +99,6 @@ public function getViewPath(): string */ public function getSummary(): string { - /** @psalm-var array{jobs: array} $this->data */ return Yii::$app->view->render('summary', [ 'url' => $this->getUrl(), 'count' => isset($this->data['jobs']) ? count($this->data['jobs']) : 0, @@ -111,15 +110,14 @@ public function getSummary(): string */ public function getDetail(): string { - /** @psalm-var array{jobs: array} $this->data */ $jobs = $this->data['jobs'] ?? []; foreach ($jobs as &$job) { - /** @psalm-var array{sender: string, id: string|int} $job */ + /** @var array{sender: string, id: string|int} $job */ $job['status'] = 'unknown'; /** @var Queue $queue */ if ($queue = Yii::$app->get($job['sender'], false)) { try { - /** @psalm-var Queue $queue */ + /** @var Queue $queue */ if ($queue->isWaiting($job['id'])) { $job['status'] = 'waiting'; } elseif ($queue->isReserved($job['id'])) { diff --git a/src/drivers/amqp_interop/Queue.php b/src/drivers/amqp_interop/Queue.php index 62a2553c1..b336fbb94 100644 --- a/src/drivers/amqp_interop/Queue.php +++ b/src/drivers/amqp_interop/Queue.php @@ -15,7 +15,6 @@ use Enqueue\AmqpLib\AmqpConnectionFactory as AmqpLibConnectionFactory; use Enqueue\AmqpTools\DelayStrategyAware; use Enqueue\AmqpTools\RabbitMqDlxDelayStrategy; -use Interop\Amqp\AmqpConnectionFactory; use Interop\Amqp\AmqpConsumer; use Interop\Amqp\AmqpContext; use Interop\Amqp\AmqpDestination; @@ -23,7 +22,6 @@ use Interop\Amqp\AmqpQueue; use Interop\Amqp\AmqpTopic; use Interop\Amqp\Impl\AmqpBind; -use Interop\Queue\Context; use LogicException; use yii\base\Application as BaseApp; use yii\base\Event; @@ -41,13 +39,13 @@ */ class Queue extends CliQueue { - public const ATTEMPT = 'yii-attempt'; - public const TTR = 'yii-ttr'; - public const DELAY = 'yii-delay'; - public const PRIORITY = 'yii-priority'; - public const ENQUEUE_AMQP_LIB = 'enqueue/amqp-lib'; - public const ENQUEUE_AMQP_EXT = 'enqueue/amqp-ext'; - public const ENQUEUE_AMQP_BUNNY = 'enqueue/amqp-bunny'; + public const string ATTEMPT = 'yii-attempt'; + public const string TTR = 'yii-ttr'; + public const string DELAY = 'yii-delay'; + public const string PRIORITY = 'yii-priority'; + public const string ENQUEUE_AMQP_LIB = 'enqueue/amqp-lib'; + public const string ENQUEUE_AMQP_EXT = 'enqueue/amqp-ext'; + public const string ENQUEUE_AMQP_BUNNY = 'enqueue/amqp-bunny'; /** * The connection to the broker could be configured as an array of options @@ -258,9 +256,9 @@ class Queue extends CliQueue /** * Amqp interop context. * - * @var AmqpContext|Context|null + * @var AmqpContext|null */ - protected AmqpContext|null|Context $context = null; + protected AmqpContext|null $context = null; /** * List of supported amqp interop drivers. * @@ -368,7 +366,7 @@ public function getContext(): AmqpContext { $this->open(); - /** @psalm-var AmqpContext */ + /** @var AmqpContext */ return $this->context; } @@ -382,7 +380,7 @@ protected function pushMessage(string $payload, int $ttr, int $delay, mixed $pri $topic = $this->getContext()->createTopic($this->exchangeName); - /** @psalm-var AmqpMessage $message */ + /** @var AmqpMessage $message */ $message = $this->getContext()->createMessage($payload); $message->setDeliveryMode(AmqpMessage::DELIVERY_MODE_PERSISTENT); $message->setMessageId(uniqid('', true)); @@ -475,7 +473,7 @@ protected function open(): void return null !== $value; }); - /** @var AmqpConnectionFactory $factory */ + /** @var AmqpBunnyConnectionFactory|AmqpExtConnectionFactory|AmqpLibConnectionFactory $factory */ $factory = new $connectionClass($config); $this->context = $factory->createContext(); @@ -543,7 +541,7 @@ protected function redeliver(AmqpMessage $message): void private function createQueue(): AmqpQueue { - /** @psalm-var AmqpQueue */ + /** @var AmqpQueue */ return $this->getContext()->createQueue($this->queueName); } } diff --git a/src/drivers/db/Queue.php b/src/drivers/db/Queue.php index 500babcc5..4e742847e 100644 --- a/src/drivers/db/Queue.php +++ b/src/drivers/db/Queue.php @@ -84,7 +84,7 @@ public function run(bool $repeat, int $timeout = 0) return $this->runWorker(function (callable $canContinue) use ($repeat, $timeout) { while ($canContinue()) { if ($payload = $this->reserve()) { - /** @psalm-var array{id: int|string, job:string, ttr:int|string, attempt:int|string} $payload */ + /** @var array{id: int|string, job:string, ttr:int|string, attempt:int|string} $payload */ if ( $this->handleMessage( $payload['id'], @@ -283,16 +283,16 @@ private function getMutex(): Mutex return $mutex; } - private StatisticsInterface $_statisticsProvider; + private StatisticsInterface $statisticsProvider; /** * @return StatisticsInterface */ public function getStatisticsProvider(): StatisticsInterface { - if (!isset($this->_statisticsProvider)) { - $this->_statisticsProvider = new StatisticsProvider($this); + if (!isset($this->statisticsProvider)) { + $this->statisticsProvider = new StatisticsProvider($this); } - return $this->_statisticsProvider; + return $this->statisticsProvider; } } diff --git a/src/drivers/db/StatisticsProvider.php b/src/drivers/db/StatisticsProvider.php index 6c7788205..b2f5c1388 100644 --- a/src/drivers/db/StatisticsProvider.php +++ b/src/drivers/db/StatisticsProvider.php @@ -12,23 +12,14 @@ use yii\base\BaseObject; use yii\db\Query; -use yii\queue\interfaces\DelayedCountInterface; -use yii\queue\interfaces\DoneCountInterface; -use yii\queue\interfaces\ReservedCountInterface; use yii\queue\interfaces\StatisticsInterface; -use yii\queue\interfaces\WaitingCountInterface; /** * Statistics Provider * * @author Kalmer Kaurson */ -class StatisticsProvider extends BaseObject implements - DoneCountInterface, - WaitingCountInterface, - DelayedCountInterface, - ReservedCountInterface, - StatisticsInterface +class StatisticsProvider extends BaseObject implements StatisticsInterface { /** * @var Queue @@ -46,7 +37,6 @@ public function __construct(Queue $queue, array $config = []) */ public function getWaitingCount(): int { - /** @psalm-var \yii\db\Connection $this->queue->db */ return (int) (new Query()) ->from($this->queue->tableName) ->andWhere(['channel' => $this->queue->channel]) @@ -60,7 +50,6 @@ public function getWaitingCount(): int */ public function getDelayedCount(): int { - /** @psalm-var \yii\db\Connection $this->queue->db */ return (int) (new Query()) ->from($this->queue->tableName) ->andWhere(['channel' => $this->queue->channel]) @@ -74,7 +63,6 @@ public function getDelayedCount(): int */ public function getReservedCount(): int { - /** @psalm-var \yii\db\Connection $this->queue->db */ return (int) (new Query()) ->from($this->queue->tableName) ->andWhere(['channel' => $this->queue->channel]) @@ -88,7 +76,6 @@ public function getReservedCount(): int */ public function getDoneCount(): int { - /** @psalm-var \yii\db\Connection $this->queue->db */ return (int) (new Query()) ->from($this->queue->tableName) ->andWhere(['channel' => $this->queue->channel]) diff --git a/src/drivers/file/Queue.php b/src/drivers/file/Queue.php index 8caaa0075..28481cf52 100644 --- a/src/drivers/file/Queue.php +++ b/src/drivers/file/Queue.php @@ -145,7 +145,7 @@ public function remove(int $id): bool /** @var array{waiting: array, delayed: array, reserved: array} $data */ if (!empty($data['waiting'])) { foreach ($data['waiting'] as $key => $payload) { - /** @psalm-var array $payload */ + /** @var array $payload */ if ($payload[0] === $id) { unset($data['waiting'][$key]); $removed = true; @@ -155,7 +155,7 @@ public function remove(int $id): bool } if (!$removed && !empty($data['delayed'])) { foreach ($data['delayed'] as $key => $payload) { - /** @psalm-var array $payload */ + /** @var array $payload */ if ($payload[0] === $id) { unset($data['delayed'][$key]); $removed = true; @@ -165,7 +165,7 @@ public function remove(int $id): bool } if (!$removed && !empty($data['reserved'])) { foreach ($data['reserved'] as $key => $payload) { - /** @psalm-var array $payload */ + /** @var array $payload */ if ($payload[0] === $id) { unset($data['reserved'][$key]); $removed = true; @@ -195,10 +195,10 @@ protected function reserve(): ?array /** @var array{reserved: array, delayed: array, waiting: array} $data */ if (!empty($data['reserved'])) { foreach ($data['reserved'] as $key => $payload) { - /** @psalm-var array $payload */ + /** @var array $payload */ if ((int)$payload[1] + (int)$payload[3] < time()) { /** - * @psalm-var int $attempt + * @var int $attempt */ [$id, $ttr, $attempt, $time] = $payload; $data['reserved'][$key][2] = ++$attempt; @@ -235,9 +235,10 @@ protected function delete(array $payload): void { $id = $payload[0]; $this->touchIndex(function (array &$data) use ($id) { - /** @var array{reserved: array} $data */ + { + /** @var array{reserved: array} $data */ + } foreach ($data['reserved'] as $key => $payload) { - /** @psalm-var array $payload */ if ($payload[0] === $id) { unset($data['reserved'][$key]); break; @@ -273,16 +274,10 @@ protected function pushMessage(string $payload, int $ttr, int $delay, mixed $pri } else { $data['delayed'][] = [$id, $ttr, time() + $delay]; usort($data['delayed'], static function (array $a, array $b) { - if ($a[2] < $b[2]) { - return -1; - } - if ($a[2] > $b[2]) { - return 1; - } - if ($a[0] < $b[0]) { + if ($a[2] < $b[2] || $a[0] < $b[0]) { return -1; } - if ($a[0] > $b[0]) { + if ($a[2] > $b[2] || $a[0] > $b[0]) { return 1; } return 0; @@ -290,7 +285,6 @@ protected function pushMessage(string $payload, int $ttr, int $delay, mixed $pri } }); - /** @psalm-var int|string|null $id */ return $id; } @@ -334,16 +328,16 @@ private function touchIndex(callable $callback): void } } - private StatisticsInterface $_statisticsProvider; + private StatisticsInterface $statisticsProvider; /** * @return StatisticsInterface */ public function getStatisticsProvider(): StatisticsInterface { - if (!isset($this->_statisticsProvider)) { - $this->_statisticsProvider = new StatisticsProvider($this); + if (!isset($this->statisticsProvider)) { + $this->statisticsProvider = new StatisticsProvider($this); } - return $this->_statisticsProvider; + return $this->statisticsProvider; } } diff --git a/src/drivers/file/StatisticsProvider.php b/src/drivers/file/StatisticsProvider.php index bd1991a2e..4584aaf67 100644 --- a/src/drivers/file/StatisticsProvider.php +++ b/src/drivers/file/StatisticsProvider.php @@ -11,23 +11,14 @@ namespace yii\queue\file; use yii\base\BaseObject; -use yii\queue\interfaces\DelayedCountInterface; -use yii\queue\interfaces\DoneCountInterface; -use yii\queue\interfaces\ReservedCountInterface; use yii\queue\interfaces\StatisticsInterface; -use yii\queue\interfaces\WaitingCountInterface; /** * Statistics Provider * * @author Kalmer Kaurson */ -class StatisticsProvider extends BaseObject implements - DoneCountInterface, - WaitingCountInterface, - DelayedCountInterface, - ReservedCountInterface, - StatisticsInterface +class StatisticsProvider extends BaseObject implements StatisticsInterface { /** * @var Queue @@ -77,7 +68,7 @@ public function getDoneCount(): int { /** @var array{lastId:int} $data */ $data = $this->getIndexData(); - $total = isset($data['lastId']) ? $data['lastId'] : 0; + $total = $data['lastId'] ?? 0; return $total - $this->getDelayedCount() - $this->getWaitingCount(); } diff --git a/src/drivers/redis/Queue.php b/src/drivers/redis/Queue.php index 0c17a1f67..7a1b58fce 100644 --- a/src/drivers/redis/Queue.php +++ b/src/drivers/redis/Queue.php @@ -29,7 +29,6 @@ class Queue extends CliQueue implements StatisticsProviderInterface { /** * @var Connection|array|string - * @psalm-var Connection */ public Connection|string|array $redis = 'redis'; /** @@ -66,8 +65,8 @@ public function run(bool $repeat, int $timeout = 0): ?int if (($payload = $this->reserve($timeout)) !== null) { [$id, $message, $ttr, $attempt] = $payload; /** - * @psalm-var int|string $id - * @psalm-var string $message + * @var int|string $id + * @var string $message */ if ($this->handleMessage($id, $message, (int)$ttr, (int)$attempt)) { $this->delete($id); @@ -153,7 +152,7 @@ protected function reserve(int $timeout): ?array if (!$timeout) { $id = $this->redis->rpop("$this->channel.waiting"); } elseif ($result = $this->redis->brpop("$this->channel.waiting", $timeout)) { - /** @psalm-var array $result */ + /** @var array $result */ $id = $result[1]; } if (!$id) { @@ -166,7 +165,7 @@ protected function reserve(int $timeout): ?array } /** - * @psalm-var string $payload + * @var string $payload */ [$ttr, $message] = explode(';', $payload, 2); $this->redis->zadd("$this->channel.reserved", time() + (int)$ttr, $id); @@ -222,16 +221,16 @@ protected function pushMessage(string $payload, int $ttr, int $delay, mixed $pri return $id; } - private StatisticsInterface $_statisticsProvider; + private StatisticsInterface $statisticsProvider; /** * @return StatisticsInterface */ public function getStatisticsProvider(): StatisticsInterface { - if (!isset($this->_statisticsProvider)) { - $this->_statisticsProvider = new StatisticsProvider($this); + if (!isset($this->statisticsProvider)) { + $this->statisticsProvider = new StatisticsProvider($this); } - return $this->_statisticsProvider; + return $this->statisticsProvider; } } diff --git a/src/drivers/redis/StatisticsProvider.php b/src/drivers/redis/StatisticsProvider.php index 9f2973894..b58878c28 100644 --- a/src/drivers/redis/StatisticsProvider.php +++ b/src/drivers/redis/StatisticsProvider.php @@ -11,23 +11,14 @@ namespace yii\queue\redis; use yii\base\BaseObject; -use yii\queue\interfaces\DelayedCountInterface; -use yii\queue\interfaces\DoneCountInterface; -use yii\queue\interfaces\ReservedCountInterface; use yii\queue\interfaces\StatisticsInterface; -use yii\queue\interfaces\WaitingCountInterface; /** * Statistics Provider * * @author Kalmer Kaurson */ -class StatisticsProvider extends BaseObject implements - DoneCountInterface, - WaitingCountInterface, - DelayedCountInterface, - ReservedCountInterface, - StatisticsInterface +class StatisticsProvider extends BaseObject implements StatisticsInterface { /** * @var Queue diff --git a/src/drivers/stomp/Queue.php b/src/drivers/stomp/Queue.php index 643373ad3..b482cbc3b 100644 --- a/src/drivers/stomp/Queue.php +++ b/src/drivers/stomp/Queue.php @@ -29,8 +29,8 @@ */ class Queue extends CliQueue { - public const ATTEMPT = 'yii-attempt'; - public const TTR = 'yii-ttr'; + public const string ATTEMPT = 'yii-attempt'; + public const string TTR = 'yii-ttr'; /** * The message queue broker's host. diff --git a/src/gii/Generator.php b/src/gii/Generator.php index 633bc456e..31e133a00 100644 --- a/src/gii/Generator.php +++ b/src/gii/Generator.php @@ -159,7 +159,7 @@ public function validateJobClass(string $attribute): void */ public function validateNamespace(string $attribute): void { - /** @psalm-var string $value */ + /** @var string $value */ $value = $this->$attribute; $value = ltrim($value, '\\'); $path = Yii::getAlias('@' . str_replace('\\', '/', $value), false); diff --git a/src/interfaces/StatisticsInterface.php b/src/interfaces/StatisticsInterface.php index 1da8b4f16..9a9bdcd32 100644 --- a/src/interfaces/StatisticsInterface.php +++ b/src/interfaces/StatisticsInterface.php @@ -13,6 +13,10 @@ /** * Statistics Interface */ -interface StatisticsInterface +interface StatisticsInterface extends + DoneCountInterface, + WaitingCountInterface, + DelayedCountInterface, + ReservedCountInterface { } diff --git a/src/serializers/IgbinarySerializer.php b/src/serializers/IgbinarySerializer.php index 8047457b6..7f4cdec30 100644 --- a/src/serializers/IgbinarySerializer.php +++ b/src/serializers/IgbinarySerializer.php @@ -27,7 +27,7 @@ class IgbinarySerializer extends BaseObject implements SerializerInterface */ public function serialize($job): string { - /** @var string|null|false $serialize */ + /** @var string|null $serialize */ $serialize = igbinary_serialize($job); return is_string($serialize) ? $serialize : ''; } diff --git a/support/ide-helper.php b/support/ide-helper.php index dd0a459e9..2fff58a42 100644 --- a/support/ide-helper.php +++ b/support/ide-helper.php @@ -51,6 +51,19 @@ abstract class BaseApplication extends yii\base\Application /** * Class WebApplication * Include only Web application related components here + * + * @property AmqpInteropQueue $amqpInteropQueue + * @property BeanstalkQueue $beanstalkQueue + * @property FileQueue $fileQueue + * @property GearmanQueue $gearmanQueue + * @property RedisQueue $redisQueue + * @property StompQueue $stompQueue + * @property SyncQueue $syncQueue + * @property SqsQueue $sqsQueue + * @property SqsQueue $sqsFifoQueue + * @property DbQueue $mysqlQueue + * @property DbQueue $pgsqlQueue + * @property DbQueue $sqliteQueue */ class WebApplication extends yii\web\Application { @@ -59,6 +72,19 @@ class WebApplication extends yii\web\Application /** * Class ConsoleApplication * Include only Console application related components here + * + * @property AmqpInteropQueue $amqpInteropQueue + * @property BeanstalkQueue $beanstalkQueue + * @property FileQueue $fileQueue + * @property GearmanQueue $gearmanQueue + * @property RedisQueue $redisQueue + * @property StompQueue $stompQueue + * @property SyncQueue $syncQueue + * @property SqsQueue $sqsQueue + * @property SqsQueue $sqsFifoQueue + * @property DbQueue $mysqlQueue + * @property DbQueue $pgsqlQueue + * @property DbQueue $sqliteQueue */ class ConsoleApplication extends yii\console\Application { diff --git a/tests/app/benchmark/waiting/Action.php b/tests/app/benchmark/waiting/Action.php index 76bc08dde..b7aa47416 100644 --- a/tests/app/benchmark/waiting/Action.php +++ b/tests/app/benchmark/waiting/Action.php @@ -61,7 +61,6 @@ class Action extends BaseAction * @param int $jobCount number of jobs that will be pushed to a queue * @param int $workerCount number of workers that listen a queue * @param int $payloadSize additional job size - * @throws */ public function run(string $mode = 'fast', int $jobCount = 1000, int $workerCount = 10, int $payloadSize = 0): void { diff --git a/tests/cli/InfoActionTest.php b/tests/cli/InfoActionTest.php index 3337138b1..f03f9f007 100644 --- a/tests/cli/InfoActionTest.php +++ b/tests/cli/InfoActionTest.php @@ -10,14 +10,11 @@ namespace tests\cli; -use tests\cli\providers\DelayedCountProvider; -use tests\cli\providers\DoneCountProvider; -use tests\cli\providers\ReservedCountProvider; -use tests\cli\providers\WaitingCountProvider; +use tests\cli\providers\BaseStatisticsProvider; use tests\TestCase; use yii\base\Module; use yii\console\Controller; -use yii\helpers\Console; +use yii\helpers\BaseConsole; use yii\queue\cli\InfoAction; /** @@ -34,29 +31,53 @@ public function testWaitingCount(): void ->getMock(); $controller - ->expects($this->exactly(3)) + ->expects($this->exactly(9)) ->method('stdout') ->willReturnOnConsecutiveCalls( [ 'Jobs' . PHP_EOL, - Console::FG_GREEN, + BaseConsole::FG_GREEN, ], [ '- waiting: ', - Console::FG_YELLOW, + BaseConsole::FG_YELLOW, ], [ - 10 . PHP_EOL - ] + 10 . PHP_EOL, + ], + [ + '- delayed: ', + BaseConsole::FG_YELLOW, + ], + [ + 0 . PHP_EOL, + null + ], + [ + '- reserved: ', + BaseConsole::FG_YELLOW, + ], + [ + 0 . PHP_EOL, + null, + ], + [ + '- done: ', + BaseConsole::FG_YELLOW, + ], + [ + 0 . PHP_EOL, + null, + ], ); $queue = $this->getMockBuilder(Queue::class)->getMock(); - $provider = $this->getMockBuilder(WaitingCountProvider::class) + $provider = $this->getMockBuilder(BaseStatisticsProvider::class) + ->onlyMethods(['getWaitingCount']) ->setConstructorArgs([$queue]) ->getMock(); - $provider - ->expects($this->once()) + $provider->expects($this->once()) ->method('getWaitingCount') ->willReturn(10); @@ -65,10 +86,9 @@ public function testWaitingCount(): void ->method('getStatisticsProvider') ->willReturn($provider); - $action = (new InfoAction('infoAction', $controller, [ + (new InfoAction('infoAction', $controller, [ 'queue' => $queue, - ])); - $action->run(); + ]))->run(); } public function testDelayedCount(): void @@ -78,29 +98,54 @@ public function testDelayedCount(): void ->getMock(); $controller - ->expects($this->exactly(3)) + ->expects($this->exactly(9)) ->method('stdout') ->willReturnOnConsecutiveCalls( [ 'Jobs' . PHP_EOL, - Console::FG_GREEN, + BaseConsole::FG_GREEN, + ], + [ + '- waiting: ', + BaseConsole::FG_YELLOW, + ], + [ + 0 . PHP_EOL, + null, ], [ '- delayed: ', - Console::FG_YELLOW, + BaseConsole::FG_YELLOW, + ], + [ + 10 . PHP_EOL, + null, + ], + [ + '- reserved: ', + BaseConsole::FG_YELLOW, ], [ - 10 . PHP_EOL - ] + 0 . PHP_EOL, + null, + ], + [ + '- done: ', + BaseConsole::FG_YELLOW, + ], + [ + 0 . PHP_EOL, + null, + ], ); $queue = $this->getMockBuilder(Queue::class)->getMock(); - $provider = $this->getMockBuilder(DelayedCountProvider::class) + $provider = $this->getMockBuilder(BaseStatisticsProvider::class) + ->onlyMethods(['getDelayedCount']) ->setConstructorArgs([$queue]) ->getMock(); - $provider - ->expects($this->once()) + $provider->expects($this->once()) ->method('getDelayedCount') ->willReturn(10); @@ -109,10 +154,9 @@ public function testDelayedCount(): void ->method('getStatisticsProvider') ->willReturn($provider); - $action = (new InfoAction('infoAction', $controller, [ + (new InfoAction('infoAction', $controller, [ 'queue' => $queue, - ])); - $action->run(); + ]))->run(); } public function testReservedCount(): void @@ -122,30 +166,54 @@ public function testReservedCount(): void ->getMock(); $controller - ->expects($this->exactly(3)) + ->expects($this->exactly(9)) ->method('stdout') ->willReturnOnConsecutiveCalls( [ 'Jobs' . PHP_EOL, - Console::FG_GREEN, + BaseConsole::FG_GREEN, + ], + [ + '- waiting: ', + BaseConsole::FG_YELLOW, + ], + [ + 0 . PHP_EOL, + null, + ], + [ + '- delayed: ', + BaseConsole::FG_YELLOW + ], + [ + 0 . PHP_EOL, + null, ], [ '- reserved: ', - Console::FG_YELLOW, + BaseConsole::FG_YELLOW, ], [ - 10 . PHP_EOL - ] + 10 . PHP_EOL, + null, + ], + [ + '- done: ', + BaseConsole::FG_YELLOW, + ], + [ + 0 . PHP_EOL, + null, + ], ); $queue = $this->getMockBuilder(Queue::class)->getMock(); - $provider = $this->getMockBuilder(ReservedCountProvider::class) + $provider = $this->getMockBuilder(BaseStatisticsProvider::class) + ->onlyMethods(['getReservedCount']) ->setConstructorArgs([$queue]) - ->getMock() - ; - $provider - ->expects($this->once()) + ->getMock(); + $provider->expects($this->once()) ->method('getReservedCount') ->willReturn(10); @@ -154,10 +222,9 @@ public function testReservedCount(): void ->method('getStatisticsProvider') ->willReturn($provider); - $action = (new InfoAction('infoAction', $controller, [ + (new InfoAction('infoAction', $controller, [ 'queue' => $queue, - ])); - $action->run(); + ]))->run(); } public function testDoneCount(): void @@ -167,29 +234,54 @@ public function testDoneCount(): void ->getMock(); $controller - ->expects($this->exactly(3)) + ->expects($this->exactly(9)) ->method('stdout') ->willReturnOnConsecutiveCalls( [ 'Jobs' . PHP_EOL, - Console::FG_GREEN, + BaseConsole::FG_GREEN, + ], + [ + '- waiting: ', + BaseConsole::FG_YELLOW, + ], + [ + 0 . PHP_EOL, + null, + ], + [ + '- delayed: ', + BaseConsole::FG_YELLOW, + ], + [ + 0 . PHP_EOL, + null, + ], + [ + '- reserved: ', + BaseConsole::FG_YELLOW, + ], + [ + 0 . PHP_EOL, + null, ], [ '- done: ', - Console::FG_YELLOW, + BaseConsole::FG_YELLOW, ], [ - 10 . PHP_EOL - ] + 10 . PHP_EOL, + null, + ], ); $queue = $this->getMockBuilder(Queue::class)->getMock(); - $provider = $this->getMockBuilder(DoneCountProvider::class) + $provider = $this->getMockBuilder(BaseStatisticsProvider::class) + ->onlyMethods(['getDoneCount']) ->setConstructorArgs([$queue]) ->getMock(); - $provider - ->expects($this->once()) + $provider->expects($this->once()) ->method('getDoneCount') ->willReturn(10); @@ -198,9 +290,8 @@ public function testDoneCount(): void ->method('getStatisticsProvider') ->willReturn($provider); - $action = (new InfoAction('infoAction', $controller, [ + (new InfoAction('infoAction', $controller, [ 'queue' => $queue, - ])); - $action->run(); + ]))->run(); } } diff --git a/tests/cli/Queue.php b/tests/cli/Queue.php index f5cf18fa1..0246f8865 100644 --- a/tests/cli/Queue.php +++ b/tests/cli/Queue.php @@ -38,13 +38,8 @@ protected function pushMessage(string $payload, $ttr, $delay, $priority): int|st throw new NotSupportedException('"pushMessage" method is not supported.'); } - private StatisticsInterface $_statisticsProvider; - public function getStatisticsProvider(): StatisticsInterface { - if (!isset($this->_statisticsProvider)) { - $this->_statisticsProvider = new BaseStatisticsProvider($this); - } - return $this->_statisticsProvider; + return new BaseStatisticsProvider($this); } } diff --git a/tests/cli/providers/BaseStatisticsProvider.php b/tests/cli/providers/BaseStatisticsProvider.php index 57a8646e0..9704061ca 100644 --- a/tests/cli/providers/BaseStatisticsProvider.php +++ b/tests/cli/providers/BaseStatisticsProvider.php @@ -28,4 +28,33 @@ public function __construct(Queue $queue, array $config = []) $this->queue = $queue; parent::__construct($config); } + + /** + * @inheritdoc + */ + public function getReservedCount(): int + { + return 10; + } + + public function getDoneCount(): int + { + return 10; + } + + /** + * @inheritdoc + */ + public function getDelayedCount(): int + { + return 10; + } + + /** + * @inheritdoc + */ + public function getWaitingCount(): int + { + return 10; + } } diff --git a/tests/cli/providers/DelayedCountProvider.php b/tests/cli/providers/DelayedCountProvider.php deleted file mode 100644 index 4364a42d1..000000000 --- a/tests/cli/providers/DelayedCountProvider.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ -class DelayedCountProvider extends BaseStatisticsProvider implements DelayedCountInterface -{ - /** - * @inheritdoc - */ - public function getDelayedCount(): int - { - return 10; - } -} diff --git a/tests/cli/providers/DoneCountProvider.php b/tests/cli/providers/DoneCountProvider.php deleted file mode 100644 index a864322cf..000000000 --- a/tests/cli/providers/DoneCountProvider.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ -class DoneCountProvider extends BaseStatisticsProvider implements DoneCountInterface -{ - /** - * @inheritdoc - */ - public function getDoneCount(): int - { - return 10; - } -} diff --git a/tests/cli/providers/ReservedCountProvider.php b/tests/cli/providers/ReservedCountProvider.php deleted file mode 100644 index 11c93cdad..000000000 --- a/tests/cli/providers/ReservedCountProvider.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ -class ReservedCountProvider extends BaseStatisticsProvider implements ReservedCountInterface -{ - /** - * @inheritdoc - */ - public function getReservedCount(): int - { - return 10; - } -} diff --git a/tests/cli/providers/WaitingCountProvider.php b/tests/cli/providers/WaitingCountProvider.php deleted file mode 100644 index a62aecd1a..000000000 --- a/tests/cli/providers/WaitingCountProvider.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ -class WaitingCountProvider extends BaseStatisticsProvider implements WaitingCountInterface -{ - /** - * @inheritdoc - */ - public function getWaitingCount(): int - { - return 10; - } -} diff --git a/tests/drivers/CliTestCase.php b/tests/drivers/CliTestCase.php index 23f78fe99..04a8c1ad6 100644 --- a/tests/drivers/CliTestCase.php +++ b/tests/drivers/CliTestCase.php @@ -14,6 +14,7 @@ use Symfony\Component\Process\Exception\ProcessFailedException; use Symfony\Component\Process\Process; use tests\app\PriorityJob; +use Yii; /** * CLI Test Case. @@ -79,6 +80,11 @@ protected function tearDown(): void unlink(PriorityJob::getFileName()); } + // Removes temp job files + foreach (glob(Yii::getAlias('@runtime/job-*.lock')) as $fileName) { + unlink($fileName); + } + // Kills started processes foreach ($this->processes as $process) { $process->stop(); diff --git a/tests/drivers/db/TestCase.php b/tests/drivers/db/TestCase.php index de4741791..2d2efe159 100644 --- a/tests/drivers/db/TestCase.php +++ b/tests/drivers/db/TestCase.php @@ -13,13 +13,15 @@ use tests\app\PriorityJob; use tests\app\RetryJob; use tests\drivers\CliTestCase; -use Yii; use yii\db\Query; +use yii\queue\db\Queue; /** * Db Queue Test Case. * * @author Roman Zhuravlev + * + * @method Queue getQueue() */ abstract class TestCase extends CliTestCase {