Page MenuHomeWickedGov Phorge

ScalarRawType.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

ScalarRawType.php

<?php
declare(strict_types=1);
namespace Phan\Language\Type;
/**
* A temporary representation of the type `scalar`.
* These are the types for which `is_scalar(expr)` is true
*
* This is used in the middle of parsing PHPDoc types,
* but is quickly converted to bool|int|float|string once parsing is finished.
* @phan-pure
*/
final class ScalarRawType extends ScalarType implements MultiType
{
use NativeTypeTrait;
/** @override */
public const NAME = 'scalar';
/**
* @return array{0:BoolType,1:IntType,2:FloatType,3:StringType}
*/
public function asIndividualTypeInstances(): array
{
if ($this->is_nullable) {
static $nullable_types = null;
if ($nullable_types === null) {
$nullable_types = [BoolType::instance(true), IntType::instance(true), FloatType::instance(true), StringType::instance(true)];
}
return $nullable_types;
}
static $nonnullable_types = null;
if ($nonnullable_types === null) {
$nonnullable_types = [BoolType::instance(false), IntType::instance(false), FloatType::instance(false), StringType::instance(false)];
}
return $nonnullable_types;
}
}

File Metadata

Mime Type
text/x-php
Expires
Mon, Nov 23, 06:09 (3 d, 11 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
70/ee/e3b96afbfb7fd7fc009761af83eb
Default Alt Text
ScalarRawType.php (1 KB)

Event Timeline