1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-13 17:57:37 +01:00
psalm/src/Psalm/Internal/ReferenceConstraint.php
orklah 8c7423505a
add native param types (#4137)
* add native param types

* redundant phpdoc

* add more param types and adds "?" to nullable types

* remove redundant phpdoc

* add more param types and remove redundant phpdoc

* add more param types and remove redundant phpdoc
2020-09-06 19:36:47 -04:00

33 lines
674 B
PHP

<?php
namespace Psalm\Internal;
use Psalm\Type;
/**
* @internal
*/
class ReferenceConstraint
{
/** @var Type\Union|null */
public $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);
}
}
}
}