From 24dde348e071939d8ee21b79c7b47c18fe52d5af Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 9 Mar 2019 13:24:30 +0000 Subject: [PATCH] update overviews --- docs/AllRectorsOverview.md | 443 ++++++++++++++++++++++++++++-------- docs/NodesOverview.md | 455 ++++++++++++++++++++++++------------- 2 files changed, 650 insertions(+), 248 deletions(-) diff --git a/docs/AllRectorsOverview.md b/docs/AllRectorsOverview.md index 7ba128e7cf7..5916c3d3894 100644 --- a/docs/AllRectorsOverview.md +++ b/docs/AllRectorsOverview.md @@ -1,4 +1,4 @@ -# All 223 Rectors Overview +# All 234 Rectors Overview - [Projects](#projects) - [General](#general) @@ -6,6 +6,7 @@ ## Projects - [CakePHP](#cakephp) +- [Celebrity](#celebrity) - [CodeQuality](#codequality) - [CodingStyle](#codingstyle) - [DeadCode](#deadcode) @@ -13,6 +14,7 @@ - [DomainDrivenDesign](#domaindrivendesign) - [Guzzle](#guzzle) - [Jms](#jms) +- [Laravel](#laravel) - [MysqlToMysqli](#mysqltomysqli) - [NetteToSymfony](#nettetosymfony) - [PHPStan](#phpstan) @@ -49,6 +51,65 @@ Changes combined set/get `value()` to specific `getValue()` or `setValue(x)`.
+## Celebrity + +### `SetTypeToCastRector` + +- class: `Rector\Celebrity\Rector\FuncCall\SetTypeToCastRector` + +Changes settype() to (type) where possible + +```diff + class SomeClass + { +- public function run($foo) ++ public function run(array $items) + { +- settype($foo, 'string'); ++ $foo = (string) $foo; + +- return settype($foo, 'integer'); ++ return (int) $foo; + } + } +``` + +
+ +### `CommonNotEqualRector` + +- class: `Rector\Celebrity\Rector\NotEqual\CommonNotEqualRector` + +Use common != instead of less known <> with same meaning + +```diff + final class SomeClass + { + public function run($one, $two) + { +- return $one <> $two; ++ return $one != $two; + } + } +``` + +
+ +### `LogicalToBooleanRector` + +- class: `Rector\Celebrity\Rector\BooleanOp\LogicalToBooleanRector` + +Change OR, AND to ||, && with more common understanding + +```diff +-if ($f = false or true) { ++if (($f = false) || true) { + return $f; + } +``` + +
+ ## CodeQuality ### `CombinedAssignRector` @@ -85,6 +146,26 @@ Use ===/!== over ==/!=, it values have the same type
+### `SimplifyDuplicatedTernaryRector` + +- class: `Rector\CodeQuality\Rector\Ternary\SimplifyDuplicatedTernaryRector` + +Remove ternary that duplicated return value of true : false + +```diff + class SomeClass + { + public function run(bool $value, string $name) + { +- $isTrue = $value ? true : false; ++ $isTrue = $value; + $isName = $name ? true : false; + } + } +``` + +
+ ### `TernaryToElvisRector` - class: `Rector\CodeQuality\Rector\Ternary\TernaryToElvisRector` @@ -432,21 +513,6 @@ Simplify `is_array` and `empty` functions combination into a simple identical ch
-### `LogicalOrToBooleanOrRector` - -- class: `Rector\CodeQuality\Rector\LogicalOr\LogicalOrToBooleanOrRector` - -Change OR to || with more common understanding - -```diff --if ($f = false or true) { -+if (($f = false) || true) { - return $f; - } -``` - -
- ### `GetClassToInstanceOfRector` - class: `Rector\CodeQuality\Rector\Identical\GetClassToInstanceOfRector` @@ -460,6 +526,27 @@ Changes comparison with get_class to instanceof
+### `SimplifyBoolIdenticalTrueRector` + +- class: `Rector\CodeQuality\Rector\Identical\SimplifyBoolIdenticalTrueRector` + +Symplify bool value compare to true or false + +```diff + class SomeClass + { + public function run(bool $value, string $items) + { +- $match = in_array($value, $items, TRUE) === TRUE; +- $match = in_array($value, $items, TRUE) !== FALSE; ++ $match = in_array($value, $items, TRUE); ++ $match = in_array($value, $items, TRUE); + } + } +``` + +
+ ### `SimplifyConditionsRector` - class: `Rector\CodeQuality\Rector\Identical\SimplifyConditionsRector` @@ -510,25 +597,6 @@ Joins concat of 2 strings
-### `CommonNotEqualRector` - -- class: `Rector\CodeQuality\Rector\NotEqual\CommonNotEqualRector` - -Use common != instead of less known <> with same meaning - -```diff - final class SomeClass - { - public function run($one, $two) - { -- return $one <> $two; -+ return $one != $two; - } - } -``` - -
- ## CodingStyle ### `ReturnArrayClassMethodToYieldRector` @@ -587,6 +655,27 @@ services:
+### `SymplifyQuoteEscapeRector` + +- class: `Rector\CodingStyle\Rector\String_\SymplifyQuoteEscapeRector` + +Prefer quote that not inside the string + +```diff + class SomeClass + { + public function run() + { +- $name = "\" Tom"; +- $name = '\' Sara'; ++ $name = '" Tom'; ++ $name = "' Sara"; + } + } +``` + +
+ ### `RemoveUnusedAliasRector` - class: `Rector\CodingStyle\Rector\Use_\RemoveUnusedAliasRector` @@ -605,29 +694,6 @@ Removes unused use aliases
-### `SetTypeToCastRector` - -- class: `Rector\CodingStyle\Rector\FuncCall\SetTypeToCastRector` - -Changes settype() to (type) where possible - -```diff - class SomeClass - { -- public function run($foo) -+ public function run(array $items) - { -- settype($foo, 'string'); -+ $foo = (string) $foo; - -- return settype($foo, 'integer'); -+ return (int) $foo; - } - } -``` - -
- ### `ConsistentImplodeRector` - class: `Rector\CodingStyle\Rector\FuncCall\ConsistentImplodeRector` @@ -839,6 +905,23 @@ Remove unused parameter, if not required by interface or parent class
+### `RemoveDeadConstructorRector` + +- class: `Rector\DeadCode\Rector\ClassMethod\RemoveDeadConstructorRector` + +Remove empty constructor + +```diff + class SomeClass + { +- public function __construct() +- { +- } + } +``` + +
+ ### `RemoveUnusedPrivateMethodRector` - class: `Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector` @@ -1078,6 +1161,99 @@ Changes properties with `@JMS\DiExtraBundle\Annotation\Inject` to constructor in
+## Laravel + +### `MinutesToSecondsInCacheRector` + +- class: `Rector\Laravel\Rector\StaticCall\MinutesToSecondsInCacheRector` + +Change minutes argument to seconds in Illuminate\Contracts\Cache\Store and Illuminate\Support\Facades\Cache + +```diff + class SomeClass + { + public function run() + { +- Illuminate\Support\Facades\Cache::put('key', 'value', 60); ++ Illuminate\Support\Facades\Cache::put('key', 'value', 60 * 60); + } + } +``` + +
+ +### `FacadeStaticCallToConstructorInjectionRector` + +- class: `Rector\Laravel\Rector\StaticCall\FacadeStaticCallToConstructorInjectionRector` + +Move Illuminate\Support\Facades\* static calls to constructor injection + +```diff + use Illuminate\Support\Facades\Response; + + class ExampleController extends Controller + { ++ /** ++ * @var \Illuminate\Contracts\Routing\ResponseFactory ++ */ ++ private $responseFactory; ++ ++ public function __construct(\Illuminate\Contracts\Routing\ResponseFactory $responseFactory) ++ { ++ $this->responseFactory = $responseFactory; ++ } ++ + public function store() + { +- return Response::view('example', ['new_example' => 123]); ++ return $this->responseFactory->view('example', ['new_example' => 123]); + } + } +``` + +
+ +### `Redirect301ToPermanentRedirectRector` + +- class: `Rector\Laravel\Rector\StaticCall\Redirect301ToPermanentRedirectRector` + +Change "redirect" call with 301 to "permanentRedirect" + +```diff + class SomeClass + { + public function run() + { +- Illuminate\Routing\Route::redirect('/foo', '/bar', 301); ++ Illuminate\Routing\Route::permanentRedirect('/foo', '/bar'); + } + } +``` + +
+ +### `RequestStaticValidateToInjectRector` + +- class: `Rector\Laravel\Rector\StaticCall\RequestStaticValidateToInjectRector` + +Change static validate() method to $request->validate() + +```diff + use Illuminate\Http\Request; + + class SomeClass + { +- public function store() ++ public function store(\Illuminate\Http\Request $request) + { +- $validatedData = Request::validate(['some_attribute' => 'required']); ++ $validatedData = $request->validate(['some_attribute' => 'required']); + } + } +``` + +
+ ## MysqlToMysqli ### `MysqlAssignToMysqliRector` @@ -2097,6 +2273,27 @@ Changes rand, srand and getrandmax by new md_* alternatives.
+### `PregReplaceEModifierRector` + +- class: `Rector\Php\Rector\FuncCall\PregReplaceEModifierRector` + +The /e modifier is no longer supported, use preg_replace_callback instead + +```diff + class SomeClass + { + public function run() + { +- $comment = preg_replace('~\b(\w)(\w+)~e', '"$1".strtolower("$2")', $comment); ++ $comment = preg_replace_callback('~\b(\w)(\w+)~', function ($matches) { ++ return($matches[1].strtolower($matches[2])); ++ }, , $comment); + } + } +``` + +
+ ### `FilterVarToAddSlashesRector` - class: `Rector\Php\Rector\FuncCall\FilterVarToAddSlashesRector` @@ -2367,6 +2564,26 @@ Adds JSON_THROW_ON_ERROR to json_encode() and json_decode() to throw JsonExcepti
+### `StringifyDefineRector` + +- class: `Rector\Php\Rector\FuncCall\StringifyDefineRector` + +Make first argument of define() string + +```diff + class SomeClass + { + public function run(int $a) + { +- define(CONSTANT_2, 'value'); ++ define('CONSTANT_2', 'value'); + define('CONSTANT', 'value'); + } + } +``` + +
+ ### `SwapFuncCallArgumentsRector` - class: `Rector\Php\Rector\FuncCall\SwapFuncCallArgumentsRector` @@ -3503,15 +3720,15 @@ services:
-### `StaticRenameMethodRector` +### `RenameStaticMethodRector` -- class: `Rector\Rector\MethodCall\StaticRenameMethodRector` +- class: `Rector\Rector\MethodCall\RenameStaticMethodRector` Turns method names to new ones. ```yaml services: - Rector\Rector\MethodCall\StaticRenameMethodRector: + Rector\Rector\MethodCall\RenameStaticMethodRector: SomeClass: oldMethod: - AnotherExampleClass @@ -3527,7 +3744,7 @@ services: ```yaml services: - Rector\Rector\MethodCall\StaticRenameMethodRector: + Rector\Rector\MethodCall\RenameStaticMethodRector: $oldToNewMethodByClasses: SomeClass: oldMethod: newStaticMethod @@ -3798,7 +4015,9 @@ services: SomeExampleClass: someMethod: - + name: someArgument default_value: 'true' + type: SomeType ``` ↓ @@ -3815,7 +4034,9 @@ services: SomeExampleClass: someMethod: - + name: someArgument default_value: 'true' + type: SomeType ``` ↓ @@ -3884,24 +4105,32 @@ services:
-### `RenameNamespaceRector` +### `NewToStaticCallRector` -- class: `Rector\Rector\Namespace_\RenameNamespaceRector` +- class: `Rector\Rector\New_\NewToStaticCallRector` -Replaces old namespace by new one. +Change new Object to static call ```yaml services: - Rector\Rector\Namespace_\RenameNamespaceRector: - $oldToNewNamespaces: - SomeOldNamespace: SomeNewNamespace + Rector\Rector\New_\NewToStaticCallRector: + Cookie: + - + - Cookie + - create ``` ↓ ```diff --$someObject = new SomeOldNamespace\SomeClass; -+$someObject = new SomeNewNamespace\SomeClass; + class SomeClass + { + public function run() + { +- new Cookie($name); ++ Cookie::create($name); + } + } ```
@@ -3944,6 +4173,28 @@ services:
+### `RenameNamespaceRector` + +- class: `Rector\Rector\Namespace_\RenameNamespaceRector` + +Replaces old namespace by new one. + +```yaml +services: + Rector\Rector\Namespace_\RenameNamespaceRector: + $oldToNewNamespaces: + SomeOldNamespace: SomeNewNamespace +``` + +↓ + +```diff +-$someObject = new SomeOldNamespace\SomeClass; ++$someObject = new SomeNewNamespace\SomeClass; +``` + +
+ ### `FunctionToMethodCallRector` - class: `Rector\Rector\Function_\FunctionToMethodCallRector` @@ -3990,15 +4241,15 @@ services:
-### `FunctionReplaceRector` +### `RenameFunctionRector` -- class: `Rector\Rector\Function_\FunctionReplaceRector` +- class: `Rector\Rector\Function_\RenameFunctionRector` Turns defined function call new one. ```yaml services: - Rector\Rector\Function_\FunctionReplaceRector: + Rector\Rector\Function_\RenameFunctionRector: view: Laravel\Templating\render ``` @@ -4462,29 +4713,6 @@ services:
-### `RenameClassConstantsUseToStringsRector` - -- class: `Rector\Rector\Constant\RenameClassConstantsUseToStringsRector` - -Replaces constant by value - -```yaml -services: - Rector\Rector\Constant\RenameClassConstantsUseToStringsRector: - Nette\Configurator: - DEVELOPMENT: development - PRODUCTION: production -``` - -↓ - -```diff --$value === Nette\Configurator::DEVELOPMENT -+$value === "development" -``` - -
- ### `RenameClassConstantRector` - class: `Rector\Rector\Constant\RenameClassConstantRector` @@ -4510,6 +4738,29 @@ services:
+### `RenameClassConstantsUseToStringsRector` + +- class: `Rector\Rector\Constant\RenameClassConstantsUseToStringsRector` + +Replaces constant by value + +```yaml +services: + Rector\Rector\Constant\RenameClassConstantsUseToStringsRector: + Nette\Configurator: + DEVELOPMENT: development + PRODUCTION: production +``` + +↓ + +```diff +-$value === Nette\Configurator::DEVELOPMENT ++$value === "development" +``` + +
+ ### `RenameClassRector` - class: `Rector\Rector\Class_\RenameClassRector` diff --git a/docs/NodesOverview.md b/docs/NodesOverview.md index 03a9820412f..81aef55e937 100644 --- a/docs/NodesOverview.md +++ b/docs/NodesOverview.md @@ -2,890 +2,1031 @@ ## Expressions -### `PhpParser\Node\Expr\ArrayDimFetch` +#### `PhpParser\Node\Expr\ArrayDimFetch` ```php $someVariable[0] ``` +
-### `PhpParser\Node\Expr\ArrayItem` +#### `PhpParser\Node\Expr\ArrayItem` ```php 'name' => $Tom ``` +
-### `PhpParser\Node\Expr\Array_` +#### `PhpParser\Node\Expr\Array_` ```php [] ``` +
-### `PhpParser\Node\Expr\Assign` +#### `PhpParser\Node\Expr\Assign` ```php $someVariable = 'some value' ``` +
-### `PhpParser\Node\Expr\AssignRef` +#### `PhpParser\Node\Expr\AssignRef` ```php $someVariable =& $someOtherVariable ``` +
-### `PhpParser\Node\Expr\BitwiseNot` +#### `PhpParser\Node\Expr\BitwiseNot` ```php ~$someVariable ``` +
-### `PhpParser\Node\Expr\BooleanNot` +#### `PhpParser\Node\Expr\BooleanNot` ```php !true ``` +
-### `PhpParser\Node\Expr\ClassConstFetch` +#### `PhpParser\Node\Expr\ClassConstFetch` ```php SomeClass::SOME_CONSTANT ``` +
-### `PhpParser\Node\Expr\Clone_` +#### `PhpParser\Node\Expr\Clone_` ```php clone $someVariable ``` +
-### `PhpParser\Node\Expr\Closure` +#### `PhpParser\Node\Expr\Closure` ```php function () { } ``` +
-### `PhpParser\Node\Expr\ClosureUse` +#### `PhpParser\Node\Expr\ClosureUse` ```php $someVariable ``` +
-### `PhpParser\Node\Expr\ConstFetch` +#### `PhpParser\Node\Expr\ConstFetch` ```php true ``` +
-### `PhpParser\Node\Expr\Empty_` +#### `PhpParser\Node\Expr\Empty_` ```php empty($someVariable) ``` +
-### `PhpParser\Node\Expr\ErrorSuppress` +#### `PhpParser\Node\Expr\ErrorSuppress` ```php @$someVariable ``` +
-### `PhpParser\Node\Expr\Eval_` +#### `PhpParser\Node\Expr\Eval_` ```php eval('Some php code') ``` +
-### `PhpParser\Node\Expr\Exit_` +#### `PhpParser\Node\Expr\Exit_` ```php die ``` +
-### `PhpParser\Node\Expr\FuncCall` +#### `PhpParser\Node\Expr\FuncCall` ```php functionCall() ``` +
-### `PhpParser\Node\Expr\Include_` +#### `PhpParser\Node\Expr\Include_` ```php include $someVariable ``` +
-### `PhpParser\Node\Expr\Instanceof_` +#### `PhpParser\Node\Expr\Instanceof_` ```php $someVariable instanceof SomeClass ``` +
-### `PhpParser\Node\Expr\Isset_` +#### `PhpParser\Node\Expr\Isset_` ```php isset($variable) ``` +
-### `PhpParser\Node\Expr\List_` +#### `PhpParser\Node\Expr\List_` ```php list($someVariable) ``` +
-### `PhpParser\Node\Expr\MethodCall` +#### `PhpParser\Node\Expr\MethodCall` ```php $someObject->methodName() ``` +
-### `PhpParser\Node\Expr\New_` +#### `PhpParser\Node\Expr\New_` ```php new class { } ``` +
-### `PhpParser\Node\Expr\PostDec` +#### `PhpParser\Node\Expr\PostDec` ```php $someVariable-- ``` +
-### `PhpParser\Node\Expr\PostInc` +#### `PhpParser\Node\Expr\PostInc` ```php $someVariable++ ``` +
-### `PhpParser\Node\Expr\PreDec` +#### `PhpParser\Node\Expr\PreDec` ```php --$someVariable ``` +
-### `PhpParser\Node\Expr\PreInc` +#### `PhpParser\Node\Expr\PreInc` ```php ++$someVariable ``` +
-### `PhpParser\Node\Expr\Print_` +#### `PhpParser\Node\Expr\Print_` ```php print $someVariable ``` +
-### `PhpParser\Node\Expr\PropertyFetch` +#### `PhpParser\Node\Expr\PropertyFetch` ```php $someVariable->propertyName ``` +
-### `PhpParser\Node\Expr\ShellExec` +#### `PhpParser\Node\Expr\ShellExec` ```php `encapsedstring` ``` +
-### `PhpParser\Node\Expr\StaticCall` +#### `PhpParser\Node\Expr\StaticCall` ```php SomeClass::methodName() ``` +
-### `PhpParser\Node\Expr\StaticPropertyFetch` +#### `PhpParser\Node\Expr\StaticPropertyFetch` ```php SomeClass::$someProperty ``` +
-### `PhpParser\Node\Expr\Ternary` +#### `PhpParser\Node\Expr\Ternary` ```php $someVariable ? true : false ``` +
-### `PhpParser\Node\Expr\UnaryMinus` +#### `PhpParser\Node\Expr\UnaryMinus` ```php -$someVariable ``` +
-### `PhpParser\Node\Expr\UnaryPlus` +#### `PhpParser\Node\Expr\UnaryPlus` ```php +$someVariable ``` +
-### `PhpParser\Node\Expr\Variable` +#### `PhpParser\Node\Expr\Variable` ```php $someVariable ``` +
-### `PhpParser\Node\Expr\YieldFrom` +#### `PhpParser\Node\Expr\YieldFrom` ```php yield from $someVariable ``` +
-### `PhpParser\Node\Expr\Yield_` +#### `PhpParser\Node\Expr\Yield_` ```php yield ``` +
## Children of "PhpParser\Node\Expr\AssignOp" -### `PhpParser\Node\Expr\AssignOp\BitwiseAnd` +#### `PhpParser\Node\Expr\AssignOp\BitwiseAnd` ```php $variable &= 'value' ``` +
-### `PhpParser\Node\Expr\AssignOp\BitwiseOr` +#### `PhpParser\Node\Expr\AssignOp\BitwiseOr` ```php $variable |= 'value' ``` +
-### `PhpParser\Node\Expr\AssignOp\BitwiseXor` +#### `PhpParser\Node\Expr\AssignOp\BitwiseXor` ```php $variable ^= 'value' ``` +
-### `PhpParser\Node\Expr\AssignOp\Coalesce` +#### `PhpParser\Node\Expr\AssignOp\Coalesce` ```php $variable ??= 'value' ``` +
-### `PhpParser\Node\Expr\AssignOp\Concat` +#### `PhpParser\Node\Expr\AssignOp\Concat` ```php $variable .= 'value' ``` +
-### `PhpParser\Node\Expr\AssignOp\Div` +#### `PhpParser\Node\Expr\AssignOp\Div` ```php $variable /= 'value' ``` +
-### `PhpParser\Node\Expr\AssignOp\Minus` +#### `PhpParser\Node\Expr\AssignOp\Minus` ```php $variable -= 'value' ``` +
-### `PhpParser\Node\Expr\AssignOp\Mod` +#### `PhpParser\Node\Expr\AssignOp\Mod` ```php $variable %= 'value' ``` +
-### `PhpParser\Node\Expr\AssignOp\Mul` +#### `PhpParser\Node\Expr\AssignOp\Mul` ```php $variable *= 'value' ``` +
-### `PhpParser\Node\Expr\AssignOp\Plus` +#### `PhpParser\Node\Expr\AssignOp\Plus` ```php $variable += 'value' ``` +
-### `PhpParser\Node\Expr\AssignOp\Pow` +#### `PhpParser\Node\Expr\AssignOp\Pow` ```php $variable **= 'value' ``` +
-### `PhpParser\Node\Expr\AssignOp\ShiftLeft` +#### `PhpParser\Node\Expr\AssignOp\ShiftLeft` ```php $variable <<= 'value' ``` +
-### `PhpParser\Node\Expr\AssignOp\ShiftRight` +#### `PhpParser\Node\Expr\AssignOp\ShiftRight` ```php $variable >>= 'value' ``` +
## Children of "PhpParser\Node\Expr\BinaryOp" -### `PhpParser\Node\Expr\BinaryOp\BitwiseAnd` +#### `PhpParser\Node\Expr\BinaryOp\BitwiseAnd` ```php 1 & 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\BitwiseOr` +#### `PhpParser\Node\Expr\BinaryOp\BitwiseOr` ```php 1 | 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\BitwiseXor` +#### `PhpParser\Node\Expr\BinaryOp\BitwiseXor` ```php 1 ^ 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\BooleanAnd` +#### `PhpParser\Node\Expr\BinaryOp\BooleanAnd` ```php 1 && 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\BooleanOr` +#### `PhpParser\Node\Expr\BinaryOp\BooleanOr` ```php 1 || 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Coalesce` +#### `PhpParser\Node\Expr\BinaryOp\Coalesce` ```php 1 ?? 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Concat` +#### `PhpParser\Node\Expr\BinaryOp\Concat` ```php 1 . 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Div` +#### `PhpParser\Node\Expr\BinaryOp\Div` ```php 1 / 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Equal` +#### `PhpParser\Node\Expr\BinaryOp\Equal` ```php 1 == 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Greater` +#### `PhpParser\Node\Expr\BinaryOp\Greater` ```php 1 > 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\GreaterOrEqual` +#### `PhpParser\Node\Expr\BinaryOp\GreaterOrEqual` ```php 1 >= 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Identical` +#### `PhpParser\Node\Expr\BinaryOp\Identical` ```php 1 === 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\LogicalAnd` +#### `PhpParser\Node\Expr\BinaryOp\LogicalAnd` ```php 1 and 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\LogicalOr` +#### `PhpParser\Node\Expr\BinaryOp\LogicalOr` ```php 1 or 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\LogicalXor` +#### `PhpParser\Node\Expr\BinaryOp\LogicalXor` ```php 1 xor 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Minus` +#### `PhpParser\Node\Expr\BinaryOp\Minus` ```php 1 - 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Mod` +#### `PhpParser\Node\Expr\BinaryOp\Mod` ```php 1 % 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Mul` +#### `PhpParser\Node\Expr\BinaryOp\Mul` ```php 1 * 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\NotEqual` +#### `PhpParser\Node\Expr\BinaryOp\NotEqual` ```php 1 != 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\NotIdentical` +#### `PhpParser\Node\Expr\BinaryOp\NotIdentical` ```php 1 !== 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Plus` +#### `PhpParser\Node\Expr\BinaryOp\Plus` ```php 1 + 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Pow` +#### `PhpParser\Node\Expr\BinaryOp\Pow` ```php 1 ** 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\ShiftLeft` +#### `PhpParser\Node\Expr\BinaryOp\ShiftLeft` ```php 1 << 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\ShiftRight` +#### `PhpParser\Node\Expr\BinaryOp\ShiftRight` ```php 1 >> 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Smaller` +#### `PhpParser\Node\Expr\BinaryOp\Smaller` ```php 1 < 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\SmallerOrEqual` +#### `PhpParser\Node\Expr\BinaryOp\SmallerOrEqual` ```php 1 <= 'a' ``` +
-### `PhpParser\Node\Expr\BinaryOp\Spaceship` +#### `PhpParser\Node\Expr\BinaryOp\Spaceship` ```php 1 <=> 'a' ``` +
## Children of "PhpParser\Node\Expr\Cast" -### `PhpParser\Node\Expr\Cast\Array_` +#### `PhpParser\Node\Expr\Cast\Array_` ```php (array) $value ``` +
-### `PhpParser\Node\Expr\Cast\Bool_` +#### `PhpParser\Node\Expr\Cast\Bool_` ```php (bool) $value ``` +
-### `PhpParser\Node\Expr\Cast\Double` +#### `PhpParser\Node\Expr\Cast\Double` ```php (double) $value ``` +
-### `PhpParser\Node\Expr\Cast\Int_` +#### `PhpParser\Node\Expr\Cast\Int_` ```php (int) $value ``` +
-### `PhpParser\Node\Expr\Cast\Object_` +#### `PhpParser\Node\Expr\Cast\Object_` ```php (object) $value ``` +
-### `PhpParser\Node\Expr\Cast\String_` +#### `PhpParser\Node\Expr\Cast\String_` ```php (string) $value ``` +
-### `PhpParser\Node\Expr\Cast\Unset_` +#### `PhpParser\Node\Expr\Cast\Unset_` ```php (unset) $value ``` +
## Children of "PhpParser\Node\Name" -### `PhpParser\Node\Name` +#### `PhpParser\Node\Name` ```php name ``` +
-### `PhpParser\Node\Name\FullyQualified` +#### `PhpParser\Node\Name\FullyQualified` ```php \name ``` +
-### `PhpParser\Node\Name\Relative` +#### `PhpParser\Node\Name\Relative` ```php namespace\name ``` +
## Scalar nodes -### `PhpParser\Node\Scalar\DNumber` +#### `PhpParser\Node\Scalar\DNumber` ```php 10.5 ``` +
-### `PhpParser\Node\Scalar\Encapsed` +#### `PhpParser\Node\Scalar\Encapsed` ```php "{$enscapsed}" ``` +
-### `PhpParser\Node\Scalar\EncapsedStringPart` +#### `PhpParser\Node\Scalar\EncapsedStringPart` ```php UNABLE_TO_PRINT_ENCAPSED_STRING ``` +
-### `PhpParser\Node\Scalar\LNumber` +#### `PhpParser\Node\Scalar\LNumber` ```php 100 ``` +
-### `PhpParser\Node\Scalar\MagicConst\Class_` +#### `PhpParser\Node\Scalar\MagicConst\Class_` ```php __CLASS__ ``` +
-### `PhpParser\Node\Scalar\MagicConst\Dir` +#### `PhpParser\Node\Scalar\MagicConst\Dir` ```php __DIR__ ``` +
-### `PhpParser\Node\Scalar\MagicConst\File` +#### `PhpParser\Node\Scalar\MagicConst\File` ```php __FILE__ ``` +
-### `PhpParser\Node\Scalar\MagicConst\Function_` +#### `PhpParser\Node\Scalar\MagicConst\Function_` ```php __FUNCTION__ ``` +
-### `PhpParser\Node\Scalar\MagicConst\Line` +#### `PhpParser\Node\Scalar\MagicConst\Line` ```php __LINE__ ``` +
-### `PhpParser\Node\Scalar\MagicConst\Method` +#### `PhpParser\Node\Scalar\MagicConst\Method` ```php __METHOD__ ``` +
-### `PhpParser\Node\Scalar\MagicConst\Namespace_` +#### `PhpParser\Node\Scalar\MagicConst\Namespace_` ```php __NAMESPACE__ ``` +
-### `PhpParser\Node\Scalar\MagicConst\Trait_` +#### `PhpParser\Node\Scalar\MagicConst\Trait_` ```php __TRAIT__ ``` +
-### `PhpParser\Node\Scalar\String_` +#### `PhpParser\Node\Scalar\String_` ```php 'string' ``` +
## Statements -### `PhpParser\Node\Stmt\Break_` +#### `PhpParser\Node\Stmt\Break_` ```php break; ``` +
-### `PhpParser\Node\Stmt\Case_` +#### `PhpParser\Node\Stmt\Case_` ```php case true: ``` +
-### `PhpParser\Node\Stmt\Catch_` +#### `PhpParser\Node\Stmt\Catch_` ```php catch (CatchedType $catchedVariable) { } ``` +
-### `PhpParser\Node\Stmt\ClassConst` +#### `PhpParser\Node\Stmt\ClassConst` ```php const SOME_CLASS_CONSTANT = 'default value'; ``` +
-### `PhpParser\Node\Stmt\ClassMethod` +#### `PhpParser\Node\Stmt\ClassMethod` ```php function someMethod() { } ``` +
-### `PhpParser\Node\Stmt\Class_` +#### `PhpParser\Node\Stmt\Class_` ```php class ClassName { } ``` +
-### `PhpParser\Node\Stmt\Const_` +#### `PhpParser\Node\Stmt\Const_` ```php const CONSTANT_IN_CLASS = 'default value'; ``` +
-### `PhpParser\Node\Stmt\Continue_` +#### `PhpParser\Node\Stmt\Continue_` ```php continue; ``` +
-### `PhpParser\Node\Stmt\DeclareDeclare` +#### `PhpParser\Node\Stmt\DeclareDeclare` ```php strict_types=1 ``` +
-### `PhpParser\Node\Stmt\Declare_` +#### `PhpParser\Node\Stmt\Declare_` ```php declare (strict_types=1); ``` +
-### `PhpParser\Node\Stmt\Do_` +#### `PhpParser\Node\Stmt\Do_` ```php do { } while ($variable); ``` +
-### `PhpParser\Node\Stmt\Echo_` +#### `PhpParser\Node\Stmt\Echo_` ```php echo 'hello'; ``` +
-### `PhpParser\Node\Stmt\ElseIf_` +#### `PhpParser\Node\Stmt\ElseIf_` ```php elseif (true) { } ``` +
-### `PhpParser\Node\Stmt\Else_` +#### `PhpParser\Node\Stmt\Else_` ```php else { } ``` +
-### `PhpParser\Node\Stmt\Expression` +#### `PhpParser\Node\Stmt\Expression` ```php $someVariable; ``` +
-### `PhpParser\Node\Stmt\Finally_` +#### `PhpParser\Node\Stmt\Finally_` ```php finally { } ``` +
-### `PhpParser\Node\Stmt\For_` +#### `PhpParser\Node\Stmt\For_` ```php for (;;) { } ``` +
-### `PhpParser\Node\Stmt\Foreach_` +#### `PhpParser\Node\Stmt\Foreach_` ```php foreach ($variables as $value) { } ``` +
-### `PhpParser\Node\Stmt\Function_` +#### `PhpParser\Node\Stmt\Function_` ```php function some_function() { } ``` +
-### `PhpParser\Node\Stmt\Global_` +#### `PhpParser\Node\Stmt\Global_` ```php global $globalVariable; ``` +
-### `PhpParser\Node\Stmt\Goto_` +#### `PhpParser\Node\Stmt\Goto_` ```php goto goto_break; ``` +
-### `PhpParser\Node\Stmt\GroupUse` +#### `PhpParser\Node\Stmt\GroupUse` ```php use prefix\{UsedNamespace}; ``` +
-### `PhpParser\Node\Stmt\HaltCompiler` +#### `PhpParser\Node\Stmt\HaltCompiler` ```php __halt_compiler();remaining ``` +
-### `PhpParser\Node\Stmt\If_` +#### `PhpParser\Node\Stmt\If_` ```php if (true) { } ``` +
-### `PhpParser\Node\Stmt\InlineHTML` +#### `PhpParser\Node\Stmt\InlineHTML` ```php ?> -feelfeel -### `PhpParser\Node\Stmt\Interface_` +#### `PhpParser\Node\Stmt\Interface_` ```php interface SomeInterface { } ``` +
-### `PhpParser\Node\Stmt\Label` +#### `PhpParser\Node\Stmt\Label` ```php label: ``` +
-### `PhpParser\Node\Stmt\Namespace_` +#### `PhpParser\Node\Stmt\Namespace_` ```php namespace { } ``` +
-### `PhpParser\Node\Stmt\Nop` +#### `PhpParser\Node\Stmt\Nop` ```php ``` +
-### `PhpParser\Node\Stmt\Property` +#### `PhpParser\Node\Stmt\Property` ```php var $property; ``` +
-### `PhpParser\Node\Stmt\PropertyProperty` +#### `PhpParser\Node\Stmt\PropertyProperty` ```php $someProperty ``` +
-### `PhpParser\Node\Stmt\Return_` +#### `PhpParser\Node\Stmt\Return_` ```php return; ``` +
-### `PhpParser\Node\Stmt\StaticVar` +#### `PhpParser\Node\Stmt\StaticVar` ```php $variable ``` +
-### `PhpParser\Node\Stmt\Static_` +#### `PhpParser\Node\Stmt\Static_` ```php static $static; ``` +
-### `PhpParser\Node\Stmt\Switch_` +#### `PhpParser\Node\Stmt\Switch_` ```php switch ($variable) { case 1: } ``` +
-### `PhpParser\Node\Stmt\Throw_` +#### `PhpParser\Node\Stmt\Throw_` ```php throw new $someException(); ``` +
-### `PhpParser\Node\Stmt\TraitUse` +#### `PhpParser\Node\Stmt\TraitUse` ```php use trait; ``` +
-### `PhpParser\Node\Stmt\TraitUseAdaptation\Alias` +#### `PhpParser\Node\Stmt\TraitUseAdaptation\Alias` ```php SomeTrait::method as public aliasedMethod; ``` +
-### `PhpParser\Node\Stmt\TraitUseAdaptation\Precedence` +#### `PhpParser\Node\Stmt\TraitUseAdaptation\Precedence` ```php SomeTrait::someMethod insteadof overriddenTrait; ``` +
-### `PhpParser\Node\Stmt\Trait_` +#### `PhpParser\Node\Stmt\Trait_` ```php trait TraitName { } ``` +
-### `PhpParser\Node\Stmt\TryCatch` +#### `PhpParser\Node\Stmt\TryCatch` ```php try { @@ -896,61 +1037,71 @@ try { { } ``` +
-### `PhpParser\Node\Stmt\Unset_` +#### `PhpParser\Node\Stmt\Unset_` ```php unset($variable); ``` +
-### `PhpParser\Node\Stmt\UseUse` +#### `PhpParser\Node\Stmt\UseUse` ```php UsedNamespace ``` +
-### `PhpParser\Node\Stmt\Use_` +#### `PhpParser\Node\Stmt\Use_` ```php use UsedNamespace; ``` +
-### `PhpParser\Node\Stmt\While_` +#### `PhpParser\Node\Stmt\While_` ```php while ($variable) { } ``` +
## Various -### `PhpParser\Node\Arg` +#### `PhpParser\Node\Arg` ```php $someVariable ``` +
-### `PhpParser\Node\Const_` +#### `PhpParser\Node\Const_` ```php CONSTANT_NAME = 'default' ``` +
-### `PhpParser\Node\Identifier` +#### `PhpParser\Node\Identifier` ```php identifier ``` +
-### `PhpParser\Node\NullableType` +#### `PhpParser\Node\NullableType` ```php ?SomeType ``` +
-### `PhpParser\Node\Param` +#### `PhpParser\Node\Param` ```php $someVariable ``` +