Skip to content

Commit

Permalink
Merge branch '2.16'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Console/Application.php
  • Loading branch information
keradus committed Nov 25, 2019
2 parents 301e059 + 343c2df commit 6ae130a
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 4 deletions.
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@ CHANGELOG for PHP CS Fixer

This file contains changelogs for stable releases only.

Changelog for v2.16.1
---------------------

* bug #4476 FunctionsAnalyzer - add "isTheSameClassCall" for correct verifying of function calls (kubawerlos)
* bug #4605 PhpdocToParamTypeFixer - cover more cases (keradus, julienfalque)
* bug #4626 FinalPublicMethodForAbstractClassFixer - Do not attempt to mark abstract public methods as final (localheinz)
* bug #4632 NullableTypeDeclarationForDefaultNullValueFixer - fix for not lowercase "null" (kubawerlos)
* bug #4638 Ensure compatibility with PHP 7.4 (julienfalque)
* bug #4641 Add typed properties test to VisibilityRequiredFixerTest (GawainLynch, julienfalque)
* bug #4654 ArrayIndentationFixer - Fix array indentation for multiline values (julienfalque)
* bug #4660 TokensAnalyzer::isConstantInvocation - fix for extending multiple interfaces (kubawerlos)
* bug #4668 TokensAnalyzer::isConstantInvocation - fix for interface method return type (kubawerlos)
* minor #4608 Allow Symfony 5 components (l-vo)
* minor #4622 Disallow PHP 7.4 failures on Travis CI (julienfalque)
* minor #4623 README - Mark up as code (localheinz)
* minor #4637 PHP 7.4 integration test (GawainLynch, julienfalque)
* minor #4643 DX: Update .gitattributes and move ci-integration.sh to root of the project (kubawerlos, keradus)
* minor #4645 Check PHP extensions on runtime (kubawerlos)
* minor #4655 Improve docs - README (mvorisek)
* minor #4662 DX: generate headers in README.rst (kubawerlos)
* minor #4669 Enable execution under PHP 7.4 (keradus)
* minor #4670 TravisTest - rewrite tests to allow last supported by tool PHP version to be snapshot (keradus)
* minor #4671 TravisTest - rewrite tests to allow last supported by tool PHP version to be snapshot (keradus)

Changelog for v2.16.0
---------------------

Expand All @@ -27,6 +51,24 @@ Changelog for v2.16.0
* minor #4619 Fix PHP 7.3 strict mode warnings (keradus)
* minor #4621 Add single_line_throw to Symfony ruleset (keradus)

Changelog for v2.15.5
---------------------

* bug #4476 FunctionsAnalyzer - add "isTheSameClassCall" for correct verifying of function calls (kubawerlos)
* bug #4641 Add typed properties test to VisibilityRequiredFixerTest (GawainLynch, julienfalque)
* bug #4654 ArrayIndentationFixer - Fix array indentation for multiline values (julienfalque)
* bug #4660 TokensAnalyzer::isConstantInvocation - fix for extending multiple interfaces (kubawerlos)
* bug #4668 TokensAnalyzer::isConstantInvocation - fix for interface method return type (kubawerlos)
* minor #4608 Allow Symfony 5 components (l-vo)
* minor #4622 Disallow PHP 7.4 failures on Travis CI (julienfalque)
* minor #4637 PHP 7.4 integration test (GawainLynch, julienfalque)
* minor #4643 DX: Update .gitattributes and move ci-integration.sh to root of the project (kubawerlos, keradus)
* minor #4645 Check PHP extensions on runtime (kubawerlos)
* minor #4655 Improve docs - README (mvorisek)
* minor #4662 DX: generate headers in README.rst (kubawerlos)
* minor #4669 Enable execution under PHP 7.4 (keradus)
* minor #4671 TravisTest - rewrite tests to allow last supported by tool PHP version to be snapshot (keradus)

Changelog for v2.15.4
---------------------

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ or with specified version:

.. code-block:: bash
$ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.16.0/php-cs-fixer.phar -O php-cs-fixer
$ wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.16.1/php-cs-fixer.phar -O php-cs-fixer
or with curl:

Expand Down Expand Up @@ -2006,7 +2006,7 @@ Config file

Instead of using command line options to customize the rule, you can save the
project configuration in a ``.php_cs.dist`` file in the root directory of your project.
The file must return an instance of `PhpCsFixer\\ConfigInterface <https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v2.16.0/src/ConfigInterface.php>`_
The file must return an instance of `PhpCsFixer\\ConfigInterface <https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v2.16.1/src/ConfigInterface.php>`_
which lets you configure the rules, the files and directories that
need to be analyzed. You may also create ``.php_cs`` file, which is
the local configuration that will be used instead of the project configuration. It
Expand Down
4 changes: 2 additions & 2 deletions src/Tokenizer/TokensAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,15 @@ public function isConstantInvocation($index)

$prevIndex = $this->tokens->getPrevMeaningfulToken($index);

if ($this->tokens[$prevIndex]->isGivenKind([T_AS, T_CLASS, T_CONST, T_DOUBLE_COLON, T_FUNCTION, T_GOTO, CT::T_GROUP_IMPORT_BRACE_OPEN, T_INTERFACE, T_OBJECT_OPERATOR, T_TRAIT])) {
if ($this->tokens[$prevIndex]->isGivenKind([T_AS, T_CLASS, T_CONST, T_DOUBLE_COLON, T_FUNCTION, T_GOTO, CT::T_GROUP_IMPORT_BRACE_OPEN, T_INTERFACE, T_OBJECT_OPERATOR, T_TRAIT, CT::T_TYPE_COLON])) {
return false;
}

while ($this->tokens[$prevIndex]->isGivenKind([CT::T_NAMESPACE_OPERATOR, T_NS_SEPARATOR, T_STRING])) {
$prevIndex = $this->tokens->getPrevMeaningfulToken($prevIndex);
}

if ($this->tokens[$prevIndex]->isGivenKind([CT::T_CONST_IMPORT, T_EXTENDS, CT::T_FUNCTION_IMPORT, T_IMPLEMENTS, T_INSTANCEOF, T_INSTEADOF, T_NAMESPACE, T_NEW, T_USE, CT::T_USE_TRAIT])) {
if ($this->tokens[$prevIndex]->isGivenKind([CT::T_CONST_IMPORT, T_EXTENDS, CT::T_FUNCTION_IMPORT, T_IMPLEMENTS, T_INSTANCEOF, T_INSTEADOF, T_NAMESPACE, T_NEW, CT::T_NULLABLE_TYPE, T_USE, CT::T_USE_TRAIT])) {
return false;
}

Expand Down
12 changes: 12 additions & 0 deletions tests/Tokenizer/TokensAnalyzerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,18 @@ public function provideIsConstantInvocation71Cases()
'<?php try {} catch (FOO|BAR|BAZ $e) {}',
[9 => false, 11 => false, 13 => false],
],
[
'<?php interface Foo { public function bar(): Baz; }',
[16 => false],
],
[
'<?php interface Foo { public function bar(): ?Baz; }',
[17 => false],
],
[
'<?php interface Foo { public function bar(): ?\Baz; }',
[18 => false],
],
];
}

Expand Down

0 comments on commit 6ae130a

Please sign in to comment.