Bug #57034

Dependency injection for imported namespaces fails for collection classes

Added by Bastian Waidelich over 7 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Must have
Category:
Reflection
Target version:
-
Start date:
2014-03-18
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

In our Coding Guidelines we encourage developers to import namespaces in order to increase readability.
With #46008 the ReflectionService is able to resolve relative and imported namespace (with #50909 this also works for abstract classes).

But this does not work for our custom notation of Collection types.
So while this works:

class SomeClass {

    /**
     * @var \Doctrine\Common\Collections\Collection<\Some\Package\Domain\Model\SubEntity>
     */
    protected $subEntities;

    /**
     * @param \Doctrine\Common\Collections\Collection<\Some\Package\Domain\Model\SubEntity>$subEntities
     */
    public function setSubEntities(\Doctrine\Common\Collections\Collection $subEntities) {
        $this->subEntities = $subEntities;
    }

}

This will currently throw an exception:

use Doctrine\Common\Collections\Collection;
use Some\Package\Domain\Model\SubEntity as ImportedSubEntity;

class SomeClass {

    /**
     * @var Collection<ImportedSubEntity>
     */
    protected $subEntities;

    /**
     * @param Collection<ImportedSubEntity>$subEntities
     */
    public function setSubEntities(Collection $subEntities) {
        $this->subEntities = $subEntities;
    }

}


Related issues

Related to TYPO3.Flow - Bug #46008: Reflection should resolve relative namespacesResolvedSebastian Kurfuerst2013-03-04

Actions
Related to TYPO3.Flow - Bug #50909: Dependency injection for imported namespaces fails for abstract classesResolvedBastian Waidelich2013-08-08

Actions
#1

Updated by Gerrit Code Review over 7 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/28490

#2

Updated by Gerrit Code Review over 7 years ago

Patch set 1 for branch 2.2 of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/28554

#3

Updated by Gerrit Code Review over 7 years ago

Patch set 1 for branch 2.1 of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/28555

#4

Updated by Bastian Waidelich over 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF