Skip to content

Commit

Permalink
Removed PHP7 code
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm committed Mar 20, 2020
1 parent 061a7af commit 3adc34e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/Fixer/Preload/ExplicitlyLoadClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens)

}

private function parse(Tokens $tokens, string $functionName): array
/**
* @var string $functionName
* @return string[] classes
*/
private function parse(Tokens $tokens, $functionName)
{
$classes = [];
$index = $this->findFunction($tokens, $functionName);
Expand Down Expand Up @@ -103,7 +107,7 @@ private function parse(Tokens $tokens, string $functionName): array
*
* @return string[]
*/
private function getPreloadedClasses(\SplFileInfo $file, Tokens $tokens): array
private function getPreloadedClasses(\SplFileInfo $file, Tokens $tokens)
{
$classes = [];

Expand All @@ -124,10 +128,13 @@ private function getPreloadedClasses(\SplFileInfo $file, Tokens $tokens): array


/**
* Find a function in the tokens. Return the index or null.
* The index is to the "function" token.
* Find a function in the tokens.
*
* @param Tokens $tokens
* @param string $name
* @return int|null the index or null. The index is to the "function" token.
*/
private function findFunction(Tokens $tokens, string $name): ?int
private function findFunction(Tokens $tokens, $name)
{
foreach ($tokens as $index => $token) {
if (!$token->isGivenKind(T_FUNCTION)) {
Expand All @@ -147,7 +154,7 @@ private function findFunction(Tokens $tokens, string $name): ?int
return null;
}

private function injectClasses(Tokens $tokens, array $classes): void
private function injectClasses(Tokens $tokens, array $classes)
{
$insertAfter = null;
foreach ($tokens as $index => $token) {
Expand Down

0 comments on commit 3adc34e

Please sign in to comment.