Skip to content

Commit

Permalink
Update README.md (#481)
Browse files Browse the repository at this point in the history
Fix some inconsistencies regarding `nonnull`, `nullable` and `optional` type.
  • Loading branch information
mattsches authored Jun 18, 2024
1 parent fb0c886 commit cb7bd70
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Psl/Type/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -824,8 +824,8 @@ Both `assert()` and `coerce()` are designed to narrow down the provided type:
```php
use Psl\Type;

$nullable = Type\nonnull();
$nullable->assert($stringOrNull);
$nonnull = Type\nonnull();
$nonnull->assert($stringOrNull);

// Your static analyzer will know that $stringOrNull is a string !

Expand Down Expand Up @@ -864,7 +864,7 @@ Can coerce from:
```php
use Psl\Type;

$nullableString = Type\nonnull(Type\string());
$nullableString = Type\nullable(Type\string());
$nullable->assert($stringOrNull);
```

Expand Down Expand Up @@ -934,7 +934,7 @@ Can coerce from:
```php
use Psl\Type;

$nullableString = Type\nonnull(Type\string());
$nullableString = Type\optional(Type\string());
$nullable->assert($stringOrNull);
```

Expand Down

0 comments on commit cb7bd70

Please sign in to comment.