Skip to content

[PropertyInfo] PhpDocExtractor: Handle "true" and "false" property types #40943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ public function typesProvider()
['a', [new Type(Type::BUILTIN_TYPE_INT)], 'A.', null],
['b', [new Type(Type::BUILTIN_TYPE_OBJECT, true, 'Symfony\Component\PropertyInfo\Tests\Fixtures\ParentDummy')], 'B.', null],
['c', [new Type(Type::BUILTIN_TYPE_BOOL, true)], null, null],
['ct', [new Type(Type::BUILTIN_TYPE_TRUE, true)], null, null],
['cf', [new Type(Type::BUILTIN_TYPE_FALSE, true)], null, null],
['d', [new Type(Type::BUILTIN_TYPE_BOOL)], null, null],
['dt', [new Type(Type::BUILTIN_TYPE_TRUE)], null, null],
['df', [new Type(Type::BUILTIN_TYPE_FALSE)], null, null],
['e', [new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_RESOURCE))], null, null],
['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],
['g', [new Type(Type::BUILTIN_TYPE_ARRAY, true, null, true)], 'Nullable array.', null],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ public function testGetProperties()
'date',
'element',
'c',
'ct',
'cf',
'd',
'dt',
'df',
'e',
'f',
],
Expand Down Expand Up @@ -134,7 +138,11 @@ public function testGetPropertiesWithCustomPrefixes()
'parentAnnotationNoParent',
'date',
'c',
'ct',
'cf',
'd',
'dt',
'df',
'e',
'f',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,41 @@ public function isC()
{
}

/**
* @return true|null
*/
public function isCt()
{
}

/**
* @return false|null
*/
public function isCf()
{
}

/**
* @return bool
*/
public function canD()
{
}

/**
* @return true
*/
public function canDt()
{
}

/**
* @return false
*/
public function canDf()
{
}

/**
* @param resource $e
*/
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/PropertyInfo/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class Type
public const BUILTIN_TYPE_FLOAT = 'float';
public const BUILTIN_TYPE_STRING = 'string';
public const BUILTIN_TYPE_BOOL = 'bool';
public const BUILTIN_TYPE_TRUE = 'true';
public const BUILTIN_TYPE_FALSE = 'false';
public const BUILTIN_TYPE_RESOURCE = 'resource';
public const BUILTIN_TYPE_OBJECT = 'object';
public const BUILTIN_TYPE_ARRAY = 'array';
Expand All @@ -41,6 +43,8 @@ class Type
self::BUILTIN_TYPE_FLOAT,
self::BUILTIN_TYPE_STRING,
self::BUILTIN_TYPE_BOOL,
self::BUILTIN_TYPE_TRUE,
self::BUILTIN_TYPE_FALSE,
self::BUILTIN_TYPE_RESOURCE,
self::BUILTIN_TYPE_OBJECT,
self::BUILTIN_TYPE_ARRAY,
Expand Down