8000 [PropertyInfo] Add support for the iterable type · symfony/symfony@a73249d · GitHub
[go: up one dir, main page]

Skip to content

Commit a73249d

Browse files
dunglasfabpot
authored andcommitted
[PropertyInfo] Add support for the iterable type
1 parent d04c0ea commit a73249d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Symfony/Component/PropertyInfo/Tests/TypeTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ public function testConstruct()
3737
$this->assertEquals(Type::BUILTIN_TYPE_STRING, $collectionValueType->getBuiltinType());
3838
}
3939

40+
public function testIterable()
41+
{
42+
$type = new Type('iterable');
43+
$this->assertSame('iterable', $type->getBuiltinType());
44+
}
45+
4046
/**
4147
* @expectedException \InvalidArgumentException
4248
* @expectedExceptionMessage "foo" is not a valid PHP type.

src/Symfony/Component/PropertyInfo/Type.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Type
2727
const BUILTIN_TYPE_ARRAY = 'array';
2828
const BUILTIN_TYPE_NULL = 'null';
2929
const BUILTIN_TYPE_CALLABLE = 'callable';
30+
const BUILTIN_TYPE_ITERABLE = 'iterable';
3031

3132
/**
3233
* List of PHP builtin types.
@@ -43,6 +44,7 @@ class Type
4344
self::BUILTIN_TYPE_ARRAY,
4445
self::BUILTIN_TYPE_CALLABLE,
4546
self::BUILTIN_TYPE_NULL,
47+
self::BUILTIN_TYPE_ITERABLE,
4648
);
4749

4850
/**
@@ -102,7 +104,7 @@ public function __construct($builtinType, $nullable = false, $class = null, $col
102104
/**
103105
* Gets built-in type.
104106
*
105-
* Can be bool, int, float, string, array, object, resource, null or callback.
107+
* Can be bool, int, float, string, array, object, resource, null, callback or iterable.
106108
*
107109
* @return string
108110
*/

0 commit comments

Comments
 (0)
0