mirror of
https://github.com/danog/psalm.git
synced 2024-12-12 17:27:28 +01:00
36 lines
721 B
PHP
36 lines
721 B
PHP
<?php
|
|
namespace Psalm\Internal;
|
|
|
|
use Psalm\Type;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
class ReferenceConstraint
|
|
{
|
|
/** @var Type\Union|null */
|
|
public $type;
|
|
|
|
/**
|
|
* @param Type\Union $type
|
|
*/
|
|
public function __construct(Type\Union $type = null)
|
|
{
|
|
if ($type) {
|
|
$this->type = clone $type;
|
|
|
|
if ($this->type->getLiteralStrings()) {
|
|
$this->type->addType(new Type\Atomic\TString);
|
|
}
|
|
|
|
if ($this->type->getLiteralInts()) {
|
|
$this->type->addType(new Type\Atomic\TInt);
|
|
}
|
|
|
|
if ($this->type->getLiteralFloats()) {
|
|
$this->type->addType(new Type\Atomic\TFloat);
|
|
}
|
|
}
|
|
}
|
|
}
|