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; } }