Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: php-cs-fixer

permissions:
contents: read

on:
pull_request: &ignore-paths
paths-ignore:
- 'docs/**'
- '.github/CONTRIBUTING.md'
- '.github/FUNDING.yml'
- '.github/SECURITY.md'
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE.md'
- 'UPGRADE.md'
- '.gitignore'
- '.gitattributes'
- '.editorconfig'
- 'docker-compose.yml'
- 'Dockerfile'
- 'Makefile'
- 'phpunit.xml.dist'

push: *ignore-paths

jobs:
php-cs-fixer:
uses: yiisoft/yii2-actions/.github/workflows/php-cs-fixer.yml@9bfbe47bd91bc31a6ff9f0ea77ba3724d7816c3d # master
with:
configuration: .php-cs-fixer.dist.php
php-version: '["8.3"]'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: linter
name: phpcs

permissions:
contents: read
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ composer.lock
coverage.xml

runtime

# PHP CS Fixer
.php-cs-fixer.php
.php-cs-fixer.cache
31 changes: 31 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$header = '@link https://www.yiiframework.com/
@copyright Copyright (c) 2008 Yii Software LLC
@license https://www.yiiframework.com/license/';

$finder = (new Finder())
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->notPath([
'#(^|/)views/#',
'#(^|/)config/#',
'#(^|/)docker/#',
]);

return (new Config())
->setFinder($finder)
->setRules([
'no_unused_imports' => true,
'phpdoc_scalar' => true,
'header_comment' => [
'comment_type' => 'PHPDoc',
'header' => $header,
'location' => 'after_open',
],
]);
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"rector/rector": "^2.6",
"mspirkov/yii2-rector": "^0.1"
"mspirkov/yii2-rector": "^0.1",
"slevomat/coding-standard": "^8.31",
"friendsofphp/php-cs-fixer": "^3.95"
},
"suggest": {
"ext-pcntl": "Need for process signals.",
Expand Down Expand Up @@ -71,7 +73,8 @@
"config": {
"allow-plugins": {
"yiisoft/yii2-composer": true,
"php-http/discovery": true
"php-http/discovery": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"extra": {
Expand All @@ -86,8 +89,8 @@
}
],
"scripts": {
"cs": "./vendor/bin/phpcs",
"cs-fix": "./vendor/bin/phpcbf",
"cs": "./vendor/bin/phpcs && ./vendor/bin/php-cs-fixer check",
"cs-fix": "./vendor/bin/phpcbf && ./vendor/bin/php-cs-fixer fix",
"static": "./vendor/bin/phpstan --memory-limit=-1",
"tests": "./make test",
"rector": "./vendor/bin/rector"
Expand Down
23 changes: 23 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@
<ruleset name="Yii2">
<rule ref="vendor/yiisoft/yii2-coding-standards/Yii2"/>

<rule ref="SlevomatCodingStandard.Classes.TraitUseSpacing">
<properties>
<property name="linesCountBeforeFirstUseWhenFirstInClass" value="0"/>
<property name="linesCountAfterLastUseWhenLastInClass" value="0"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.ConstantSpacing">
<properties>
<property name="minLinesCountBeforeWithComment" value="0"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.PropertySpacing">
<properties>
<property name="minLinesCountBeforeWithComment" value="0"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Classes.MethodSpacing">
<properties>
<property name="minLinesCount" value="1"/>
<property name="maxLinesCount" value="2"/>
</properties>
</rule>

<!-- generate relative paths -->
<arg name="basepath" value="src"/>

Expand Down
12 changes: 6 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,12 @@ parameters:
count: 1
path: src/drivers/sqs/Queue.php

-
message: '#^Parameter \#1 \$args of method Aws\\Sqs\\SqsClient\:\:receiveMessage\(\) expects array\{QueueUrl\?\: string, AttributeNames\?\: list\<''All''\|''ApproximateNumberOf…''\|''ContentBasedDedupli…''\|''CreatedTimestamp''\|''DeduplicationScope''\|''DelaySeconds''\|''FifoQueue''\|''FifoThroughputLimit''\|''KmsDataKeyReusePeri…''\|''KmsMasterKeyId''\|''LastModifiedTimesta…''\|''MaximumMessageSize''\|''MessageRetentionPer…''\|''Policy''\|''QueueArn''\|''ReceiveMessageWaitT…''\|''RedriveAllowPolicy''\|''RedrivePolicy''\|''SqsManagedSseEnabled''\|''VisibilityTimeout''\>, MessageSystemAttributeNames\?\: list\<''All''\|''ApproximateFirstRec…''\|''ApproximateReceiveC…''\|''AWSTraceHeader''\|''DeadLetterQueueSour…''\|''MessageDeduplicatio…''\|''MessageGroupId''\|''SenderId''\|''SentTimestamp''\|''SequenceNumber''\>, MessageAttributeNames\?\: list\<string\>, MaxNumberOfMessages\?\: int, VisibilityTimeout\?\: int, WaitTimeSeconds\?\: int, ReceiveRequestAttemptId\?\: string, \.\.\.\}, array\{QueueUrl\: string, AttributeNames\: array\{''ApproximateReceiveC…''\}, MessageAttributeNames\: array\{''TTR''\}, MaxNumberOfMessages\: 1, VisibilityTimeout\: int, WaitTimeSeconds\: int\} given\.$#'
identifier: argument.type
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
Expand Down Expand Up @@ -1337,9 +1343,3 @@ parameters:
identifier: missingType.iterableValue
count: 1
path: tests/serializers/TestCase.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
1 change: 0 additions & 1 deletion src/cli/InfoAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace yii\queue\cli;

use yii\base\NotSupportedException;
use yii\console\Controller;
use yii\helpers\Console;
use yii\queue\interfaces\DelayedCountInterface;
use yii\queue\interfaces\DoneCountInterface;
Expand Down
1 change: 1 addition & 0 deletions tests/cli/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function status($id): int
{
throw new NotSupportedException('"status" method is not supported.');
}

/**
* @inheritdoc
*/
Expand Down
1 change: 0 additions & 1 deletion tests/drivers/db/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use tests\app\PriorityJob;
use tests\app\RetryJob;
use tests\drivers\CliTestCase;
use Yii;
use yii\db\Query;

/**
Expand Down
Loading