Skip to content

Commit

Permalink
Merge pull request #65 from phpDocumentor/csfix
Browse files Browse the repository at this point in the history
Style fixes
  • Loading branch information
jaapio authored Aug 22, 2018
2 parents cd6802e + 0cbfc1c commit 8049085
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
6 changes: 6 additions & 0 deletions easy-coding-standard.neon
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ parameters:
- src/Types/Static_.php
- src/Types/String_.php
- src/Types/Void_.php
PhpCsFixer\Fixer\Import\OrderedImportsFixer:
- *tests/unit/Types/ContextFactoryTest.php
PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer:
- *tests/unit/Types/ContextFactoryTest.php
PhpCsFixer\Fixer\Import\SingleLineAfterImportsFixer:
- *tests/unit/Types/ContextFactoryTest.php
15 changes: 7 additions & 8 deletions src/Types/ContextFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private function extractUseStatements(\ArrayIterator $tokens)
$groupedNs = '';
$currentNs = '';
$currentAlias = null;
$state = "start";
$state = 'start';

$i = 0;
while ($tokens->valid()) {
Expand All @@ -233,7 +233,7 @@ private function extractUseStatements(\ArrayIterator $tokens)
$tokenId = is_string($currentToken) ? $currentToken : $currentToken[0];
$tokenValue = is_string($currentToken) ? null : $currentToken[1];
switch ($state) {
case "start":
case 'start':
switch ($tokenId) {
case T_STRING:
case T_NS_SEPARATOR:
Expand All @@ -255,7 +255,7 @@ private function extractUseStatements(\ArrayIterator $tokens)
break;
}
break;
case "start-alias":
case 'start-alias':
switch ($tokenId) {
case T_STRING:
$currentAlias .= $tokenValue;
Expand All @@ -268,7 +268,7 @@ private function extractUseStatements(\ArrayIterator $tokens)
break;
}
break;
case "grouped":
case 'grouped':
switch ($tokenId) {
case T_STRING:
case T_NS_SEPARATOR:
Expand All @@ -290,7 +290,7 @@ private function extractUseStatements(\ArrayIterator $tokens)
break;
}
break;
case "grouped-alias":
case 'grouped-alias':
switch ($tokenId) {
case T_STRING:
$currentAlias .= $tokenValue;
Expand All @@ -309,18 +309,17 @@ private function extractUseStatements(\ArrayIterator $tokens)
}
}

if ($state == "end") {
if ($state === 'end') {
break;
}

$tokens->next();
}

if ($groupedNs != $currentNs) {
if ($groupedNs !== $currentNs) {
$extractedUseStatements[$currentAlias ?: $currentNs] = $currentNs;
}


return $extractedUseStatements;
}
}

0 comments on commit 8049085

Please sign in to comment.