1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-13 01:37:23 +01:00
psalm/src/Psalm/Internal/ReferenceConstraint.php

33 lines
700 B
PHP
Raw Normal View History

<?php
2018-11-06 03:57:36 +01:00
namespace Psalm\Internal;
use Psalm\Type;
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);
}
}
}
}