1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-01-17 05:18:13 +01:00

Upgrade PHP-CS-Fixer to 3.x (#2937)

This commit is contained in:
Fabien Villepinte 2021-10-05 17:50:51 +02:00 committed by GitHub
parent e38c668f3b
commit 6b499cc5e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 17 additions and 18 deletions

2
.gitattributes vendored
View File

@ -2,7 +2,7 @@
.gitattributes export-ignore .gitattributes export-ignore
/.github/ export-ignore /.github/ export-ignore
.gitignore export-ignore .gitignore export-ignore
.php_cs.dist export-ignore .php-cs-fixer.dist.php export-ignore
/docs/ export-ignore /docs/ export-ignore
/Dockerfile export-ignore /Dockerfile export-ignore
/Makefile export-ignore /Makefile export-ignore

View File

@ -53,7 +53,7 @@ jobs:
run: composer bin php-cs-fixer update --no-interaction --no-progress run: composer bin php-cs-fixer update --no-interaction --no-progress
- name: Execute PHP CS Fixer - name: Execute PHP CS Fixer
run: vendor/bin/php-cs-fixer fix --diff-format udiff --dry-run run: vendor/bin/php-cs-fixer fix --diff --dry-run
psalm: psalm:
name: Psalm name: Psalm

4
.gitignore vendored
View File

@ -1,5 +1,5 @@
.php_cs .php-cs-fixer.php
.php_cs.cache .php-cs-fixer.cache
.phpunit.result.cache .phpunit.result.cache
composer.lock composer.lock
vendor/ vendor/

View File

@ -1,24 +1,22 @@
<?php <?php
$config = PhpCsFixer\Config::create() $config = (new PhpCsFixer\Config())
->setRiskyAllowed(true) ->setRiskyAllowed(true)
->setRules([ ->setRules([
'@PSR2' => true, '@PSR2' => true,
'array_syntax' => ['syntax' => 'short'], 'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => ['operators' => ['=>' => null]], 'binary_operator_spaces' => ['operators' => ['=>' => null]],
'blank_line_after_opening_tag' => true, 'blank_line_after_opening_tag' => true,
'class_attributes_separation' => ['elements' => ['method']], 'class_attributes_separation' => ['elements' => ['method' => 'one']],
'compact_nullable_typehint' => true, 'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'], 'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'], 'declare_equal_normalize' => ['space' => 'none'],
'declare_strict_types' => false, 'declare_strict_types' => false,
'dir_constant' => true, 'dir_constant' => true,
'final_static_access' => true,
'fully_qualified_strict_types' => true, 'fully_qualified_strict_types' => true,
'function_to_constant' => true, 'function_to_constant' => true,
'function_typehint_space' => true, 'function_typehint_space' => true,
'header_comment' => false, 'header_comment' => false,
'is_null' => ['use_yoda_style' => false],
'list_syntax' => ['syntax' => 'short'], 'list_syntax' => ['syntax' => 'short'],
'lowercase_cast' => true, 'lowercase_cast' => true,
'magic_method_casing' => true, 'magic_method_casing' => true,
@ -66,6 +64,7 @@ $config = PhpCsFixer\Config::create()
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'phpdoc_var_without_name' => true, 'phpdoc_var_without_name' => true,
'return_assignment' => true, 'return_assignment' => true,
'self_static_accessor' => true,
'short_scalar_cast' => true, 'short_scalar_cast' => true,
'single_trait_insert_per_statement' => true, 'single_trait_insert_per_statement' => true,
'standardize_not_equals' => true, 'standardize_not_equals' => true,

View File

@ -77,7 +77,7 @@ static-phpstan-update-baseline:
static-codestyle-fix: static-codestyle-fix:
composer install composer install
composer bin php-cs-fixer update composer bin php-cs-fixer update
vendor/bin/php-cs-fixer fix --diff-format udiff $(CS_PARAMS) vendor/bin/php-cs-fixer fix --diff $(CS_PARAMS)
static-codestyle-check: static-codestyle-check:
$(MAKE) static-codestyle-fix CS_PARAMS="--dry-run" $(MAKE) static-codestyle-fix CS_PARAMS="--dry-run"

View File

@ -16,7 +16,7 @@ interface ClientInterface
/** /**
* The Guzzle major version. * The Guzzle major version.
*/ */
const MAJOR_VERSION = 7; public const MAJOR_VERSION = 7;
/** /**
* Send an HTTP request. * Send an HTTP request.

View File

@ -15,7 +15,7 @@ use Psr\Http\Message\ResponseInterface;
class HandlerStack class HandlerStack
{ {
/** /**
* @var null|callable(RequestInterface, array): PromiseInterface * @var (callable(RequestInterface, array): PromiseInterface)|null
*/ */
private $handler; private $handler;
@ -25,7 +25,7 @@ class HandlerStack
private $stack = []; private $stack = [];
/** /**
* @var null|callable(RequestInterface, array): PromiseInterface * @var (callable(RequestInterface, array): PromiseInterface)|null
*/ */
private $cached; private $cached;
@ -40,7 +40,7 @@ class HandlerStack
* The returned handler stack can be passed to a client in the "handler" * The returned handler stack can be passed to a client in the "handler"
* option. * option.
* *
* @param null|callable(RequestInterface, array): PromiseInterface $handler HTTP handler function to use with the stack. If no * @param (callable(RequestInterface, array): PromiseInterface)|null $handler HTTP handler function to use with the stack. If no
* handler is provided, the best handler for your * handler is provided, the best handler for your
* system will be utilized. * system will be utilized.
*/ */
@ -56,7 +56,7 @@ class HandlerStack
} }
/** /**
* @param null|callable(RequestInterface, array): PromiseInterface $handler Underlying HTTP handler. * @param (callable(RequestInterface, array): PromiseInterface)|null $handler Underlying HTTP handler.
*/ */
public function __construct(callable $handler = null) public function __construct(callable $handler = null)
{ {

View File

@ -36,7 +36,7 @@ class RetryMiddleware
* returns true if the request is to be * returns true if the request is to be
* retried. * retried.
* @param callable(RequestInterface, array): PromiseInterface $nextHandler Next handler to invoke. * @param callable(RequestInterface, array): PromiseInterface $nextHandler Next handler to invoke.
* @param null|callable(int): int $delay Function that accepts the number of retries * @param (callable(int): int)|null $delay Function that accepts the number of retries
* and returns the number of * and returns the number of
* milliseconds to delay. * milliseconds to delay.
*/ */

View File

@ -1,7 +1,7 @@
{ {
"require": { "require": {
"php": "^7.2.5 || ^8.0", "php": "^7.2.5 || ^8.0",
"friendsofphp/php-cs-fixer": "2.18.3" "friendsofphp/php-cs-fixer": "3.2.1"
}, },
"config": { "config": {
"preferred-install": "dist" "preferred-install": "dist"