PHP 8.2.31
Preview: BareLogoutClassMethodFactory.php Size: 1.49 KB
//opt/cpanel/ea-wappspector/vendor/rector/rector/vendor/rector/rector-symfony/src/NodeFactory/BareLogoutClassMethodFactory.php

<?php

declare (strict_types=1);
namespace Rector\Symfony\NodeFactory;

use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\Php\PhpVersionProvider;
use Rector\PhpParser\Node\NodeFactory;
use Rector\ValueObject\PhpVersionFeature;
final class BareLogoutClassMethodFactory
{
    /**
     * @readonly
     * @var \Rector\PhpParser\Node\NodeFactory
     */
    private $nodeFactory;
    /**
     * @readonly
     * @var \Rector\Php\PhpVersionProvider
     */
    private $phpVersionProvider;
    public function __construct(NodeFactory $nodeFactory, PhpVersionProvider $phpVersionProvider)
    {
        $this->nodeFactory = $nodeFactory;
        $this->phpVersionProvider = $phpVersionProvider;
    }
    public function create() : ClassMethod
    {
        $classMethod = $this->nodeFactory->createPublicMethod('onLogout');
        $variable = new Variable('logoutEvent');
        $classMethod->params[] = $this->createLogoutEventParam($variable);
        if ($this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::VOID_TYPE)) {
            $classMethod->returnType = new Identifier('void');
        }
        return $classMethod;
    }
    private function createLogoutEventParam(Variable $variable) : Param
    {
        $param = new Param($variable);
        $param->type = new FullyQualified('Symfony\\Component\\Security\\Http\\Event\\LogoutEvent');
        return $param;
    }
}

Directory Contents

Dirs: 1 × Files: 7

Name Size Perms Modified Actions
- drwxr-xr-x 2024-11-08 13:59:10
Edit Download
1.07 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
1.49 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
1.60 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
9.66 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
3.08 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
3.77 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download
6.38 KB lrw-r--r-- 2024-11-08 13:59:10
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).