8000 [Validator] PHP 7.4 uninitialized typed property handling by SpiGAndromeda · Pull Request #14376 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Validator] PHP 7.4 uninitialized typed property handling #14376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,13 @@ class to have at least 3 characters.
}
}

.. caution::

With PHP 7.4, typed properties were introduced. If a property is accessed
before a value is assigned (explicitly or as a default value), PHP will
throw an exception. To avoid that, the Validator will use ``null`` as the
properties value if it's uninitialized.

.. index::
single: Validation; Getter constraints

Expand Down
0