Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7766204

Browse filesBrowse files
committed
Some reviews
1 parent d4d6b78 commit 7766204
Copy full SHA for 7766204

File tree

1 file changed

+13
-1
lines changed
Filter options

1 file changed

+13
-1
lines changed

‎components/type_info.rst

Copy file name to clipboardExpand all lines: components/type_info.rst
+13-1Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ The TypeInfo Component
77

88
- Being able to get types from anything, such as properties, method arguments, return types, and raw strings (and can also be extended).
99

10+
.. caution::
11+
12+
This component is :doc:`experimental </contributing/code/experimental>` and could be changed at any time
13+
without prior notice.
1014

1115
Installation
1216
------------
@@ -20,7 +24,10 @@ Installation
2024
Usage
2125
-----
2226

23-
There is two ways to use this component. First one is to create a manually thanks
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.
29+
30+
There are two ways to use this component. First one is to create a type manually thanks
2431
to :class:`Symfony\\Component\\TypeInfo\\Type` static methods as following::
2532

2633
use Symfony\Component\TypeInfo\Type;
@@ -34,6 +41,7 @@ to :class:`Symfony\\Component\\TypeInfo\\Type` static methods as following::
3441
// Many others are available and can be
3542
// found in Symfony\Component\TypeInfo\TypeFactoryTrait
3643

44+
3745
Second way to use TypeInfo is to resolve a type based on reflection or a simple string::
3846

3947
use Symfony\Component\TypeInfo\Type;
@@ -54,6 +62,10 @@ Second way to use TypeInfo is to resolve a type based on reflection or a simple
5462
$type->getCollectionKeyType(); // returns an "int" Type instance
5563
$type->getCollectionValueType()->isNullable(); // returns true
5664

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.
68+
5769
.. note::
5870

5971
To support raw string resolving, you need to install ``phpstan/phpdoc-parser`` package.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.