Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b7658aa

Browse files
author
Maciej Zgadzaj
committed
PhpDocExtractor: Handle "true" and "false" property types
1 parent ef17a59 commit b7658aa

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ public function typesProvider()
109109
['a', [new Type(Type::BUILTIN_TYPE_INT)], 'A.', null],
110110
['b', [new Type(Type::BUILTIN_TYPE_OBJECT, true, 'Symfony\Component\PropertyInfo\Tests\Fixtures\ParentDummy')], 'B.', null],
111111
['c', [new Type(Type::BUILTIN_TYPE_BOOL, true)], null, null],
112+
['ct', [new Type(Type::BUILTIN_TYPE_TRUE, true)], null, null],
113+
['cf', [new Type(Type::BUILTIN_TYPE_FALSE, true)], null, null],
112114
['d', [new Type(Type::BUILTIN_TYPE_BOOL)], null, null],
115+
['dt', [new Type(Type::BUILTIN_TYPE_TRUE)], null, null],
116+
['df', [new Type(Type::BUILTIN_TYPE_FALSE)], null, null],
113117
['e', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_RESOURCE))], null, null],
114118
['f', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTime'))], null, null],
115119
['g', [new Type(Type::BUILTIN_TYPE_ARRAY, true, null, true)], 'Nullable array.', null],

src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ public function testGetProperties()
8888
'date',
8989
'element',
9090
'c',
91+
'ct',
92+
'cf',
9193
'd',
94+
'dt',
95+
'df',
9296
'e',
9397
'f',
9498
],
@@ -134,7 +138,11 @@ public function testGetPropertiesWithCustomPrefixes()
134138
'parentAnnotationNoParent',
135139
'date',
136140
'c',
141+
'ct',
142+
'cf',
137143
'd',
144+
'dt',
145+
'df',
138146
'e',
139147
'f',
140148
],

src/Symfony/Component/PropertyInfo/Tests/Fixtures/ParentDummy.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,41 @@ public function isC()
6565
{
6666
}
6767

68+
/**
69+
* @return true|null
70+
*/
71+
public function isCt()
72+
{
73+
}
74+
75+
/**
76+
* @return false|null
77+
*/
78+
public function isCf()
79+
{
80+
}
81+
6882
/**
6983
* @return bool
7084
*/
7185
public function canD()
7286
{
7387
}
7488

89+
/**
90+
* @return true
91+
*/
92+
public function canDt()
93+
{
94+
}
95+
96+
/**
97+
* @return false
98+
*/
99+
public function canDf()
100+
{
101+
}
102+
75103
/**
76104
* @param resource $e
77105
*/

src/Symfony/Component/PropertyInfo/Type.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class Type
2424
public const BUILTIN_TYPE_FLOAT = 'float';
2525
public const BUILTIN_TYPE_STRING = 'string';
2626
public const BUILTIN_TYPE_BOOL = 'bool';
27+
public const BUILTIN_TYPE_TRUE = 'true';
28+
public const BUILTIN_TYPE_FALSE = 'false';
2729
public const BUILTIN_TYPE_RESOURCE = 'resource';
2830
public const BUILTIN_TYPE_OBJECT = 'object';
2931
public const BUILTIN_TYPE_ARRAY = 'array';
@@ -41,6 +43,8 @@ class Type
4143
self::BUILTIN_TYPE_FLOAT,
4244
self::BUILTIN_TYPE_STRING,
4345
self::BUILTIN_TYPE_BOOL,
46+
self::BUILTIN_TYPE_TRUE,
47+
self::BUILTIN_TYPE_FALSE,
4448
self::BUILTIN_TYPE_RESOURCE,
4549
self::BUILTIN_TYPE_OBJECT,
4650
self::BUILTIN_TYPE_ARRAY,

0 commit comments

Comments
 (0)