Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/cartforge.co/vendor/rector/rector/rules/CodingStyle/Guard/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/vendor/rector/rector/rules/CodingStyle/Guard/StaticGuard.php
<?php

declare (strict_types=1);
namespace Rector\CodingStyle\Guard;

use PhpParser\Node;
use PhpParser\Node\Expr\ArrowFunction;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Expr\Variable;
use PHPStan\Reflection\MethodReflection;
use Rector\PhpParser\Node\BetterNodeFinder;
use Rector\Reflection\ReflectionResolver;
final class StaticGuard
{
    /**
     * @readonly
     * @var \Rector\PhpParser\Node\BetterNodeFinder
     */
    private $betterNodeFinder;
    /**
     * @readonly
     * @var \Rector\Reflection\ReflectionResolver
     */
    private $reflectionResolver;
    public function __construct(BetterNodeFinder $betterNodeFinder, ReflectionResolver $reflectionResolver)
    {
        $this->betterNodeFinder = $betterNodeFinder;
        $this->reflectionResolver = $reflectionResolver;
    }
    /**
     * @param \PhpParser\Node\Expr\Closure|\PhpParser\Node\Expr\ArrowFunction $node
     */
    public function isLegal($node) : bool
    {
        if ($node->static) {
            return \false;
        }
        $nodes = $node instanceof Closure ? $node->stmts : [$node->expr];
        return !(bool) $this->betterNodeFinder->findFirst($nodes, function (Node $subNode) : bool {
            if (!$subNode instanceof StaticCall) {
                return $subNode instanceof Variable && $subNode->name === 'this';
            }
            $methodReflection = $this->reflectionResolver->resolveMethodReflectionFromStaticCall($subNode);
            if (!$methodReflection instanceof MethodReflection) {
                return \false;
            }
            return !$methodReflection->isStatic();
        });
    }
}

Spamworldpro Mini