/** * @return void * @group ast */ public function testGetTypeInvokesBuildClassOrInterface() { $class = new PHP_Depend_Code_Class(null); $builder = $this->getMock('PHP_Depend_BuilderI'); $builder->expects($this->once())->method('getClassOrInterface')->with($this->equalTo(__CLASS__))->will($this->returnValue($class)); $classOrInterfaceReference = new PHP_Depend_Code_ASTClassOrInterfaceReference($builder, __CLASS__); $this->assertType('PHP_Depend_Code_Class', $classOrInterfaceReference->getType()); }
/** * This method will return a class or interface instance that represents * the return value of this callable. The returned value will be <b>null</b> * if there is no return value or the return value is scalat. * * @return PHP_Depend_Code_ASTClassOrInterfaceReference * @since 0.9.5 */ public function getReturnClass() { if ($this->_returnClassReference === null) { return null; } return $this->_returnClassReference->getType(); }
/** * The magic sleep method will be called by PHP's runtime environment right * before an instance of this class gets serialized. It should return an * array with those property names that should be serialized for this class. * * @return array(string) * @since 0.10.0 */ public function __sleep() { return array_merge(array('reference'), parent::__sleep()); }
/** * testGetTypeCachesReturnValueOfBuilderContextGetClassOrInterface * * @return void */ public function testGetTypeCachesReturnValueOfBuilderContextGetClassOrInterface() { $context = $this->getBuilderContextMock(); $context->expects($this->exactly(1))->method('getClassOrInterface')->with($this->equalTo(__CLASS__))->will($this->returnValue($this)); $reference = new PHP_Depend_Code_ASTClassOrInterfaceReference($context, __CLASS__); $reference->getType(); }
/** * Returns the concrete type instance associated with with this placeholder. * * @return PHP_Depend_Code_AbstractClassOrInterface */ public function getType() { return $this->reference->getType(); }
/** * The magic sleep method will be called by PHP's runtime environment right * before an instance of this class gets serialized. It should return an * array with those property names that should be serialized for this class. * * @return array(string) * @since 0.10.0 */ public function __sleep() { $this->qualifiedName = $this->getType()->getPackageName() . '\\' . $this->getType()->getName(); return array_merge(array('qualifiedName'), parent::__sleep()); }
/** * testGetTypeDelegatesCallToInjectedReferenceObject * * @return void * @group pdepend * @group pdepend::ast * @group unittest */ public function testGetTypeDelegatesCallToInjectedReferenceObject() { $reference = $this->createNodeInstance(); $this->referenceMock->expects($this->once())->method('getType'); $reference->getType(); }