phpstan fixes

This commit is contained in:
Dennis Eichhorn 2020-11-27 22:56:16 +01:00
parent e0dbea336c
commit a1b0f6ad60
4 changed files with 9 additions and 87 deletions

View File

@ -48,7 +48,7 @@ final class Installer extends InstallerAbstract
$id = WikiAppMapper::create($app);
$category = new WikiCategory();
$category->setApp(new NullWikiApp($id));
$category->app = new NullWikiApp($id);
$category->setName('Default');
WikiCategoryMapper::create($category);
@ -62,7 +62,7 @@ final class Installer extends InstallerAbstract
$id = WikiAppMapper::create($app);
$category = new WikiCategory();
$category->setApp(new NullWikiApp($id));
$category->app = new NullWikiApp($id);
$category->setName('Default');
}
}

View File

@ -89,10 +89,10 @@ final class ApiController extends Controller
$doc->name = (string) $request->getData('title');
$doc->doc = Markdown::parse((string) ($request->getData('plain') ?? ''));
$doc->docRaw = (string) ($request->getData('plain') ?? '');
$doc->setCategory(new NullWikiCategory((int) ($request->getData('category') ?? 1)));
$doc->category = new NullWikiCategory((int) ($request->getData('category') ?? 1));
$doc->setLanguage((string) ($request->getData('language') ?? $request->getLanguage()));
$doc->setStatus((int) ($request->getData('status') ?? WikiStatus::INACTIVE));
$doc->setApp(new NullWikiApp((int) ($request->getData('app') ?? 1)));
$doc->app = new NullWikiApp((int) ($request->getData('app') ?? 1));
if (!empty($tags = $request->getDataJson('tags'))) {
foreach ($tags as $tag) {
@ -335,7 +335,7 @@ final class ApiController extends Controller
public function createWikiCategoryFromRequest(RequestAbstract $request) : WikiCategory
{
$category = new WikiCategory();
$category->setApp(new NullWikiApp((int) ($request->getData('app') ?? 1)));
$category->app = new NullWikiApp((int) ($request->getData('app') ?? 1));
if ($request->getData('parent') !== null) {
$category->parent = new NullWikiCategory((int) $request->getData('parent'));

View File

@ -42,7 +42,7 @@ class WikiCategory implements \JsonSerializable
* @var WikiApp
* @since 1.0.0
*/
private WikiApp $app;
public WikiApp $app;
/**
* Name.
@ -91,32 +91,6 @@ class WikiCategory implements \JsonSerializable
return $this->id;
}
/**
* Get app
*
* @return WikiApp
*
* @since 1.0.0
*/
public function getApp() : WikiApp
{
return $this->app ?? new NullWikiApp();
}
/**
* Set app
*
* @param null|WikiApp $app App
*
* @return void
*
* @since 1.0.0
*/
public function setApp(?WikiApp $app) : void
{
$this->app = $app;
}
/**
* Get name
*
@ -132,7 +106,7 @@ class WikiCategory implements \JsonSerializable
/**
* Set name
*
* @param string|TagL11n $name Tag article name
* @param string|WikiCategoryL11n $name Tag article name
*
* @return void
*

View File

@ -42,7 +42,7 @@ class WikiDoc implements \JsonSerializable
* @var null|WikiApp
* @since 1.0.0
*/
private ?WikiApp $app = null;
public ?WikiApp $app = null;
/**
* Name.
@ -82,7 +82,7 @@ class WikiDoc implements \JsonSerializable
* @var null|WikiCategory
* @since 1.0.0
*/
private ?WikiCategory $category = null;
public ?WikiCategory $category = null;
/**
* Language.
@ -112,32 +112,6 @@ class WikiDoc implements \JsonSerializable
return $this->id;
}
/**
* Get app
*
* @return WikiApp
*
* @since 1.0.0
*/
public function getApp() : WikiApp
{
return $this->app ?? new NullWikiApp();
}
/**
* Set app
*
* @param null|WikiApp $app App
*
* @return void
*
* @since 1.0.0
*/
public function setApp(?WikiApp $app) : void
{
$this->app = $app;
}
/**
* Get language
*
@ -190,32 +164,6 @@ class WikiDoc implements \JsonSerializable
$this->status = $status;
}
/**
* Get category
*
* @return WikiCategory
*
* @since 1.0.0
*/
public function getCategory() : WikiCategory
{
return $this->category ?? new NullWikiCategory();
}
/**
* Set cateogry
*
* @param null|WikiCategory $category Category
*
* @return void
*
* @since 1.0.0
*/
public function setCategory(?WikiCategory $category) : void
{
$this->category = $category;
}
/**
* Get tags
*