required = FALSE; } $type = preg_grep('/null/i', $type, PREG_GREP_INVERT); // If there is one `@var` type, then attempt to infer the `dataType` and `serialize` type. if (count($type) === 1) { switch ($type[0]) { case 'string[]': case 'int[]': case 'bool[]': case 'array': $autoDataType = 'Blob'; $autoSerialize = \CRM_Core_DAO::SERIALIZE_JSON; break; case 'string': case 'int': $autoDataType = ucfirst($type[0]); $autoSerialize = NULL; break; case 'bool': $autoDataType = 'Boolean'; $autoSerialize = NULL; break; } if ($this->dataType === NULL) { $this->setDataType($autoDataType); } if ($this->serialize === NULL) { $this->setSerialize($autoSerialize); } } $this->type = $type; return $this; } /** * @return string[] */ public function getType(): array { return $this->type; } }