Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: linter
name: code style

permissions:
contents: read
Expand All @@ -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"]'
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
30 changes: 30 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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/#',
]);

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',
],
]);
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand All @@ -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"
Expand Down
20 changes: 0 additions & 20 deletions phpcs.xml.dist

This file was deleted.

1 change: 0 additions & 1 deletion src/CurlFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace yii\httpclient;

use Yii;
use yii\base\BaseObject;

/**
Expand Down
2 changes: 0 additions & 2 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use yii\web\Cookie;
use yii\web\CookieCollection;
use yii\web\HeaderCollection;
use Yii;

/**
* Message represents a base HTTP message.
Expand Down Expand Up @@ -246,7 +245,6 @@ public function hasContent($key)
}



/**
* Sets the data fields, which composes message content.
* @param mixed $data content data fields.
Expand Down
6 changes: 6 additions & 0 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\httpclient\Client;
Expand Down
6 changes: 6 additions & 0 deletions tests/CurlFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\httpclient\CurlFormatter;
Expand Down
6 changes: 6 additions & 0 deletions tests/CurlTransportTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\httpclient\Client;
Expand Down
6 changes: 6 additions & 0 deletions tests/JsonFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\helpers\Json;
Expand Down
9 changes: 8 additions & 1 deletion tests/JsonParserTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\helpers\Json;
Expand Down Expand Up @@ -53,7 +59,8 @@ public function testParse2(): void
],
'errors' => null,
];
$document->setContent(<<<JSON
$document->setContent(
<<<JSON
{
"code": 412,
"httpMessage": "Precondition Failed",
Expand Down
6 changes: 6 additions & 0 deletions tests/MessageTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\httpclient\Message;
Expand Down
7 changes: 6 additions & 1 deletion tests/MockTransportTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\httpclient\Client;
use yii\httpclient\MockTransport;
use yii\httpclient\Request;
use yii\httpclient\Response;

final class MockTransportTest extends TestCase
Expand Down
6 changes: 6 additions & 0 deletions tests/RequestTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\httpclient\Client;
Expand Down
6 changes: 6 additions & 0 deletions tests/ResponseTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\httpclient\Client;
Expand Down
6 changes: 6 additions & 0 deletions tests/StreamTransportTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\httpclient\StreamTransport;
Expand Down
6 changes: 6 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\di\Container;
Expand Down
6 changes: 6 additions & 0 deletions tests/TransportTestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use Yii;
Expand Down
6 changes: 6 additions & 0 deletions tests/UrlEncodedFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\httpclient\Request;
Expand Down
6 changes: 6 additions & 0 deletions tests/UrlEncodedParserTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\httpclient\UrlEncodedParser;
Expand Down
6 changes: 6 additions & 0 deletions tests/XmlFormatterTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use DOMDocument;
Expand Down
6 changes: 6 additions & 0 deletions tests/XmlParserTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

namespace yiiunit\extensions\httpclient;

use yii\httpclient\Response;
Expand Down
7 changes: 7 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license https://www.yiiframework.com/license/
*/

// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols

// ensure we get report on all possible php errors
error_reporting(-1);

Expand Down
Loading