From 4834419c619d19a37a3f5160db2438db80fd9082 Mon Sep 17 00:00:00 2001 From: Alexander Krause <44682073+Krause-a@users.noreply.github.com> Date: Fri, 1 May 2026 11:56:31 -0700 Subject: [PATCH 1/3] Update null coalescing operator documentation Make the connection to `isset` explicit and distinct from the null check to match PHP behavior. Remove redundant warning suppression information. --- language/operators/comparison.xml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/language/operators/comparison.xml b/language/operators/comparison.xml index 44c6a491ad4d..33a20c8033ca 100644 --- a/language/operators/comparison.xml +++ b/language/operators/comparison.xml @@ -462,7 +462,7 @@ echo 0 ?: 0 ?: 0 ?: 3, PHP_EOL; //3 // Example usage for: Null Coalesce Operator $action = $_POST['action'] ?? 'default'; -// The above is identical to this if/else statement +// The above is equivalent to this if/else statement if (isset($_POST['action'])) { $action = $_POST['action']; } else { @@ -473,13 +473,12 @@ if (isset($_POST['action'])) { The expression (expr1) ?? (expr2) evaluates to - expr2 if expr1 is - &null;, and expr1 otherwise. + expr2 if expr1 is not set, + as determined by isset, or is &null;. + Otherwise, it evaluates to expr1. - In particular, this operator does not emit a notice or warning if the left-hand side - value does not exist, just like isset. This is especially - useful on array keys. + This operator is especially useful for safe array access. From 5175638a2b9df402da26548b88a295113e753a2f Mon Sep 17 00:00:00 2001 From: Alexander Krause <44682073+Krause-a@users.noreply.github.com> Date: Tue, 5 May 2026 11:35:17 -0700 Subject: [PATCH 2/3] Update comparison.xml Use simpara as per guidelines --- language/operators/comparison.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/language/operators/comparison.xml b/language/operators/comparison.xml index 33a20c8033ca..2fbeedd7c88d 100644 --- a/language/operators/comparison.xml +++ b/language/operators/comparison.xml @@ -477,9 +477,9 @@ if (isset($_POST['action'])) { as determined by isset, or is &null;. Otherwise, it evaluates to expr1. - + This operator is especially useful for safe array access. - + Please note that the null coalescing operator is an expression, and that it From 5ee742e4bc306041b90a43498425f1899db5de16 Mon Sep 17 00:00:00 2001 From: Alexander Krause <44682073+Krause-a@users.noreply.github.com> Date: Wed, 6 May 2026 08:10:22 -0700 Subject: [PATCH 3/3] Update comparison.xml Reduce `isset` tie in for possible future changes --- language/operators/comparison.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/language/operators/comparison.xml b/language/operators/comparison.xml index 2fbeedd7c88d..9295116067bc 100644 --- a/language/operators/comparison.xml +++ b/language/operators/comparison.xml @@ -473,12 +473,12 @@ if (isset($_POST['action'])) { The expression (expr1) ?? (expr2) evaluates to - expr2 if expr1 is not set, - as determined by isset, or is &null;. - Otherwise, it evaluates to expr1. + expr1 if expr1 is set + and not &null;, otherwise expr2. - This operator is especially useful for safe array access. + In particular, this operator does not emit a notice or warning if the left-hand side + value is not set. This is especially useful on array keys.