/** * @group packageDependencies */ public function testDeletePackageVersionWhenInheritingBetweenPackages() { $this->packageVersion->addContainer($foo = new Clazz('Foo')); $foo->addProperty($fooProperty = new Property('foo')); $fooProperty->setPhpType($this->typeRegistry->getNativeType('string')); $this->em->persist($this->packageVersion); $this->otherPackageVersion->addDependency($this->packageVersion); $this->otherPackageVersion->addContainer($bar = new Clazz('bar')); $bar->addProperty($fooProperty, 'Foo'); $this->em->persist($this->otherPackageVersion); $this->em->flush(); $this->assertVersionsCount(2); $this->repo->deletePackageVersion($this->packageVersion); $this->em->clear(); $this->assertVersionsCount(0); }
private function inferTypesForProperty(Property $property) { if (($type = $property->getPhpType()) && !$type->isUnknownType()) { return; } if (null !== ($node = $property->getAstNode())) { if ($property instanceof \PHPParser_Node_Stmt_Class) { $type = $this->parser->getTypeFromMagicPropertyAnnotation($node, $property->getName()); } else { $type = $this->parser->getTypeFromVarAnnotation($node); } } if (null === $type) { $type = $this->registry->getNativeType('unknown'); } $property->setPhpType($type); if ($node) { $node->setAttribute('type', $type); } }