-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #27570 [PropertyInfo] Added support for extract type from def…
…ault value (tsantos84) This PR was squashed before being merged into the 4.3-dev branch (closes #27570). Discussion ---------- [PropertyInfo] Added support for extract type from default value | Q | A | ------------- | --- | Branch? | master | | Bug fix? | no | New feature? | yes | | BC breaks? | no | | Deprecations? | no | | Tests pass? | yes | | Fixed tickets | - | | License | MIT | | Doc PR | - | Added support for extract type from property's default value. ```php class Dummy { private $age = 30; } $types = $propertyInfo->getTypes('Dummy', 'age'); /* Example Result -------------- array(1) { [0] => class Symfony\Component\PropertyInfo\Type (6) { private $builtinType => string(3) "int" private $nullable => bool(false) private $class => 'Dummy' private $collection => bool(false) private $collectionKeyType => NULL private $collectionValueType => NULL } } */ ``` Commits ------- f6510cd [PropertyInfo] Added support for extract type from default value
- Loading branch information
Showing
4 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/Symfony/Component/PropertyInfo/Tests/Fixtures/DefaultValue.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\PropertyInfo\Tests\Fixtures; | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\PropertyInfo\Tests\Fixtures; | ||
|
||
/** | ||
* @author Tales Santos <tales.augusto.santos@gmail.com> | ||
*/ | ||
class DefaultValue | ||
{ | ||
public $defaultInt = 30; | ||
public $defaultFloat = 30.5; | ||
public $defaultString = 'foo'; | ||
public $defaultArray = []; | ||
public $defaultNull = null; | ||
} |