private function getScope(ReflectionClass $reflClass) { $scope = Scope::SINGLETON; if ($reflClass->hasAnnotation(Component::class)) { $annotation = $reflClass->getAnnotation(Component::class); $scope = $annotation->scope; if ($reflClass->hasAnnotation(Scope::class)) { $annotation = $reflClass->getAnnotation(Scope::class); $scope = $annotation->value; } } /** * @todo Need more work */ switch ($scope) { case Scope::SINGLETON: case Scope::REQUEST: case Scope::SESSION: $scope = Scope::SINGLETON; break; default: $scope = Scope::PROTOTYPE; break; } return $scope; }
/** * @covers PhSpring\Reflection\ReflectionClass::hasAnnotation */ public function testHasAnnotation() { $annotations = $this->object->hasAnnotation(Controller::class); $this->assertTrue($annotations); }