Skip to content

Commit 424c4ef

Browse files
committed
minor #14376 [Validator] PHP 7.4 uninitialized typed property handling (SpiGAndromeda)
This PR was submitted for the 3.4 branch but it was squashed and merged into the 4.4 branch instead. Discussion ---------- [Validator] PHP 7.4 uninitialized typed property handling The Validator component is able to handle uninitialized properties since this [PR](symfony/symfony@1edecf7) was merged. However, the behavior (null usage) is not documented in the symfony docs. P.S. PR [14375](#14375) was closed due to wrong source branch. Commits ------- 645a4d8 [Validator] PHP 7.4 uninitialized typed property handling
2 parents 2e69b0b + 645a4d8 commit 424c4ef

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

validation.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,13 @@ class to have at least 3 characters.
611611
}
612612
}
613613
614+
.. caution::
615+
616+
With PHP 7.4, typed properties were introduced. If a property is accessed
617+
before a value is assigned (explicitly or as a default value), PHP will
618+
throw an exception. To avoid that, the Validator will use ``null`` as the
619+
properties value if it's uninitialized.
620+
614621
.. index::
615622
single: Validation; Getter constraints
616623

0 commit comments

Comments
 (0)