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 Phan\Language\Type; use Phan\CodeBase; use Pha..
Decoded Output download
<?php
declare(strict_types=1);
namespace Phan\Language\Type;
use Phan\CodeBase;
use Phan\Config;
use Phan\Language\Context;
use Phan\Language\Type;
use Phan\Language\UnionType;
/**
* Phan's representation of the type for `float`
* @phan-pure
*/
class FloatType extends ScalarType
{
use NativeTypeTrait;
/** @phan-override */
public const NAME = 'float';
/** @override */
public function isPossiblyNumeric(): bool
{
return true;
}
public function isValidBitwiseOperand(): bool
{
return Config::getValue('scalar_implicit_cast');
}
public function isPossiblyTruthy(): bool
{
return true;
}
public function isPossiblyFalsey(): bool
{
return true;
}
public function isAlwaysTruthy(): bool
{
return false;
}
public function isAlwaysFalsey(): bool
{
return false;
}
public function getTypeAfterIncOrDec(): UnionType
{
return FloatType::instance(false)->asPHPDocUnionType();
}
public function canCastToDeclaredType(CodeBase $code_base, Context $context, Type $other): bool
{
// Allow casting scalars to other scalars, but not to null.
if ($other instanceof ScalarType) {
return $other instanceof FloatType || $other instanceof ScalarRawType || (!$context->isStrictTypes() && parent::canCastToDeclaredType($code_base, $context, $other));
}
return $other instanceof TemplateType ||
$other instanceof MixedType;
}
/**
* @unused-param $code_base
*/
protected function isSubtypeOfNonNullableType(Type $type, CodeBase $code_base): bool
{
return \get_class($type) === self::class || $type instanceof ScalarRawType || $type instanceof MixedType;
}
}
?>
Did this file decode correctly?
Original Code
<?php
declare(strict_types=1);
namespace Phan\Language\Type;
use Phan\CodeBase;
use Phan\Config;
use Phan\Language\Context;
use Phan\Language\Type;
use Phan\Language\UnionType;
/**
* Phan's representation of the type for `float`
* @phan-pure
*/
class FloatType extends ScalarType
{
use NativeTypeTrait;
/** @phan-override */
public const NAME = 'float';
/** @override */
public function isPossiblyNumeric(): bool
{
return true;
}
public function isValidBitwiseOperand(): bool
{
return Config::getValue('scalar_implicit_cast');
}
public function isPossiblyTruthy(): bool
{
return true;
}
public function isPossiblyFalsey(): bool
{
return true;
}
public function isAlwaysTruthy(): bool
{
return false;
}
public function isAlwaysFalsey(): bool
{
return false;
}
public function getTypeAfterIncOrDec(): UnionType
{
return FloatType::instance(false)->asPHPDocUnionType();
}
public function canCastToDeclaredType(CodeBase $code_base, Context $context, Type $other): bool
{
// Allow casting scalars to other scalars, but not to null.
if ($other instanceof ScalarType) {
return $other instanceof FloatType || $other instanceof ScalarRawType || (!$context->isStrictTypes() && parent::canCastToDeclaredType($code_base, $context, $other));
}
return $other instanceof TemplateType ||
$other instanceof MixedType;
}
/**
* @unused-param $code_base
*/
protected function isSubtypeOfNonNullableType(Type $type, CodeBase $code_base): bool
{
return \get_class($type) === self::class || $type instanceof ScalarRawType || $type instanceof MixedType;
}
}
Function Calls
None |
Stats
MD5 | 04e5f335e1008a1651a751f2fd91de76 |
Eval Count | 0 |
Decode Time | 101 ms |