Skip to content

Commit 51a8b12

Browse files
committed
nullability checks
1 parent cb06f4a commit 51a8b12

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Peachpie.Runtime/Variables.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,14 +522,14 @@ public static bool IsDouble(this PhpValue value)
522522
/// <summary>
523523
/// Alias to <see cref="ToStringOrNull(PhpValue)"/>.
524524
/// </summary>
525-
public static string AsString(this PhpValue value) => ToStringOrNull(value);
525+
public static string? AsString(this PhpValue value) => ToStringOrNull(value);
526526

527527
/// <summary>
528528
/// In case given value contains a string (<see cref="string"/> or <see cref="PhpString"/>),
529529
/// its string representation is returned.
530530
/// Otherwise <c>null</c>.
531531
/// </summary>
532-
public static string ToStringOrNull(this PhpValue value)
532+
public static string? ToStringOrNull(this PhpValue value)
533533
{
534534
IsString(value, out var @string);
535535
return @string;
@@ -607,7 +607,7 @@ public static byte[] ToBytes(this PhpValue value, Context ctx)
607607
/// Checks the value is of type <c>string</c> or <c>&amp;string</c> and gets its value.
608608
/// Single-byte strings are decoded using <c>UTF-8</c>.
609609
/// </summary>
610-
public static bool IsString(this PhpValue value, out string @string) => value.IsStringImpl(out @string);
610+
public static bool IsString(this PhpValue value, [MaybeNullWhen(false)]out string @string) => value.IsStringImpl(out @string);
611611

612612
/// <summary>
613613
/// Checks the value is constructed as mutable <see cref="PhpString"/>.

0 commit comments

Comments
 (0)