REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.75 KB
Close
/opt/cpanel/ea-wappspector/vendor/rector/rector/rules/CodingStyle/Rector/Property/SplitGroupedPropertiesRector.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\CodingStyle\Rector\Property; use PhpParser\Node; use PhpParser\Node\Stmt\Property; use PhpParser\Node\Stmt\PropertyProperty; use Rector\Rector\AbstractRector; use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample; use Symplify\RuleDocGenerator\ValueObject\RuleDefinition; /** * @see \Rector\Tests\CodingStyle\Rector\Property\SplitGroupedPropertiesRector\SplitGroupedPropertiesRectorTest */ final class SplitGroupedPropertiesRector extends AbstractRector { public function getRuleDefinition() : RuleDefinition { return new RuleDefinition('Separate grouped properties to own lines', [new CodeSample(<<<'CODE_SAMPLE' class SomeClass { /** * @var string */ public $isIt, $isIsThough; } CODE_SAMPLE , <<<'CODE_SAMPLE' class SomeClass { /** * @var string */ public $isIt; /** * @var string */ public $isIsThough; } CODE_SAMPLE )]); } /** * @return array<class-string<Node>> */ public function getNodeTypes() : array { return [Property::class]; } /** * @param Property $node * @return Property[]|null */ public function refactor(Node $node) : ?array { $allProperties = $node->props; if (\count($allProperties) === 1) { return null; } /** @var PropertyProperty $firstPropertyProperty */ $firstPropertyProperty = \array_shift($allProperties); $node->props = [$firstPropertyProperty]; $nextProperties = []; foreach ($allProperties as $allProperty) { $nextProperties[] = new Property($node->flags, [$allProperty], $node->getAttributes()); } return \array_merge([$node], $nextProperties); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 1
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
SplitGroupedPropertiesRector.php
1.75 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).