11The TypeInfo Component
22======================
33
4- The TypeInfo component extracts PHP types information. It aims to:
4+ The TypeInfo component extracts type information from PHP elements like properties,
5+ arguments and return types.
56
6- - Have a powerful Type definition that can handle union, intersections, and generics (and could be even more extended)
7+ This component provides:
78
8- - Being able to get types from anything, such as properties, method arguments, return types, and raw strings (and can also be extended).
9+ * A powerful ``Type `` definition that can handle unions, intersections, and generics
10+ (and can be extended to support more types in the future);
11+ * A way to get types from PHP elements such as properties, method arguments,
12+ return types, and raw strings.
913
1014.. caution ::
1115
12- This component is :doc: `experimental </contributing/code/experimental >` and could be changed at any time
13- without prior notice.
16+ This component is :doc: `experimental </contributing/code/experimental >` and
17+ could be changed at any time without prior notice.
1418
1519Installation
1620------------
@@ -24,11 +28,11 @@ Installation
2428Usage
2529-----
2630
27- This component will gives you a :class: `Symfony\\ Component\\ TypeInfo\\ Type ` object that represents
28- the PHP type of whatever you builded or asked to resolve.
31+ This component gives you a :class: `Symfony\\ Component\\ TypeInfo\\ Type ` object that
32+ represents the PHP type of anything you built or asked to resolve.
2933
3034There are two ways to use this component. First one is to create a type manually thanks
31- to :class: `Symfony\\ Component\\ TypeInfo\\ Type ` static methods as following::
35+ to the :class: `Symfony\\ Component\\ TypeInfo\\ Type ` static methods as following::
3236
3337 use Symfony\Component\TypeInfo\Type;
3438
@@ -41,8 +45,8 @@ to :class:`Symfony\\Component\\TypeInfo\\Type` static methods as following::
4145 // Many others are available and can be
4246 // found in Symfony\Component\TypeInfo\TypeFactoryTrait
4347
44-
45- Second way to use TypeInfo is to resolve a type based on reflection or a simple string::
48+ The second way of using the component is to use `` TypeInfo `` to resolve a type
49+ based on reflection or a simple string::
4650
4751 use Symfony\Component\TypeInfo\Type;
4852 use Symfony\Component\TypeInfo\TypeResolver\TypeResolver;
@@ -62,9 +66,9 @@ Second way to use TypeInfo is to resolve a type based on reflection or a simple
6266 $type->getCollectionKeyType(); // returns an "int" Type instance
6367 $type->getCollectionValueType()->isNullable(); // returns true
6468
65- Each of this rows will return you a Type instance that will corresponds to whatever static method you used to build it.
66- We also can resolve a type from a string like we can see in this example with the ` 'bool' ` parameter it is mostly
67- designed that way so we can give TypeInfo a string from whatever was extracted from existing phpDoc within PropertyInfo.
69+ Each of this calls will return you a `` Type `` instance that corresponds to the
70+ static method used. You can also resolve types from a string (as shown in the
71+ `` bool `` parameter of the previous example)
6872
6973.. note ::
7074
0 commit comments