diff --git a/.github/workflows/linter.yml b/.github/workflows/code-style.yml
similarity index 63%
rename from .github/workflows/linter.yml
rename to .github/workflows/code-style.yml
index 1c53325..dfb84ca 100644
--- a/.github/workflows/linter.yml
+++ b/.github/workflows/code-style.yml
@@ -1,4 +1,4 @@
-name: linter
+name: code style
permissions:
contents: read
@@ -22,5 +22,8 @@ on:
push: *ignore-paths
jobs:
- phpcs:
- uses: yiisoft/yii2-actions/.github/workflows/linter.yml@master
+ php-cs-fixer:
+ uses: yiisoft/yii2-actions/.github/workflows/php-cs-fixer.yml@9bfbe47bd91bc31a6ff9f0ea77ba3724d7816c3d # master
+ with:
+ configuration: .php-cs-fixer.dist.php
+ php-version: '["7.4"]'
diff --git a/.gitignore b/.gitignore
index 4c3b916..674dac2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,3 +32,7 @@ phpunit.phar
# local tests configuration
/tests/data/config.local.php
/tests/runtime
+
+# PHP CS Fixer
+.php-cs-fixer.php
+.php-cs-fixer.cache
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
new file mode 100644
index 0000000..67d9f35
--- /dev/null
+++ b/.php-cs-fixer.dist.php
@@ -0,0 +1,30 @@
+in([
+ __DIR__ . '/src',
+ __DIR__ . '/tests',
+ ])
+ ->notPath([
+ '#(^|/)views/#',
+ ]);
+
+return (new Config())
+ ->setFinder($finder)
+ ->setRules([
+ '@PSR2' => true,
+ 'no_unused_imports' => true,
+ 'phpdoc_scalar' => true,
+ 'header_comment' => [
+ 'comment_type' => 'PHPDoc',
+ 'header' => $header,
+ 'location' => 'after_open',
+ ],
+ ]);
diff --git a/composer.json b/composer.json
index a0ea612..a8bd0c2 100644
--- a/composer.json
+++ b/composer.json
@@ -27,9 +27,9 @@
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"yiisoft/yii2-debug": "^2.1",
- "yiisoft/yii2-coding-standards": "^3.0",
"rector/rector": "^2.6",
- "mspirkov/yii2-rector": "^0.1"
+ "mspirkov/yii2-rector": "^0.1",
+ "friendsofphp/php-cs-fixer": "^3.95"
},
"repositories": [
{
@@ -53,8 +53,8 @@
}
},
"scripts": {
- "cs": "./vendor/bin/phpcs",
- "cs-fix": "./vendor/bin/phpcbf",
+ "cs": "./vendor/bin/php-cs-fixer check",
+ "cs-fix": "./vendor/bin/php-cs-fixer fix",
"static": "./vendor/bin/phpstan --memory-limit=-1",
"tests": "./vendor/bin/phpunit",
"rector": "./vendor/bin/rector"
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
deleted file mode 100644
index 6530e7b..0000000
--- a/phpcs.xml.dist
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
- src
- tests
-
-
- /Request\.php$
- /MockTransport\.php$
- /tests/MockTransportTest\.php$
-
-
- /tests/XmlFormatterTest\.php$
-
-
diff --git a/src/CurlFormatter.php b/src/CurlFormatter.php
index 4ced136..994a586 100644
--- a/src/CurlFormatter.php
+++ b/src/CurlFormatter.php
@@ -8,7 +8,6 @@
namespace yii\httpclient;
-use Yii;
use yii\base\BaseObject;
/**
diff --git a/src/Message.php b/src/Message.php
index 8175cf1..2e598a9 100644
--- a/src/Message.php
+++ b/src/Message.php
@@ -13,7 +13,6 @@
use yii\web\Cookie;
use yii\web\CookieCollection;
use yii\web\HeaderCollection;
-use Yii;
/**
* Message represents a base HTTP message.
@@ -246,7 +245,6 @@ public function hasContent($key)
}
-
/**
* Sets the data fields, which composes message content.
* @param mixed $data content data fields.
diff --git a/tests/ClientTest.php b/tests/ClientTest.php
index ad8e8eb..186b1a3 100644
--- a/tests/ClientTest.php
+++ b/tests/ClientTest.php
@@ -1,5 +1,11 @@
null,
];
- $document->setContent(<<setContent(
+ <<