Methods |
public
|
__construct(array<string, array{Expr, Type}> $sureTypes = [], array<string, array{Expr, Type}> $sureNotTypes = [])
|
#
|
public
|
setAlwaysOverwriteTypes(): self
Normally, $sureTypes in truthy context are used to intersect with the pre-existing type.
And $sureNotTypes are used to remove type from the pre-existing type. Example: By default, non-empty-string intersected with '' (ConstantStringType) will lead to NeverType.
Because it's not possible to narrow non-empty-string to an empty string. In rare cases, a type-specifying extension might want to overwrite the pre-existing types
without taking the pre-existing types into consideration. In that case it should also call setAlwaysOverwriteTypes() on
the returned object. ! Only do this if you're certain. Otherwise, this is a source of common bugs. !
Normally, $sureTypes in truthy context are used to intersect with the pre-existing type.
And $sureNotTypes are used to remove type from the pre-existing type. Example: By default, non-empty-string intersected with '' (ConstantStringType) will lead to NeverType.
Because it's not possible to narrow non-empty-string to an empty string. In rare cases, a type-specifying extension might want to overwrite the pre-existing types
without taking the pre-existing types into consideration. In that case it should also call setAlwaysOverwriteTypes() on
the returned object. ! Only do this if you're certain. Otherwise, this is a source of common bugs. !
|
#
|
public
|
setRootExpr(?Expr $rootExpr): self
|
#
|
public
|
getSureTypes(): array<string, array{Expr, Type}>
|
#
|
public
|
getSureNotTypes(): array<string, array{Expr, Type}>
|
#
|
public
|
intersectWith(SpecifiedTypes $other): self
|
#
|
public
|
unionWith(SpecifiedTypes $other): self
|
#
|