fix phpstan/phpcs

This commit is contained in:
Dennis Eichhorn 2021-06-26 14:38:08 +02:00
parent 8b33381d0c
commit 4838f51422
8 changed files with 28 additions and 32 deletions

View File

@ -48,9 +48,7 @@ class ContractType implements \JsonSerializable, ArrayableInterface
* *
* @var ContractTypeL11n * @var ContractTypeL11n
*/ */
protected string | protected string | ContractTypeL11n $l11n;
ContractTypeL11n $l11n;
/** /**
* Constructor. * Constructor.
@ -88,16 +86,16 @@ class ContractType implements \JsonSerializable, ArrayableInterface
* *
* @since 1.0.0 * @since 1.0.0
*/ */
public function setL11n($l11n, string $lang = ISO639x1Enum::_EN) : void public function setL11n(string|ContractTypeL11n $l11n, string $lang = ISO639x1Enum::_EN) : void
{ {
if ($l11n instanceof ContractTypeL11n) { if ($l11n instanceof ContractTypeL11n) {
$this->l11n = $l11n; $this->l11n = $l11n;
} elseif (\is_string($l11n)) { } elseif ($this->l11n instanceof ContractTypeL11n) {
$this->l11n->title = $l11n;
} else {
$this->l11n = new ContractTypeL11n(); $this->l11n = new ContractTypeL11n();
$this->l11n->title = $l11n; $this->l11n->title = $l11n;
$this->l11n->setLanguage($lang); $this->l11n->setLanguage($lang);
} elseif ($this->l11n instanceof ContractTypeL11n && \is_string($l11n)) {
$this->l11n->title = $l11n;
} }
} }

View File

@ -41,9 +41,7 @@ class ContractTypeL11n implements \JsonSerializable, ArrayableInterface
* @var int|ContractType * @var int|ContractType
* @since 1.0.0 * @since 1.0.0
*/ */
protected int | protected int | ContractType $type = 0;
ContractType $type = 0;
/** /**
* Language. * Language.