public function addProperty(PropertyMetadata $property) { $this->properties[$property->getName()] = $property; }
private function setReturnTypeInfo(PropertyMetadata $propertyInfo, ReflectionMethod $method) { $returnType = $method->getReturnType(); $docComment = $method->getDocComment(); if ($returnType) { $propertyInfo->setType((string) $returnType); $propertyInfo->setNullable($returnType->allowsNull()); $propertyInfo->setBuiltIn($returnType->isBuiltin()); } else { $returnType = $this->parseReturnTypeDocBlock($docComment); $propertyInfo->setType($returnType); $propertyInfo->setNullable(true); $propertyInfo->setBuiltIn(false); } $domainInfo = $this->parseDomainTypeDocBlock($docComment); $domain = $this->domainResolver->resolveDomain($propertyInfo->getType(), $domainInfo); if ($domain) { $propertyInfo->setDomain($domain); } if (is_a($propertyInfo->getType(), EntityModel::class, true)) { $propertyInfo->setReference(true); } }
private function addIntegerRule(PropertyMetadata $property, array &$rules) { if ($property->getType() === 'int') { $rules[] = new IntegerRule(); } }