mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-28 11:09:26 +00:00
Add PHP-CS-Fixer to check for unused imports
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
"require-dev": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "*",
|
||||
"ext-gd": "*",
|
||||
"friendsofphp/php-cs-fixer": "*",
|
||||
"phpcompatibility/php-compatibility": "dev-develop",
|
||||
"phpcsstandards/phpcsutils": "@alpha",
|
||||
"phpunit/phpunit": "*",
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
require 'flickr.class.php';
|
||||
|
||||
use Curl\Curl;
|
||||
use Flickr\Flickr;
|
||||
|
||||
$flickr = new Flickr();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use Curl\Curl;
|
||||
use Curl\MultiCurl;
|
||||
|
||||
$concurrency = 3;
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace Curl;
|
||||
|
||||
use Curl\CaseInsensitiveArray;
|
||||
|
||||
class ArrayUtil
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
|
||||
namespace Curl;
|
||||
|
||||
use Curl\ArrayUtil;
|
||||
use Curl\BaseCurl;
|
||||
use Curl\Url;
|
||||
|
||||
class Curl extends BaseCurl
|
||||
{
|
||||
const VERSION = '9.17.1';
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
|
||||
namespace Curl;
|
||||
|
||||
use Curl\ArrayUtil;
|
||||
use Curl\BaseCurl;
|
||||
use Curl\Url;
|
||||
|
||||
class MultiCurl extends BaseCurl
|
||||
{
|
||||
public $baseUrl = null;
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace Curl;
|
||||
|
||||
use Curl\StringUtil;
|
||||
|
||||
class Url
|
||||
{
|
||||
private $baseUrl = null;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->in(dirname(__DIR__));
|
||||
|
||||
$config = new PhpCsFixer\Config();
|
||||
$config
|
||||
->setRules([
|
||||
'no_unused_imports' => true,
|
||||
])
|
||||
->setFinder($finder);
|
||||
|
||||
return $config;
|
||||
@@ -4008,7 +4008,7 @@ class PHPCurlClassTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$expected_response = '{"name":"Alice","email":"alice@example.com"}';
|
||||
|
||||
$user = new \Helper\User('Alice', 'alice@example.com');
|
||||
$user = new User('Alice', 'alice@example.com');
|
||||
$this->assertEquals($expected_response, json_encode($user));
|
||||
|
||||
$test = new Test();
|
||||
|
||||
@@ -132,6 +132,7 @@ if [[ ! -z "${is_null}" ]]; then
|
||||
errors+=("${result}")
|
||||
fi
|
||||
|
||||
# Run PHP_CodeSniffer.
|
||||
if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then :
|
||||
elif [[ "${CI_PHP_VERSION}" == "7.1" ]]; then :
|
||||
else
|
||||
@@ -153,8 +154,19 @@ else
|
||||
-s \
|
||||
.
|
||||
if [[ "${?}" -ne 0 ]]; then
|
||||
echo "Error: found coding standard violation(s)"
|
||||
errors+=("found coding standard violation(s)")
|
||||
echo "Error: found PHP_CodeSniffer coding standard violation(s)"
|
||||
errors+=("found PHP_CodeSniffer coding standard violation(s)")
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# Run PHP-CS-Fixer.
|
||||
if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then :
|
||||
else
|
||||
vendor/bin/php-cs-fixer --version
|
||||
vendor/bin/php-cs-fixer fix --ansi --config="tests/.php-cs-fixer.php" --diff --dry-run
|
||||
if [[ "${?}" -ne 0 ]]; then
|
||||
echo "Error: found PHP-CS-Fixer coding standard violation(s)"
|
||||
errors+=("found PHP-CS-Fixer coding standard violation(s)")
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user