diff --git a/.php_cs b/.php_cs index 83782b0f551..ed3195b2fca 100644 --- a/.php_cs +++ b/.php_cs @@ -1,14 +1,16 @@ in(__DIR__); + ->in(__DIR__ . '/lib') + ->in(__DIR__ . '/test') + ->append([__FILE__]) +; -$config = PhpCsFixer\Config::create() +return PhpCsFixer\Config::create() + ->setFinder($finder) ->setRiskyAllowed(true) ->setRules([ - + '@PSR2' => true, + 'return_assignment' => true, ]) - ->setFinder($finder) ; - -return $config; diff --git a/.travis.yml b/.travis.yml index 4630e91bffd..1759e22225e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,4 +28,5 @@ install: - travis_retry composer install --no-interaction script: + - PHP_CS_FIXER_FUTURE_MODE=1 ./vendor/bin/php-cs-fixer fix --ansi --diff --dry-run --verbose - $TEST_COMMAND diff --git a/composer.json b/composer.json index af0e7df5ad9..2be7bda9d9f 100644 --- a/composer.json +++ b/composer.json @@ -30,6 +30,7 @@ "phpunit/phpunit": "^7.0 || ^8.0", "php-http/guzzle6-adapter": "^1.0", "php-http/mock-client": "^1.0", + "friendsofphp/php-cs-fixer": "^2.15", "guzzlehttp/psr7": "^1.2", "cache/array-adapter": "^0.4" }, diff --git a/lib/Github/Api/AbstractApi.php b/lib/Github/Api/AbstractApi.php index 492e44ca4d8..a9204787659 100644 --- a/lib/Github/Api/AbstractApi.php +++ b/lib/Github/Api/AbstractApi.php @@ -126,9 +126,7 @@ protected function head($path, array $parameters = [], array $requestHeaders = [ unset($parameters['ref']); } - $response = $this->client->getHttpClient()->head($path.'?'.http_build_query($parameters), $requestHeaders); - - return $response; + return $this->client->getHttpClient()->head($path.'?'.http_build_query($parameters), $requestHeaders); } /** diff --git a/lib/Github/Api/GitData/Blobs.php b/lib/Github/Api/GitData/Blobs.php index be68771d9bd..c6269e86663 100644 --- a/lib/Github/Api/GitData/Blobs.php +++ b/lib/Github/Api/GitData/Blobs.php @@ -43,9 +43,7 @@ public function configure($bodyType = null) */ public function show($username, $repository, $sha) { - $response = $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs/'.rawurlencode($sha)); - - return $response; + return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/git/blobs/'.rawurlencode($sha)); } /** diff --git a/lib/Github/Api/Repository/Assets.php b/lib/Github/Api/Repository/Assets.php index dbe6da2251a..899b2db34c0 100644 --- a/lib/Github/Api/Repository/Assets.php +++ b/lib/Github/Api/Repository/Assets.php @@ -74,9 +74,7 @@ public function create($username, $repository, $id, $name, $contentType, $conten // Asset creation requires a separate endpoint, uploads.github.com. // Change the base url for the HTTP client temporarily while we execute // this request. - $response = $this->postRaw('https://uploads.github.com/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id).'/assets?name='.$name, $content, ['Content-Type' => $contentType]); - - return $response; + return $this->postRaw('https://uploads.github.com/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id).'/assets?name='.$name, $content, ['Content-Type' => $contentType]); } /**