Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php declare (strict_types=1); namespace Rector\DowngradePhp80\Reflection; use PHPStan\..

Decoded Output download

<?php

declare (strict_types=1);
namespace Rector\DowngradePhp80\Reflection;

use PHPStan\Reflection\ParameterReflection;
use PHPStan\Reflection\PassedByReference;
use PHPStan\Type\ConstantTypeHelper;
use PHPStan\Type\Type;
use Rector\Exception\NotImplementedYetException;
use ReflectionFunction;
use ReflectionParameter;
use Throwable;
final class SimplePhpParameterReflection implements ParameterReflection
{
    /**
     * @readonly
     * @var \ReflectionParameter
     */
    private $reflectionParameter;
    public function __construct(ReflectionFunction $reflectionFunction, int $position)
    {
        $this->reflectionParameter = $reflectionFunction->getParameters()[$position];
    }
    public function getName() : string
    {
        return $this->reflectionParameter->getName();
    }
    public function isOptional() : bool
    {
        return $this->reflectionParameter->isOptional();
    }
    /**
     * getType() is never used yet on manual object creation, and the implementation require PHPStan $phpDocType services injection
     * @see https://github.com/phpstan/phpstan-src/blob/92420cd4b190b57d1ba8bf9e800eb97c8c0ee2f2/src/Reflection/Php/PhpParameterReflection.php#L24
     */
    public function getType() : Type
    {
        throw new NotImplementedYetException();
    }
    public function passedByReference() : PassedByReference
    {
        return $this->reflectionParameter->isPassedByReference() ? PassedByReference::createCreatesNewVariable() : PassedByReference::createNo();
    }
    public function isVariadic() : bool
    {
        return $this->reflectionParameter->isVariadic();
    }
    public function getDefaultValue() : ?Type
    {
        try {
            if ($this->reflectionParameter->isDefaultValueAvailable()) {
                $defaultValue = $this->reflectionParameter->getDefaultValue();
                return ConstantTypeHelper::getTypeFromValue($defaultValue);
            }
        } catch (Throwable $exception) {
            return null;
        }
        return null;
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare (strict_types=1);
namespace Rector\DowngradePhp80\Reflection;

use PHPStan\Reflection\ParameterReflection;
use PHPStan\Reflection\PassedByReference;
use PHPStan\Type\ConstantTypeHelper;
use PHPStan\Type\Type;
use Rector\Exception\NotImplementedYetException;
use ReflectionFunction;
use ReflectionParameter;
use Throwable;
final class SimplePhpParameterReflection implements ParameterReflection
{
    /**
     * @readonly
     * @var \ReflectionParameter
     */
    private $reflectionParameter;
    public function __construct(ReflectionFunction $reflectionFunction, int $position)
    {
        $this->reflectionParameter = $reflectionFunction->getParameters()[$position];
    }
    public function getName() : string
    {
        return $this->reflectionParameter->getName();
    }
    public function isOptional() : bool
    {
        return $this->reflectionParameter->isOptional();
    }
    /**
     * getType() is never used yet on manual object creation, and the implementation require PHPStan $phpDocType services injection
     * @see https://github.com/phpstan/phpstan-src/blob/92420cd4b190b57d1ba8bf9e800eb97c8c0ee2f2/src/Reflection/Php/PhpParameterReflection.php#L24
     */
    public function getType() : Type
    {
        throw new NotImplementedYetException();
    }
    public function passedByReference() : PassedByReference
    {
        return $this->reflectionParameter->isPassedByReference() ? PassedByReference::createCreatesNewVariable() : PassedByReference::createNo();
    }
    public function isVariadic() : bool
    {
        return $this->reflectionParameter->isVariadic();
    }
    public function getDefaultValue() : ?Type
    {
        try {
            if ($this->reflectionParameter->isDefaultValueAvailable()) {
                $defaultValue = $this->reflectionParameter->getDefaultValue();
                return ConstantTypeHelper::getTypeFromValue($defaultValue);
            }
        } catch (Throwable $exception) {
            return null;
        }
        return null;
    }
}

Function Calls

None

Variables

None

Stats

MD5 0c0dbb0ee1518e7e6165434ccbd68d38
Eval Count 0
Decode Time 96 ms