public function __construct(Clazz $class, Property $property, $declaringClass = null)
 {
     $this->class = $class;
     $this->property = $property;
     $this->name = $property->getName();
     if ($class->getName() === $declaringClass) {
         $declaringClass = null;
     }
     $this->declaringClass = $declaringClass;
 }
 private function insertProperty(Property $property, $packageVersionId)
 {
     $this->propertyStmt->bindValue(1, $property->getName());
     $this->propertyStmt->bindValue(2, $property->getVisibility(), \PDO::PARAM_INT);
     $this->propertyStmt->bindValue(3, $this->phpType->convertToDatabaseValue($property->getPhpType(), $this->platform));
     $this->propertyStmt->bindValue(4, $packageVersionId, \PDO::PARAM_INT);
     $this->propertyStmt->execute();
     $propertyId = $this->con->lastInsertId();
     $this->propertyIdRef->setValue($property, $propertyId);
     return $propertyId;
 }
 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);
     }
 }
예제 #4
0
 public function addProperty(Property $property, $declaringClass = null)
 {
     $classProperty = new ClassProperty($this, $property, $declaringClass);
     $this->properties->set($property->getName(), $classProperty);
 }