- Added some reflected properties
This commit is contained in:
parent
237f0a30d2
commit
fa0430a3fc
@ -18,4 +18,14 @@ class ReflectedPropertyType
|
|||||||
|
|
||||||
return $this->type === $type;
|
return $this->type === $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isObject() : bool
|
||||||
|
{
|
||||||
|
return ! $this->builtIn && class_exists($this->type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isEnum() : bool
|
||||||
|
{
|
||||||
|
return ! $this->builtIn && enum_exists($this->type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
26
src/Common/ReflectedPropertyType.php~
Normal file
26
src/Common/ReflectedPropertyType.php~
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Notes\Common;
|
||||||
|
|
||||||
|
class ReflectedPropertyType
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public string $type,
|
||||||
|
public bool $builtIn,
|
||||||
|
public bool $nullable,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function isType(string $type) : bool
|
||||||
|
{
|
||||||
|
if ($type === "null" || $this->nullable) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->type === $type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isObject() : bool
|
||||||
|
{
|
||||||
|
return ! $this->builtIn && class_exists($this->type);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user