mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-11-29 20:09:08 +01:00
[CS] Use elseif instead of else if
Conflicts: lib/PhpParser/TokenStream.php
This commit is contained in:
parent
4366aa2fb0
commit
5285df8f22
@ -50,7 +50,7 @@ class Interface_ extends Declaration
|
||||
|
||||
if ($stmt instanceof Stmt\ClassConst) {
|
||||
$this->constants[] = $stmt;
|
||||
} else if ($stmt instanceof Stmt\ClassMethod) {
|
||||
} elseif ($stmt instanceof Stmt\ClassMethod) {
|
||||
// we erase all statements in the body of an interface method
|
||||
$stmt->stmts = null;
|
||||
$this->methods[] = $stmt;
|
||||
|
@ -34,9 +34,9 @@ class Trait_ extends Declaration
|
||||
|
||||
if ($stmt instanceof Stmt\Property) {
|
||||
$this->properties[] = $stmt;
|
||||
} else if ($stmt instanceof Stmt\ClassMethod) {
|
||||
} elseif ($stmt instanceof Stmt\ClassMethod) {
|
||||
$this->methods[] = $stmt;
|
||||
} else if ($stmt instanceof Stmt\TraitUse) {
|
||||
} elseif ($stmt instanceof Stmt\TraitUse) {
|
||||
$this->uses[] = $stmt;
|
||||
} else {
|
||||
throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));
|
||||
|
@ -184,7 +184,7 @@ final class BuilderHelpers {
|
||||
public static function normalizeDocComment($docComment) : Comment\Doc {
|
||||
if ($docComment instanceof Comment\Doc) {
|
||||
return $docComment;
|
||||
} else if (is_string($docComment)) {
|
||||
} elseif (is_string($docComment)) {
|
||||
return new Comment\Doc($docComment);
|
||||
} else {
|
||||
throw new \LogicException('Doc comment must be a string or an instance of PhpParser\Comment\Doc');
|
||||
|
@ -255,7 +255,7 @@ class Lexer
|
||||
$id = $this->tokenMap[$token[0]];
|
||||
if (\T_CLOSE_TAG === $token[0]) {
|
||||
$this->prevCloseTagHasNewline = false !== strpos($token[1], "\n");
|
||||
} else if (\T_INLINE_HTML === $token[0]) {
|
||||
} elseif (\T_INLINE_HTML === $token[0]) {
|
||||
$startAttributes['hasLeadingNewline'] = $this->prevCloseTagHasNewline;
|
||||
}
|
||||
|
||||
@ -357,7 +357,7 @@ class Lexer
|
||||
if ('T_HASHBANG' === $name) {
|
||||
// HHVM uses a special token for #! hashbang lines
|
||||
$tokenMap[$i] = Tokens::T_INLINE_HTML;
|
||||
} else if (defined($name = Tokens::class . '::' . $name)) {
|
||||
} elseif (defined($name = Tokens::class . '::' . $name)) {
|
||||
// Other tokens can be mapped directly
|
||||
$tokenMap[$i] = constant($name);
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ class Name extends NodeAbstract
|
||||
return null;
|
||||
} elseif (null === $name1) {
|
||||
return new static(self::prepareName($name2), $attributes);
|
||||
} else if (null === $name2) {
|
||||
} elseif (null === $name2) {
|
||||
return new static(self::prepareName($name1), $attributes);
|
||||
} else {
|
||||
return new static(
|
||||
|
@ -65,9 +65,9 @@ class NodeDumper
|
||||
} elseif (is_scalar($value)) {
|
||||
if ('flags' === $key || 'newModifier' === $key) {
|
||||
$r .= $this->dumpFlags($value);
|
||||
} else if ('type' === $key && $node instanceof Include_) {
|
||||
} elseif ('type' === $key && $node instanceof Include_) {
|
||||
$r .= $this->dumpIncludeType($value);
|
||||
} else if ('type' === $key
|
||||
} elseif ('type' === $key
|
||||
&& ($node instanceof Use_ || $node instanceof UseUse || $node instanceof GroupUse)) {
|
||||
$r .= $this->dumpUseType($value);
|
||||
} else {
|
||||
|
@ -226,7 +226,7 @@ class NodeTraverser implements NodeTraverserInterface
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (\is_array($node)) {
|
||||
} elseif (\is_array($node)) {
|
||||
throw new \LogicException('Invalid node structure: Contains nested arrays');
|
||||
}
|
||||
}
|
||||
|
@ -804,7 +804,7 @@ abstract class PrettyPrinterAbstract
|
||||
// Add new comments
|
||||
$result .= $this->pComments($comments) . $this->nl;
|
||||
}
|
||||
} else if ($diffType === DiffElem::TYPE_ADD) {
|
||||
} elseif ($diffType === DiffElem::TYPE_ADD) {
|
||||
if (null === $insertStr) {
|
||||
// We don't have insertion information for this list type
|
||||
return null;
|
||||
@ -836,7 +836,7 @@ abstract class PrettyPrinterAbstract
|
||||
} else {
|
||||
$result .= $insertStr;
|
||||
}
|
||||
} else if ($diffType === DiffElem::TYPE_REMOVE) {
|
||||
} elseif ($diffType === DiffElem::TYPE_REMOVE) {
|
||||
if ($i === 0) {
|
||||
// TODO Handle removal at the start
|
||||
return null;
|
||||
|
@ -214,7 +214,7 @@ class TokenStream {
|
||||
// TODO Handle non-space indentation
|
||||
if ($indent < 0) {
|
||||
$result .= str_replace("\n" . str_repeat(" ", -$indent), "\n", $content);
|
||||
} else if ($indent > 0) {
|
||||
} elseif ($indent > 0) {
|
||||
$result .= str_replace("\n", "\n" . str_repeat(" ", $indent), $content);
|
||||
} else {
|
||||
$result .= $content;
|
||||
|
@ -26,7 +26,7 @@ class CodeParsingTest extends CodeTestAbstract
|
||||
if (isset($modes['php5'])) {
|
||||
$this->assertSame($expected, $output5, $name);
|
||||
$this->assertNotSame($expected, $output7, $name);
|
||||
} else if (isset($modes['php7'])) {
|
||||
} elseif (isset($modes['php7'])) {
|
||||
$this->assertNotSame($expected, $output5, $name);
|
||||
$this->assertSame($expected, $output7, $name);
|
||||
} else {
|
||||
|
@ -140,10 +140,10 @@ class NodeAbstractTest extends TestCase
|
||||
if ($i === 0) {
|
||||
$this->assertSame('subNode1', $key);
|
||||
$this->assertSame('value1', $value);
|
||||
} else if ($i === 1) {
|
||||
} elseif ($i === 1) {
|
||||
$this->assertSame('subNode2', $key);
|
||||
$this->assertSame('value2', $value);
|
||||
} else if ($i === 2) {
|
||||
} elseif ($i === 2) {
|
||||
$this->assertSame('notSubNode', $key);
|
||||
$this->assertSame('value3', $value);
|
||||
} else {
|
||||
|
@ -45,7 +45,7 @@ class PrettyPrinterTest extends CodeTestAbstract
|
||||
if ('php5' === $version) {
|
||||
$this->assertSame($expected, $output5, $name);
|
||||
$this->assertNotSame($expected, $output7, $name);
|
||||
} else if ('php7' === $version) {
|
||||
} elseif ('php7' === $version) {
|
||||
$this->assertSame($expected, $output7, $name);
|
||||
$this->assertNotSame($expected, $output5, $name);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user