[FEATURE] Use symfony/property-info to gather doc block information 54/59454/21
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Wed, 16 Jan 2019 12:21:40 +0000 (13:21 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 3 Feb 2019 15:26:15 +0000 (16:26 +0100)
commitbcde6c0177aba345b0bd363c4519892a132ef279
treea2bfddf1447904cd2ac3bddfada1f809a22157c4
parentf4a292cc73f08dc026406a84538586387338acb4
[FEATURE] Use symfony/property-info to gather doc block information

This patch introduces the requirement to symfony/property-info
which provides a neat api to extract information about
properties via several different extractors.

The package comes with a PhpDocExtractor, which is kind of
a drop in replacement (functional wise) for the extbase
DocCommentParser which has been removed.

Along with the replacement of the doc block extractor
the package comes with an api to fetch context data that
enables us to resolve non fully qualified class names.

This is now possible:

```
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
use ExtbaseTeam\BlogExample\Domain\Model\Comment;

class Post
{
    /*
     * @var ObjectStorage<Comment>
     */
    public $comments;
}
```

Important:
This only works in extbase models as the reflection
costs are high and the information is only needed
in this case.

The non fully qualified class name is now also
supported for injection properties, although it is
still recommended to avoid injection properties in
favor of injection methods or constructor injection.

Example:

```
use TYPO3\CMS\Extbase\Annotation as Extbase;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;

class Service
{
    /*
     * @Extbase\Inject
     * @var ConfigurationManager
     */
    public $configurationManager;
}
```

Releases: master
Resolves: #87457
Change-Id: I006aeb737b4bb9790fda257e12ba46a105d9b113
Reviewed-on: https://review.typo3.org/59454
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Richard Haeser <richard@maxserv.com>
Tested-by: Richard Haeser <richard@maxserv.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
14 files changed:
composer.json
composer.lock
typo3/sysext/core/Documentation/Changelog/master/Feature-87457-UseSymfonyproperty-infoToGatherDocBlockInformation.rst [new file with mode: 0644]
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php
typo3/sysext/extbase/Classes/Reflection/ClassSchema.php
typo3/sysext/extbase/Classes/Reflection/DocBlock/Tags/Null_.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Reflection/DocBlock/Tags/Var_.php [new file with mode: 0644]
typo3/sysext/extbase/Classes/Reflection/DocCommentParser.php [deleted file]
typo3/sysext/extbase/Tests/Unit/Reflection/ClassSchema/PropertyTest.php
typo3/sysext/extbase/Tests/Unit/Reflection/ClassSchemaTest.php
typo3/sysext/extbase/Tests/Unit/Reflection/DocCommentParserTest.php [deleted file]
typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithAllTypesOfMethods.php
typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithAllTypesOfProperties.php
typo3/sysext/extbase/composer.json