From 0cbfc1c752b9fae8c7a0be740e5d6af496463e1e Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 22 Aug 2018 22:08:06 +0200 Subject: [PATCH] Style fixes --- easy-coding-standard.neon | 6 ++++++ src/Types/ContextFactory.php | 15 +++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon index 3f18bba..a76d463 100644 --- a/easy-coding-standard.neon +++ b/easy-coding-standard.neon @@ -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 diff --git a/src/Types/ContextFactory.php b/src/Types/ContextFactory.php index 54f3b73..fae433a 100644 --- a/src/Types/ContextFactory.php +++ b/src/Types/ContextFactory.php @@ -224,7 +224,7 @@ private function extractUseStatements(\ArrayIterator $tokens) $groupedNs = ''; $currentNs = ''; $currentAlias = null; - $state = "start"; + $state = 'start'; $i = 0; while ($tokens->valid()) { @@ -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: @@ -255,7 +255,7 @@ private function extractUseStatements(\ArrayIterator $tokens) break; } break; - case "start-alias": + case 'start-alias': switch ($tokenId) { case T_STRING: $currentAlias .= $tokenValue; @@ -268,7 +268,7 @@ private function extractUseStatements(\ArrayIterator $tokens) break; } break; - case "grouped": + case 'grouped': switch ($tokenId) { case T_STRING: case T_NS_SEPARATOR: @@ -290,7 +290,7 @@ private function extractUseStatements(\ArrayIterator $tokens) break; } break; - case "grouped-alias": + case 'grouped-alias': switch ($tokenId) { case T_STRING: $currentAlias .= $tokenValue; @@ -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; } }