Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Switch DumpRectorCommand from console to string printer #4281

Merged
merged 7 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"composer/xdebug-handler": "^1.4",
"doctrine/annotations": "^1.10.4",
"doctrine/inflector": "^1.4|^2.0",
"migrify/php-config-printer": "^0.3.31",
"jean85/pretty-package-versions": "^1.5.1",
"migrify/php-config-printer": "^0.3.44",
"nette/robot-loader": "^3.2",
"nette/utils": "^3.1",
"nikic/php-parser": "4.10.1",
Expand All @@ -38,8 +39,7 @@
"symplify/set-config-resolver": "^8.3.17",
"symplify/smart-file-system": "^8.3.17",
"tracy/tracy": "^2.7",
"webmozart/assert": "^1.8",
"jean85/pretty-package-versions": "^1.5.1"
"webmozart/assert": "^1.8"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
Expand Down Expand Up @@ -285,11 +285,11 @@
],
"check-cs": [
"vendor/bin/ecs check --ansi",
"vendor/bin/ecs check-markdown README.md --ansi"
"vendor/bin/ecs check-markdown README.md docs/rector_rules_overview.md --ansi"
],
"fix-cs": [
"vendor/bin/ecs check --fix --ansi",
"vendor/bin/ecs check-markdown README.md --fix --ansi"
"vendor/bin/ecs check-markdown README.md docs/rector_rules_overview.md --fix --ansi"
],
"phpstan": [
"vendor/bin/phpstan analyse --ansi --error-format symplify",
Expand All @@ -304,7 +304,7 @@
"vendor/bin/changelog-linker cleanup --ansi"
],
"docs": [
"bin/rector dump-rectors > docs/rector_rules_overview.md",
"bin/rector dump-rectors --output-file docs/rector_rules_overview.md --ansi",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samsonasik This is the new updated version to generated rules overview, btw

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you 👍

"bin/rector dump-nodes > docs/nodes_overview.md"
],
"rector-ci": "bin/rector process --config rector-ci.php --dry-run --ansi",
Expand Down
57 changes: 33 additions & 24 deletions docs/nodes_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ fn() => 1
* `$params` - `/** @var Node\Param[] */`
* `$returnType` - `/** @var null|Node\Identifier|Node\Name|Node\NullableType|Node\UnionType */`
* `$expr` - `/** @var Expr */`
* `$attrGroups` - `/** @var Node\AttributeGroup[] */`

<br>

Expand Down Expand Up @@ -2219,13 +2220,13 @@ use PhpParser\Node\Expr\Variable;

$variable = new Variable('variableName');

return new Include_($variable, Include_::TYPE_REQUIRE_ONCE);
return new Include_($variable, Include_::TYPE_INCLUDE);
```


```php
require_once $variableName
include $variableName
```

<br>
Expand All @@ -2240,13 +2241,13 @@ use PhpParser\Node\Expr\Variable;

$variable = new Variable('variableName');

return new Include_($variable, Include_::TYPE_INCLUDE);
return new Include_($variable, Include_::TYPE_REQUIRE_ONCE);
```


```php
include $variableName
require_once $variableName
```

<br>
Expand Down Expand Up @@ -2480,18 +2481,22 @@ $someObject->methodName('yes', 'maybe')

declare(strict_types=1);

// anonymous class

use PhpParser\Node\Expr\New_;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Class_;

$class = new Name('SomeClass');
$class = new Class_(null);

return new New_($class);
```


```php
new SomeClass()
new class
{
}
```

<br>
Expand All @@ -2501,22 +2506,18 @@ new SomeClass()

declare(strict_types=1);

// anonymous class

use PhpParser\Node\Expr\New_;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Name;

$class = new Class_(null);
$class = new Name('SomeClass');

return new New_($class);
```


```php
new class
{
}
new SomeClass()
```

<br>
Expand Down Expand Up @@ -3324,6 +3325,7 @@ $variableName
* `$var` - `/** @var Expr\Variable|Expr\Error Parameter variable */`
* `$default` - `/** @var null|Expr Default value */`
* `$flags` - `/** @var int */`
* `$attrGroups` - `/** @var AttributeGroup[] PHP attribute groups */`

<br>

Expand Down Expand Up @@ -3586,6 +3588,7 @@ public const SOME_CLASS_CONSTANT = 'default value';

* `$flags` - `/** @var int Modifiers */`
* `$consts` - `/** @var Node\Const_[] Constant declarations */`
* `$attrGroups` - `/** @var Node\AttributeGroup[] */`

<br>

Expand Down Expand Up @@ -3658,6 +3661,7 @@ private function methodName($paramName): string
* `$params` - `/** @var Node\Param[] Parameters */`
* `$returnType` - `/** @var null|Node\Identifier|Node\Name|Node\NullableType|Node\UnionType Return type */`
* `$stmts` - `/** @var Node\Stmt[]|null Statements */`
* `$attrGroups` - `/** @var Node\AttributeGroup[] PHP attribute groups */`
* `$magicNames` - ``

<br>
Expand All @@ -3672,21 +3676,15 @@ private function methodName($paramName): string

declare(strict_types=1);

use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Stmt\Class_;

$class = new Class_('ClassName');

$class->flags = Class_::MODIFIER_FINAL;
$class->extends = new FullyQualified('ParentClass');

return $class;
return new Class_('ClassName');
```


```php
final class ClassName extends \ParentClass
class ClassName
{
}
```
Expand All @@ -3698,15 +3696,21 @@ final class ClassName extends \ParentClass

declare(strict_types=1);

use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Stmt\Class_;

return new Class_('ClassName');
$class = new Class_('ClassName');

$class->flags = Class_::MODIFIER_FINAL;
$class->extends = new FullyQualified('ParentClass');

return $class;
```


```php
class ClassName
final class ClassName extends \ParentClass
{
}
```
Expand All @@ -3721,6 +3725,7 @@ class ClassName
* `$implements` - `/** @var Node\Name[] Names of implemented interfaces */`
* `$name` - `/** @var Node\Identifier|null Name */`
* `$stmts` - `/** @var Node\Stmt[] Statements */`
* `$attrGroups` - `/** @var Node\AttributeGroup[] PHP attribute groups */`

<br>

Expand Down Expand Up @@ -4005,6 +4010,7 @@ function some_function()
* `$params` - `/** @var Node\Param[] Parameters */`
* `$returnType` - `/** @var null|Node\Identifier|Node\Name|Node\NullableType|Node\UnionType Return type */`
* `$stmts` - `/** @var Node\Stmt[] Statements */`
* `$attrGroups` - `/** @var Node\AttributeGroup[] PHP attribute groups */`

<br>

Expand Down Expand Up @@ -4238,6 +4244,7 @@ interface InterfaceName
* `$extends` - `/** @var Node\Name[] Extended interfaces */`
* `$name` - `/** @var Node\Identifier|null Name */`
* `$stmts` - `/** @var Node\Stmt[] Statements */`
* `$attrGroups` - `/** @var Node\AttributeGroup[] PHP attribute groups */`

<br>

Expand Down Expand Up @@ -4350,6 +4357,7 @@ public static $firstProperty, $secondProperty;
* `$flags` - `/** @var int Modifiers */`
* `$props` - `/** @var PropertyProperty[] Properties */`
* `$type` - `/** @var null|Identifier|Name|NullableType|UnionType Type declaration */`
* `$attrGroups` - `/** @var Node\AttributeGroup[] PHP attribute groups */`

<br>

Expand Down Expand Up @@ -4659,6 +4667,7 @@ trait TraitName

* `$name` - `/** @var Node\Identifier|null Name */`
* `$stmts` - `/** @var Node\Stmt[] Statements */`
* `$attrGroups` - `/** @var Node\AttributeGroup[] PHP attribute groups */`

<br>

Expand Down
Loading