mirror of
https://github.com/Karaka-Management/oms-ProjectManagement.git
synced 2026-01-11 15:48:41 +00:00
phpstan, phpcs, phpunit fixes
This commit is contained in:
parent
714a814c05
commit
35366d5415
|
|
@ -227,11 +227,6 @@
|
|||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
},
|
||||
"projectmanagement_project_attr_value_type": {
|
||||
"name": "projectmanagement_project_attr_value_type",
|
||||
"type": "INT(11)",
|
||||
"null": false
|
||||
},
|
||||
"projectmanagement_project_attr_value_valueStr": {
|
||||
"name": "projectmanagement_project_attr_value_valueStr",
|
||||
"type": "VARCHAR(255)",
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ final class ProjectAttributeMapper extends DataMapperFactory
|
|||
/**
|
||||
* Has one relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const OWNS_ONE = [
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\ProjectManagement\Models;
|
||||
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
|
|
@ -65,9 +66,9 @@ class ProjectAttributeType implements \JsonSerializable
|
|||
/**
|
||||
* Localization
|
||||
*
|
||||
* @var ProjectAttributeTypeL11n
|
||||
* @var BaseStringL11n
|
||||
*/
|
||||
private string | ProjectAttributeTypeL11n $l11n;
|
||||
private string | BaseStringL11n $l11n;
|
||||
|
||||
/**
|
||||
* Possible default attribute values
|
||||
|
|
@ -103,22 +104,23 @@ class ProjectAttributeType implements \JsonSerializable
|
|||
/**
|
||||
* Set l11n
|
||||
*
|
||||
* @param string|ProjectAttributeTypeL11n $l11n Tag article l11n
|
||||
* @param string $lang Language
|
||||
* @param string|BaseStringL11n $l11n Tag article l11n
|
||||
* @param string $lang Language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setL11n(string | ProjectAttributeTypeL11n $l11n, string $lang = ISO639x1Enum::_EN) : void
|
||||
public function setL11n(string | BaseStringL11n $l11n, string $lang = ISO639x1Enum::_EN) : void
|
||||
{
|
||||
if ($l11n instanceof ProjectAttributeTypeL11n) {
|
||||
if ($l11n instanceof BaseStringL11n) {
|
||||
$this->l11n = $l11n;
|
||||
} elseif (isset($this->l11n) && $this->l11n instanceof ProjectAttributeTypeL11n) {
|
||||
$this->l11n->title = $l11n;
|
||||
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->setLanguage($lang);
|
||||
} else {
|
||||
$this->l11n = new ProjectAttributeTypeL11n();
|
||||
$this->l11n->title = $l11n;
|
||||
$this->l11n = new BaseStringL11n();
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->setLanguage($lang);
|
||||
}
|
||||
}
|
||||
|
|
@ -130,7 +132,11 @@ class ProjectAttributeType implements \JsonSerializable
|
|||
*/
|
||||
public function getL11n() : string
|
||||
{
|
||||
return $this->l11n instanceof ProjectAttributeTypeL11n ? $this->l11n->title : $this->l11n;
|
||||
if (!isset($this->l11n)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ final class ProjectAttributeTypeL11nMapper extends DataMapperFactory
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var string
|
||||
* @var class-string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ final class ProjectAttributeTypeMapper extends DataMapperFactory
|
|||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const HAS_MANY = [
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class ProjectAttributeValue implements \JsonSerializable
|
|||
/**
|
||||
* Set value
|
||||
*
|
||||
* @param int|string|float|\DateTimeInterface $value Value
|
||||
* @param int|string|float $value Value
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -142,7 +142,7 @@ class ProjectAttributeValue implements \JsonSerializable
|
|||
} elseif ($datatype === AttributeValueType::_FLOAT) {
|
||||
$this->valueDec = (float) $value;
|
||||
} elseif ($datatype === AttributeValueType::_DATETIME) {
|
||||
$this->valueDat = new \DateTime($value);
|
||||
$this->valueDat = new \DateTime((string) $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -172,7 +172,7 @@ class ProjectAttributeValue implements \JsonSerializable
|
|||
* Set l11n
|
||||
*
|
||||
* @param string|BaseStringL11n $l11n Tag article l11n
|
||||
* @param string $lang Language
|
||||
* @param string $lang Language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -183,11 +183,12 @@ class ProjectAttributeValue implements \JsonSerializable
|
|||
if ($l11n instanceof BaseStringL11n) {
|
||||
$this->l11n = $l11n;
|
||||
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->setLanguage($lang);
|
||||
} else {
|
||||
$this->l11n = new BaseStringL11n();
|
||||
$this->l11n = new BaseStringL11n();
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->ref = $this->id;
|
||||
$this->l11n->ref = $this->id;
|
||||
$this->l11n->setLanguage($lang);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ final class ProjectAttributeValueMapper extends DataMapperFactory
|
|||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ final class ProjectMapper extends DataMapperFactory
|
|||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const HAS_MANY = [
|
||||
|
|
@ -86,7 +86,7 @@ final class ProjectMapper extends DataMapperFactory
|
|||
/**
|
||||
* Has one relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const OWNS_ONE = [
|
||||
|
|
@ -99,7 +99,7 @@ final class ProjectMapper extends DataMapperFactory
|
|||
/**
|
||||
* Belongs to.
|
||||
*
|
||||
* @var array<string, array{mapper:string, external:string, column?:string, by?:string}>
|
||||
* @var array<string, array{mapper:class-string, external:string, column?:string, by?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const BELONGS_TO = [
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user