You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHP 7.4 introduced typed properties, which have a new state - ``uninitialized``.
1280
-
This is different from the default ``null`` of untyped properties.
1281
-
When you try to access it before giving it an explicit value - you get an error.
1279
+
In PHP, typed propertieshave an ``uninitialized`` state which is different
1280
+
from the default ``null`` of untyped properties. When you try to access a typed
1281
+
property before giving it an explicit value, you get an error.
1282
1282
1283
-
By default, to avoid the Serializer throwing an error when serializing or normalizing an object with
1284
-
uninitialized properties, object normalizer catches these errors and ignores such properties.
1283
+
To avoid the Serializer throwing an error when serializing or normalizing an
1284
+
object with uninitialized properties, by default the object normalizer catches
1285
+
these errors and ignores such properties.
1285
1286
1286
-
You can disable this behavior by setting the ``AbstractObjectNormalizer::SKIP_UNINITIALIZED_VALUES`` context option to ``false``::
1287
+
You can disable this behavior by setting the ``AbstractObjectNormalizer::SKIP_UNINITIALIZED_VALUES``
1288
+
context option to ``false``::
1287
1289
1288
1290
class Dummy {
1289
1291
public string $foo = 'initialized';
@@ -1296,11 +1298,15 @@ You can disable this behavior by setting the ``AbstractObjectNormalizer::SKIP_UN
1296
1298
1297
1299
.. note::
1298
1300
1299
-
Calling ``PropertyNormalizer::normalize`` or ``GetSetMethodNormalizer::normalize`` with ``AbstractObjectNormalizer::SKIP_UNINITIALIZED_VALUES`` context option set to ``false`` will throw an ``\Error`` instance if the given object has uninitialized properties as the normalizer cannot read them (directly or via getter/isser methods).
1301
+
Calling ``PropertyNormalizer::normalize`` or ``GetSetMethodNormalizer::normalize``
1302
+
with ``AbstractObjectNormalizer::SKIP_UNINITIALIZED_VALUES`` context option set
1303
+
to ``false`` will throw an ``\Error`` instance if the given object has uninitialized
1304
+
properties as the normalizer cannot read them (directly or via getter/isser methods).
1300
1305
1301
1306
.. versionadded:: 5.4
1302
1307
1303
-
The ``AbstractObjectNormalizer::SKIP_UNINITIALIZED_VALUES`` constant was introduced in Symfony 5.4.
1308
+
The ``AbstractObjectNormalizer::SKIP_UNINITIALIZED_VALUES`` constant was
0 commit comments