Skip to content
Permalink
Browse files

Update PHP CS Fixer to v2.16 (#175)

  • Loading branch information...
kubawerlos committed Nov 7, 2019
1 parent 2443b83 commit f263ff1f1ed5fdb739dd6a5e38d0ae49bca087f6
Showing with 5 additions and 20 deletions.
  1. +3 −0 CHANGELOG.md
  2. +1 −1 composer.json
  3. +1 −19 src/Fixer/DataProviderReturnTypeFixer.php
@@ -1,5 +1,8 @@
# CHANGELOG for PHP CS Fixer: custom fixers

## [Unreleased]
- Update PHP CS Fixer to v2.16

## v1.16.0 - *2019-10-24*
- Add PhpdocOnlyAllowedAnnotationsFixer
- Feature: OperatorLinebreakFixer - handle object operators
@@ -12,7 +12,7 @@
"require": {
"php": "^7.1",
"ext-tokenizer": "*",
"friendsofphp/php-cs-fixer": "^2.14",
"friendsofphp/php-cs-fixer": "^2.16",
"symfony/finder": "^3.0 || ^4.0"
},
"autoload": {
@@ -9,7 +9,6 @@
use PhpCsFixer\FixerDefinition\FixerDefinitionInterface;
use PhpCsFixer\Indicator\PhpUnitTestCaseIndicator;
use PhpCsFixer\Preg;
use PhpCsFixer\Tokenizer\Analyzer\Analysis\TypeAnalysis;
use PhpCsFixer\Tokenizer\Analyzer\FunctionsAnalyzer;
use PhpCsFixer\Tokenizer\CT;
use PhpCsFixer\Tokenizer\Token;
@@ -105,7 +104,7 @@ private function fixNames(Tokens $tokens, int $startIndex, int $endIndex): void
continue;
}
if ($this->getTypeName($tokens, $typeAnalysis) !== 'iterable') {
if ($typeAnalysis->getName() !== 'iterable') {
/** @var int $startIndex */
$startIndex = $tokens->getNextMeaningfulToken($typeAnalysis->getStartIndex() - 1);
$tokens->overrideRange($startIndex, $typeAnalysis->getEndIndex(), [new Token([T_STRING, 'iterable'])]);
@@ -153,21 +152,4 @@ private function getDataProviderNames(Tokens $tokens, int $startIndex, int $endI
return $dataProviderNames;
}
/**
* TODO: remove this function after https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/4581 is released.
*/
private function getTypeName(Tokens $tokens, TypeAnalysis $typeAnalysis): string
{
$type = '';
for ($index = $typeAnalysis->getStartIndex(); $index <= $typeAnalysis->getEndIndex(); $index++) {
if ($tokens[$index]->isWhitespace() || $tokens[$index]->isComment()) {
continue;
}
$type .= $tokens[$index]->getContent();
}
return $type;
}
}

0 comments on commit f263ff1

Please sign in to comment.
You can’t perform that action at this time.