fix phpstan lvl 9 bugs

This commit is contained in:
Dennis Eichhorn 2022-12-26 20:52:58 +01:00
parent 693400e2fd
commit ce530f6d9b
7 changed files with 20 additions and 3 deletions

View File

@ -184,7 +184,9 @@ final class ApiController extends Controller
$unit = $this->createUnitFromRequest($request);
$this->createModel($request->header->account, $unit, UnitMapper::class, 'unit', $request->getOrigin());
if ($this->app->appSettings->get(null, SettingsEnum::GROUP_GENERATE_AUTOMATICALLY_UNIT)->content === '1') {
/** @var \Model\Setting $setting */
$setting = $this->app->appSettings->get(null, SettingsEnum::GROUP_GENERATE_AUTOMATICALLY_UNIT);
if ($setting->content === '1') {
$newRequest = new HttpRequest();
$newRequest->header->account = $request->header->account;
$newRequest->setData('name', 'org:unit:' . \strtolower($unit->name));
@ -403,7 +405,9 @@ final class ApiController extends Controller
$position = $this->createPositionFromRequest($request);
$this->createModel($request->header->account, $position, PositionMapper::class, 'position', $request->getOrigin());
if ($this->app->appSettings->get(null, SettingsEnum::GROUP_GENERATE_AUTOMATICALLY_POSITION)->content === '1') {
/** @var \Model\Setting $setting */
$setting = $this->app->appSettings->get(null, SettingsEnum::GROUP_GENERATE_AUTOMATICALLY_POSITION);
if ($setting->content === '1') {
$newRequest = new HttpRequest();
$newRequest->header->account = $request->header->account;
$newRequest->setData('name', 'org:pos:' . \str_replace(' ', '_', \strtolower($position->name)));
@ -577,7 +581,9 @@ final class ApiController extends Controller
$department = $this->createDepartmentFromRequest($request);
$this->createModel($request->header->account, $department, DepartmentMapper::class, 'department', $request->getOrigin());
if ($this->app->appSettings->get(null, SettingsEnum::GROUP_GENERATE_AUTOMATICALLY_DEPARTMENT)->content === '1') {
/** @var \Model\Setting $setting */
$setting = $this->app->appSettings->get(null, SettingsEnum::GROUP_GENERATE_AUTOMATICALLY_DEPARTMENT);
if ($setting->content === '1') {
$newRequest = new HttpRequest();
$newRequest->header->account = $request->header->account;
$newRequest->setData('name', 'org:dep:' . \strtolower($department->name));

View File

@ -78,7 +78,9 @@ class DepartmentTagSelectorPopupView extends View
*/
public function render(mixed ...$data) : string
{
/** @var array{0:null|string} $data */
$this->id = $data[0] ?? $this->id;
return parent::render();
}
}

View File

@ -95,9 +95,11 @@ class DepartmentTagSelectorView extends View
*/
public function render(mixed ...$data) : string
{
/** @var array{0:string, 1:string, 2:null|bool} $data */
$this->id = $data[0];
$this->name = $data[1];
$this->isRequired = $data[2] ?? false;
$this->getData('department-selector-popup')->setId($this->id);
return parent::render();

View File

@ -78,7 +78,9 @@ class PositionTagSelectorPopupView extends View
*/
public function render(mixed ...$data) : string
{
/** @var array{0:null|string} $data */
$this->id = $data[0] ?? $this->id;
return parent::render();
}
}

View File

@ -95,9 +95,11 @@ class PositionTagSelectorView extends View
*/
public function render(mixed ...$data) : string
{
/** @var array{0:string, 1:string, 2:null|bool} $data */
$this->id = $data[0];
$this->name = $data[1];
$this->isRequired = $data[2] ?? false;
$this->getData('position-selector-popup')->setId($this->id);
return parent::render();

View File

@ -78,6 +78,8 @@ class UnitTagSelectorPopupView extends View
*/
public function render(mixed ...$data) : string
{
/** @var array{0:null|string} $data */
$this->id = $data[0] ?? $this->id;
return parent::render();
}

View File

@ -95,6 +95,7 @@ class UnitTagSelectorView extends View
*/
public function render(mixed ...$data) : string
{
/** @var array{0:string, 1:string, 2:null|bool} $data */
$this->id = $data[0];
$this->name = $data[1];
$this->isRequired = $data[2] ?? false;