Skip to content

Commit dec0bb9

Browse files
authored
Merge pull request #138 from cakephp/1.x-phpstan-l8
PHPStan level 8
2 parents c5b5b18 + 3d7e9ab commit dec0bb9

File tree

6 files changed

+18
-13
lines changed

6 files changed

+18
-13
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Coverage Status](https://img.shields.io/codecov/c/github/cakephp/queue/master.svg?style=flat-square)](https://codecov.io/github/cakephp/queue?branch=master)
66
[![Total Downloads](https://img.shields.io/packagist/dt/cakephp/queue.svg?style=flat-square)](https://packagist.org/packages/cakephp/queue)
77

8-
This is a Queue system for CakePHP 4.
8+
This is a Queue system for CakePHP.
99

1010
The plugin consists of a CakePHP shell wrapper and Queueing libraries for the [php-queue](https://php-enqueue.github.io) queue library.
1111

@@ -34,7 +34,7 @@ bin/cake plugin load Cake/Queue
3434

3535
Or you can manually add the loading statement in the **src/Application.php** file of your application:
3636
```php
37-
public function bootstrap()
37+
public function bootstrap(): void
3838
{
3939
parent::bootstrap();
4040
$this->addPlugin('Cake/Queue');

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
],
5353
"cs-check": "phpcs --colors -p src/ tests/",
5454
"cs-fix": "phpcbf --colors -p src/ tests/",
55-
"stan": "phpstan analyse src/ && psalm.phar --show-info=false",
55+
"stan": "phpstan analyse && psalm.phar --show-info=false",
5656
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^1.5 psalm/phar:~4.22 && mv composer.backup composer.json",
5757
"test": "phpunit",
5858
"test-coverage": "phpunit --coverage-clover=clover.xml"

phpstan.neon

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
parameters:
2-
level: 6
2+
level: 8
33
checkMissingIterableValueType: false
4+
checkGenericClassInNonGenericObjectType: false
45
bootstrapFiles:
56
- tests/bootstrap.php
67
paths:
78
- src/
9+
ignoreErrors:
10+
- '#Parameter \#1 \$callback of static method Closure::fromCallable\(\) expects callable\(\): mixed, array\{mixed, string\} given.#'
11+
- '#Method Cake\\Queue\\Job\\Message::getTarget\(\) should return array\{class-string, string\} but returns non-empty-array.#'

src/Job/Message.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public function getCallable()
122122
*/
123123
public function getTarget(): array
124124
{
125+
/** @var array|null $target */
125126
$target = $this->parsedBody['class'] ?? null;
126127

127128
if (!is_array($target) || count($target) !== 2) {
@@ -176,7 +177,7 @@ public function getMaxAttempts(): ?int
176177
*/
177178
public function __toString()
178179
{
179-
return json_encode($this);
180+
return (string)json_encode($this);
180181
}
181182

182183
/**

src/Listener/FailedJobsListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function implementedEvents(): array
3838
}
3939

4040
/**
41-
* @param object $event EventInterface.
41+
* @param \Cake\Event\EventInterface $event EventInterface.
4242
* @return void
4343
*/
4444
public function storeFailedJob($event): void

src/Model/Table/FailedJobsTable.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@
1111
*
1212
* @method \Cake\Queue\Model\Entity\FailedJob newEmptyEntity()
1313
* @method \Cake\Queue\Model\Entity\FailedJob newEntity(array $data, array $options = [])
14-
* @method \Cake\Queue\Model\Entity\FailedJob[] newEntities(array $data, array $options = [])
14+
* @method array<\Cake\Queue\Model\Entity\FailedJob> newEntities(array $data, array $options = [])
1515
* @method \Cake\Queue\Model\Entity\FailedJob get($primaryKey, $options = [])
1616
* @method \Cake\Queue\Model\Entity\FailedJob findOrCreate($search, ?callable $callback = null, $options = [])
1717
* @method \Cake\Queue\Model\Entity\FailedJob patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
18-
* @method \Cake\Queue\Model\Entity\FailedJob[] patchEntities(iterable $entities, array $data, array $options = [])
18+
* @method array<\Cake\Queue\Model\Entity\FailedJob> patchEntities(iterable $entities, array $data, array $options = [])
1919
* @method \Cake\Queue\Model\Entity\FailedJob|false save(\Cake\Datasource\EntityInterface $entity, $options = [])
2020
* @method \Cake\Queue\Model\Entity\FailedJob saveOrFail(\Cake\Datasource\EntityInterface $entity, $options = [])
21-
* @method \Cake\Queue\Model\Entity\FailedJob[]|\Cake\Datasource\ResultSetInterface|false saveMany(iterable $entities, $options = [])
22-
* @method \Cake\Queue\Model\Entity\FailedJob[]|\Cake\Datasource\ResultSetInterface saveManyOrFail(iterable $entities, $options = [])
23-
* @method \Cake\Queue\Model\Entity\FailedJob[]|\Cake\Datasource\ResultSetInterface|false deleteMany(iterable $entities, $options = [])
24-
* @method \Cake\Queue\Model\Entity\FailedJob[]|\Cake\Datasource\ResultSetInterface deleteManyOrFail(iterable $entities, $options = [])
21+
* @method iterable<\Cake\Queue\Model\Entity\FailedJob>|false saveMany(iterable $entities, $options = [])
22+
* @method iterable<\Cake\Queue\Model\Entity\FailedJob> saveManyOrFail(iterable $entities, $options = [])
23+
* @method iterable<\Cake\Queue\Model\Entity\FailedJob>|false deleteMany(iterable $entities, $options = [])
24+
* @method iterable<\Cake\Queue\Model\Entity\FailedJob> deleteManyOrFail(iterable $entities, $options = [])
2525
* @mixin \Cake\ORM\Behavior\TimestampBehavior
2626
*/
2727
class FailedJobsTable extends Table
2828
{
2929
/**
3030
* Initialize method
3131
*
32-
* @param array $config The configuration for the Table.
32+
* @param array<string, mixed> $config The configuration for the Table.
3333
* @return void
3434
*/
3535
public function initialize(array $config): void

0 commit comments

Comments
 (0)