Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'weierophinney/feature/doctrine-annotati…
Browse files Browse the repository at this point in the history
…ons'
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/Definition/CompilerDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ public function addCodeScannerFile(FileScanner $fileScanner)
*/
public function compile()
{
/* @var $classScanner \Zend\Code\Scanner\DerivedClassScanner */
/*
* @var $classScanner \Zend\Code\Scanner\DerivedClassScanner
*/
foreach ($this->directoryScanner->getClassNames() as $class) {
$this->processClass($class);
}
Expand All @@ -120,7 +122,6 @@ protected function processClass($class)
{
$strategy = $this->introspectionStrategy; // localize for readability

/** @var $rClass \Zend\Code\Reflection\ClassReflection */
try {
$rClass = new Reflection\ClassReflection($class);
} catch (\ReflectionException $e) {
Expand All @@ -147,7 +148,8 @@ protected function processClass($class)
$annotations = $rClass->getAnnotations($strategy->getAnnotationManager());

if (($annotations instanceof AnnotationCollection)
&& $annotations->hasAnnotation('Zend\Di\Definition\Annotation\Instantiator')) {
&& $annotations->hasAnnotation('Zend\Di\Definition\Annotation\Instantiator')
) {
// @todo Instnatiator support in annotations
}
}
Expand Down Expand Up @@ -196,7 +198,8 @@ protected function processClass($class)
$annotations = $rMethod->getAnnotations($strategy->getAnnotationManager());

if (($annotations instanceof AnnotationCollection)
&& $annotations->hasAnnotation('Zend\Di\Definition\Annotation\Inject')) {
&& $annotations->hasAnnotation('Zend\Di\Definition\Annotation\Inject')
) {

$def['methods'][$methodName] = true;
$this->processParams($def, $rClass, $rMethod);
Expand Down
5 changes: 4 additions & 1 deletion src/Definition/IntrospectionStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Zend\Di\Definition;

use Zend\Code\Annotation\AnnotationManager;
use Zend\Code\Annotation\Parser\GenericAnnotationParser;

class IntrospectionStrategy
{
Expand Down Expand Up @@ -54,7 +55,9 @@ public function getAnnotationManager()
public function createDefaultAnnotationManager()
{
$annotationManager = new AnnotationManager;
$annotationManager->registerAnnotation(new Annotation\Inject());
$parser = new GenericAnnotationParser();
$parser->registerAnnotation(new Annotation\Inject());
$annotationManager->attach($parser);
return $annotationManager;
}

Expand Down

0 comments on commit 98036b5

Please sign in to comment.