Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update php-cs-fixer to 3.0.0 #1959

Merged
merged 2 commits into from
May 26, 2021
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
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.php_cs.dist export-ignore
/.php-cs-fixer.dist.php export-ignore
/CHANGELOG.md merge=union
/codecov.yml export-ignore
/CONTRIBUTING.md export-ignore
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
php-version: '7.2'
coverage: 'none'
extensions: 'json, mbstring, tokenizer'
tools: 'composer-normalize:2.13.3, php-cs-fixer:2.18.6'
tools: 'composer-normalize:2.13.3, php-cs-fixer:3.0.0'

- name: 'Check PHP code'
run: |
php-cs-fixer fix --diff --dry-run --allow-risky=yes --using-cache=false
php-cs-fixer fix --diff --dry-run --allow-risky=yes --using-cache=no

- name: 'Check composer.json'
run: |
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.DS_Store
.idea
*.iml
.php_cs
.php_cs.cache
.php-cs-fixer.php
.php-cs-fixer.cache
.phpunit.result.cache

cache.properties
Expand Down
15 changes: 8 additions & 7 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(['src/', 'tests/'])
$finder = (new PhpCsFixer\Finder())
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
;

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setFinder($finder)
->setRules([
'@PHP71Migration' => true,
'@PhpCsFixer' => true,
'@PHPUnit75Migration:risky' => true,
'@PSR2' => true,
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'is_null' => true,
'list_syntax' => ['syntax' => 'short'],
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'native_constant_invocation' => true,
'native_function_invocation' => true,
'native_function_invocation' => [
'include' => ['@all'],
],
'no_alias_functions' => true,
'no_useless_else' => true,
'nullable_type_declaration_for_default_null_value' => true,
Expand All @@ -28,7 +29,7 @@
'phpdoc_types_order' => ['null_adjustment' => 'always_last'],
'static_lambda' => true,
'ternary_to_null_coalescing' => true,
'visibility_required' => ['property', 'method', 'const'],
'visibility_required' => ['elements' => ['property', 'method', 'const']],
'void_return' => true,
])
;
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: clean
clean:
rm -fr tools vendor build composer.lock .php_cs.cache
rm -fr tools vendor build composer.lock .php-cs-fixer.cache

tools/phive.phar:
mkdir tools; \
Expand Down Expand Up @@ -33,11 +33,11 @@ composer-update:
install-tools: install-phpcs

.PHONY: run-phpcs
run-phpcs: composer-install install-phpcs
tools/php-cs-fixer.phar fix --dry-run --allow-risky=yes -v
run-phpcs: install-phpcs
tools/php-cs-fixer.phar fix --diff --dry-run --allow-risky=yes -v

.PHONY: fix-phpcs
fix-phpcs: composer-install install-phpcs
fix-phpcs: install-phpcs
tools/php-cs-fixer.phar fix --allow-risky=yes -v

.PHONY: run-phpunit
Expand Down
2 changes: 1 addition & 1 deletion phive.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^2.18" installed="2.18.6" location="./tools/php-cs-fixer.phar" copy="true"/>
<phar name="php-cs-fixer" version="^3.0" installed="3.0.0" location="./tools/php-cs-fixer.phar" copy="true"/>
<phar name="php-coveralls" version="^2.2" installed="2.2.0" location="./tools/php-coveralls.phar" copy="true"/>
</phive>
2 changes: 1 addition & 1 deletion src/Aggregation/Range.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function addRange($fromValue = null, $toValue = null, ?string $key = null
*/
public function setKeyedResponse(bool $keyed = true): self
{
trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s()" method is deprecated, use "setKeyed()" instead. It will be removed in 8.0.', __METHOD__);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s()" method is deprecated, use "setKeyed()" instead. It will be removed in 8.0.', __METHOD__);

return $this->setKeyed($keyed);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/ElasticsearchException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Exception;

trigger_deprecation('ruflin/elastica', '5.2.0', 'The "%s" class is deprecated, use "Elastica\Exception\ResponseException::getResponse()::getFullError()" instead. It will be removed in 8.0.', ElasticsearchException::class);
\trigger_deprecation('ruflin/elastica', '5.2.0', 'The "%s" class is deprecated, use "Elastica\Exception\ResponseException::getResponse()::getFullError()" instead. It will be removed in 8.0.', ElasticsearchException::class);

/**
* Elasticsearch exception.
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/ResponseException.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getResponse(): Response
*/
public function getElasticsearchException(): ElasticsearchException
{
trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s()" method is deprecated, use "getResponse()::getFullError()" instead. It will be removed in 8.0.', __METHOD__);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s()" method is deprecated, use "getResponse()::getFullError()" instead. It will be removed in 8.0.', __METHOD__);

$response = $this->getResponse();

Expand Down
4 changes: 2 additions & 2 deletions src/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,11 @@ public function create(array $args = [], $options = null): Response
{
if (null === $options) {
if (\func_num_args() >= 2) {
trigger_deprecation('ruflin/elastica', '7.1.0', 'Passing null as 2nd argument to "%s()" is deprecated, avoid passing this argument or pass an array instead. It will be removed in 8.0.', __METHOD__);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'Passing null as 2nd argument to "%s()" is deprecated, avoid passing this argument or pass an array instead. It will be removed in 8.0.', __METHOD__);
}
$options = [];
} elseif (\is_bool($options)) {
trigger_deprecation('ruflin/elastica', '7.1.0', 'Passing a bool as 2nd argument to "%s()" is deprecated, pass an array with the key "recreate" instead. It will be removed in 8.0.', __METHOD__);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'Passing a bool as 2nd argument to "%s()" is deprecated, pass an array with the key "recreate" instead. It will be removed in 8.0.', __METHOD__);
$options = ['recreate' => $options];
} elseif (!\is_array($options)) {
throw new \TypeError(\sprintf('Argument 2 passed to "%s()" must be of type array|bool|null, %s given.', __METHOD__, \is_object($options) ? \get_class($options) : \gettype($options)));
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Append.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Append::class, AppendProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Append::class, AppendProcessor::class);

/**
* Elastica Append Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Attachment::class, AttachmentProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Attachment::class, AttachmentProcessor::class);

/**
* Elastica Attachment Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Convert.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Convert::class, ConvertProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Convert::class, ConvertProcessor::class);

/**
* Elastica Convert Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Date.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Date::class, DateProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Date::class, DateProcessor::class);

/**
* Elastica Date Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/DateIndexName.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', DateIndexName::class, DateIndexNameProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', DateIndexName::class, DateIndexNameProcessor::class);

/**
* Elastica DateIndexName Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/DotExpander.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', DotExpander::class, DotExpanderProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', DotExpander::class, DotExpanderProcessor::class);

/**
* Elastica DotExpander Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Fail.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Fail::class, FailProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Fail::class, FailProcessor::class);

/**
* Elastica Fail Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Join.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Join::class, JoinProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Join::class, JoinProcessor::class);

/**
* Elastica Join Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Json::class, JsonProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Json::class, JsonProcessor::class);

/**
* Elastica Json Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Kv.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Kv::class, KvProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Kv::class, KvProcessor::class);

/**
* Elastica KV Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Lowercase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Lowercase::class, LowercaseProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Lowercase::class, LowercaseProcessor::class);

/**
* Elastica Lowercase Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Remove.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Remove::class, RemoveProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Remove::class, RemoveProcessor::class);

/**
* Elastica Remove Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Rename.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Rename::class, RenameProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Rename::class, RenameProcessor::class);

/**
* Elastica Rename Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Set.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Set::class, SetProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Set::class, SetProcessor::class);

/**
* Elastica Set Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Sort.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Sort::class, SortProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Sort::class, SortProcessor::class);

/**
* Elastica Sort Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Split.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Split::class, SplitProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Split::class, SplitProcessor::class);

/**
* Elastica Split Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Trim.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Trim::class, TrimProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Trim::class, TrimProcessor::class);

/**
* Elastica Trim Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Processor/Uppercase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Processor;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Uppercase::class, UppercaseProcessor::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Uppercase::class, UppercaseProcessor::class);

/**
* Elastica Uppercase Processor.
Expand Down
2 changes: 1 addition & 1 deletion src/Query/Match.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Elastica\Query;

trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. "match" is a reserved keyword starting from PHP 8.0. It will be removed in 8.0.', Match::class, MatchQuery::class);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. "match" is a reserved keyword starting from PHP 8.0. It will be removed in 8.0.', Match::class, MatchQuery::class);

/**
* Match query.
Expand Down
2 changes: 1 addition & 1 deletion src/QueryBuilder/DSL/Aggregation.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function global(string $name): GlobalAggregation
*/
public function global_agg(string $name): GlobalAggregation
{
trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s()" method is deprecated, use "global()" instead. It will be removed in 8.0.', __METHOD__);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s()" method is deprecated, use "global()" instead. It will be removed in 8.0.', __METHOD__);

return $this->global($name);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Transport/HttpAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Ivory\HttpAdapter\Message\Response as HttpAdapterResponse;
use Ivory\HttpAdapter\Message\Stream\StringStream;

trigger_deprecation('ruflin/elastica', '7.1.1', 'The "%s" class is deprecated. It will be removed in 8.0.', HttpAdapter::class);
\trigger_deprecation('ruflin/elastica', '7.1.1', 'The "%s" class is deprecated. It will be removed in 8.0.', HttpAdapter::class);

/**
* @deprecated since version 7.1.1
Expand Down
2 changes: 1 addition & 1 deletion src/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public static function convertDateTimeObject(\DateTime $dateTime, bool $includeT
*/
public static function getParamName($class)
{
trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s()" method is deprecated. It will be removed in 8.0.', __METHOD__);
\trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s()" method is deprecated. It will be removed in 8.0.', __METHOD__);

if (\is_object($class)) {
$class = \get_class($class);
Expand Down