[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: CreatedByRuleDecorator.php
File is not writable. Editing disabled.
<?php declare (strict_types=1); namespace Rector\NodeDecorator; use PhpParser\Node; use Rector\Contract\Rector\RectorInterface; use Rector\NodeTypeResolver\Node\AttributeKey; final class CreatedByRuleDecorator { /** * @param array<Node>|Node $node * @param class-string<RectorInterface> $rectorClass */ public function decorate($node, Node $originalNode, string $rectorClass) : void { if ($node instanceof Node && $node === $originalNode) { $this->createByRule($node, $rectorClass); return; } if ($node instanceof Node) { $node = [$node]; } foreach ($node as $singleNode) { if (\get_class($singleNode) === \get_class($originalNode)) { $this->createByRule($singleNode, $rectorClass); } } $this->createByRule($originalNode, $rectorClass); } /** * @param class-string<RectorInterface> $rectorClass */ private function createByRule(Node $node, string $rectorClass) : void { /** @var class-string<RectorInterface>[] $createdByRule */ $createdByRule = $node->getAttribute(AttributeKey::CREATED_BY_RULE) ?? []; // empty array, insert if ($createdByRule === []) { $node->setAttribute(AttributeKey::CREATED_BY_RULE, [$rectorClass]); return; } // consecutive, no need to refill if (\end($createdByRule) === $rectorClass) { return; } // filter out when exists, then append $createdByRule = \array_filter($createdByRule, static function (string $rectorRule) use($rectorClass) : bool { return $rectorRule !== $rectorClass; }); $node->setAttribute(AttributeKey::CREATED_BY_RULE, \array_merge($createdByRule, [$rectorClass])); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium171.web-hosting.com
Server IP: 162.0.209.115
PHP Version: 8.0.30
Server Software: LiteSpeed
System: Linux premium171.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 70.77 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
No
pkexec:
No
git:
Yes
User Info
Username: aircyknj
User ID (UID): 2056
Group ID (GID): 2052
Script Owner UID: 2056
Current Dir Owner: N/A