Skip to content

Navigation Menu

Sign in
Appearance settings

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 a73249d

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

File tree

2 files changed

+9
-1
lines changed
Filter options

2 files changed

+9
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Tests/TypeTest.php
+6Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Type.php
+3-1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.