Skip to content

Commit

Permalink
Removed ValueType (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
vudaltsov authored Mar 9, 2024
1 parent e2ec2dd commit da04785
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## 0.3.1

- Deprecated calling `types::alias()`, `types::template()` and `types::object()` with named arguments.
- Deprecated `TypeVisitor::value()` and `DefaultVisitor::value()`.
3 changes: 3 additions & 0 deletions DefaultTypeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ public function union(Type $self, array $types): mixed
return $this->default($self);
}

/**
* @deprecated will be removed in 0.4.0
*/
public function value(Type $self, Type $type): mixed
{
return $this->default($self);
Expand Down
26 changes: 0 additions & 26 deletions Internal/ValueType.php

This file was deleted.

1 change: 1 addition & 0 deletions TypeVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ public function truthyString(Type $self): mixed;
public function union(Type $self, array $types): mixed;

/**
* @deprecated will be removed in 0.4.0
* @return TReturn
*/
public function value(Type $self, Type $type): mixed;
Expand Down
2 changes: 1 addition & 1 deletion types.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public static function union(Type ...$types): Type

public static function value(Type $type): Type
{
return new Internal\ValueType($type);
return self::offset($type, self::key($type));
}

/**
Expand Down

0 comments on commit da04785

Please sign in to comment.