public function persist(GlobalConstant $constant, $packageVersionId) { $this->insertStmt->bindValue(1, $constant->getName()); $this->insertStmt->bindValue(2, $this->phpType->convertToDatabaseValue($constant->getPhpType(), $this->platform)); $this->insertStmt->bindValue(3, $packageVersionId, \PDO::PARAM_INT); $this->insertStmt->execute(); }
private function inferTypesForConstant(GlobalConstant $constant) { if (($type = $constant->getPhpType()) && !$type->isUnknownType()) { return; } if (null !== ($node = $constant->getAstNode())) { $type = $this->parser->getTypeFromVarAnnotation($node); } if (null === $type) { $type = $this->registry->getNativeType('unknown'); } $constant->setPhpType($type); if ($node) { $node->setAttribute('type', $type); } }