From cb7bd70efcf21076c91a5f97b0438613aac23bfa Mon Sep 17 00:00:00 2001 From: Matthias Gutjahr Date: Tue, 18 Jun 2024 11:07:14 +0200 Subject: [PATCH] Update README.md (#481) Fix some inconsistencies regarding `nonnull`, `nullable` and `optional` type. --- src/Psl/Type/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Psl/Type/README.md b/src/Psl/Type/README.md index 70566047..a6867fd6 100644 --- a/src/Psl/Type/README.md +++ b/src/Psl/Type/README.md @@ -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 ! @@ -864,7 +864,7 @@ Can coerce from: ```php use Psl\Type; -$nullableString = Type\nonnull(Type\string()); +$nullableString = Type\nullable(Type\string()); $nullable->assert($stringOrNull); ``` @@ -934,7 +934,7 @@ Can coerce from: ```php use Psl\Type; -$nullableString = Type\nonnull(Type\string()); +$nullableString = Type\optional(Type\string()); $nullable->assert($stringOrNull); ```