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

@ -29,8 +29,8 @@ class Navigation
/**
* Install navigation providing
*
* @param string $path Module path
* @param ApplicationAbstract $app Application
* @param string $path Module path
* @param ApplicationAbstract $app Application
*
* @return void
*

View File

@ -6,7 +6,7 @@ use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
'^.*/contract/list.*$' => [
'^.*/contract/list.*$' => [
[
'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractList',
'verb' => RouteVerb::GET,

View File

@ -42,7 +42,7 @@ use Modules\ContractManagement\Models\ContractMapper;
*/
final class ApiController extends Controller
{
/**
/**
* Api method to create a contract
*
* @param RequestAbstract $request Request
@ -57,7 +57,7 @@ final class ApiController extends Controller
*/
public function apiContractCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
{
if (!empty($val = $this->validateContractCreate($request))) {
if (!empty($val = $this->validateContractCreate($request))) {
$response->set('contract_create', new FormValidation($val));
$response->header->status = RequestStatusCode::R_400;
@ -103,11 +103,11 @@ final class ApiController extends Controller
*/
private function createContractFromRequest(RequestAbstract $request) : Contract
{
$contract = new Contract();
$contract->title = (string) ($request->getData('title') ?? '');
$contract = new Contract();
$contract->title = (string) ($request->getData('title') ?? '');
$contract->description = (string) ($request->getData('description') ?? '');
$contract->type = new NullContractType((int) ($request->getData('type') ?? 0));
$contract->start = new \DateTime($request->getData('start') ?? 'now');
$contract->type = new NullContractType((int) ($request->getData('type') ?? 0));
$contract->start = new \DateTime($request->getData('start') ?? 'now');
if (!empty($request->getData('end'))) {
$contract->end = new \DateTime($request->getData('end'));
@ -202,7 +202,7 @@ final class ApiController extends Controller
*/
private function createContractTypeFromRequest(RequestAbstract $request) : ContractType
{
$contractType = new ContractType();
$contractType = new ContractType();
$contractType->name = (string) ($request->getData('name') ?? '');
return $contractType;

View File

@ -36,7 +36,7 @@ use Modules\ContractManagement\Models\ContractMapper;
*/
final class BackendController extends Controller
{
/**
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request

View File

@ -77,7 +77,7 @@ class Contract
*/
public function __construct()
{
$this->createdAt = new \DateTimeImmutable('now');
$this->createdAt = new \DateTimeImmutable('now');
}
/**

View File

@ -48,9 +48,7 @@ class ContractType implements \JsonSerializable, ArrayableInterface
*
* @var ContractTypeL11n
*/
protected string |
ContractTypeL11n $l11n;
protected string | ContractTypeL11n $l11n;
/**
* Constructor.
@ -82,22 +80,22 @@ class ContractType implements \JsonSerializable, ArrayableInterface
* Set l11n
*
* @param string|ContractTypeL11n $l11n Tag article l11n
* @param string $lang Language
* @param string $lang Language
*
* @return void
*
* @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) {
$this->l11n = $l11n;
} elseif (\is_string($l11n)) {
} elseif ($this->l11n instanceof ContractTypeL11n) {
$this->l11n->title = $l11n;
} else {
$this->l11n = new ContractTypeL11n();
$this->l11n->title = $l11n;
$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
* @since 1.0.0
*/
protected int |
ContractType $type = 0;
protected int | ContractType $type = 0;
/**
* Language.
@ -65,8 +63,8 @@ ContractType $type = 0;
* Constructor.
*
* @param int|ContractType $type Attribute type
* @param string $title Localized title
* @param string $language Language
* @param string $title Localized title
* @param string $language Language
*
* @since 1.0.0
*/

View File

@ -33,14 +33,14 @@ echo $this->getData('nav')->render(); ?>
<div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
</div>
</div>
<div class="row">
</div>
</div>
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
</div>
</div>
<div class="row">
</div>
</div>
</div>
</div>