mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
fix phpstan bugs
This commit is contained in:
parent
2350b6cf53
commit
d7ce34a6cc
|
|
@ -144,6 +144,19 @@ abstract class ModuleAbstract
|
|||
$this->receiving[] = $module;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get modules this module is receiving from
|
||||
*
|
||||
* @return array<int, string>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getReceiving() : array
|
||||
{
|
||||
/** @noinspection PhpUndefinedFieldInspection */
|
||||
return $this->receiving;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get modules this module is providing for
|
||||
*
|
||||
|
|
@ -304,7 +317,7 @@ abstract class ModuleAbstract
|
|||
$mapper();
|
||||
}
|
||||
$this->app->eventManager->trigger('POST:Module:' . static::MODULE_NAME . '-' . $trigger . '-update', '', [
|
||||
$request->getHEader()->getAccount(),
|
||||
$request->getHeader()->getAccount(),
|
||||
$old, $new,
|
||||
0, 0,
|
||||
static::MODULE_NAME,
|
||||
|
|
@ -328,7 +341,7 @@ abstract class ModuleAbstract
|
|||
$this->app->eventManager->trigger('PRE:Module:' . static::MODULE_NAME . '-' . $trigger . '-delete', '', $obj);
|
||||
$mapper::delete($obj);
|
||||
$this->app->eventManager->trigger('POST:Module:' . static::MODULE_NAME . '-' . $trigger . '-delete', '', [
|
||||
$request->getHEader()->getAccount(),
|
||||
$request->getHeader()->getAccount(),
|
||||
$obj, null,
|
||||
0, 0,
|
||||
static::MODULE_NAME,
|
||||
|
|
@ -354,7 +367,7 @@ abstract class ModuleAbstract
|
|||
$this->app->eventManager->trigger('PRE:Module:' . static::MODULE_NAME . '-' . $trigger . '-relation', '', $rel1);
|
||||
$mapper::createRelation($field, $rel1, $rel2);
|
||||
$this->app->eventManager->trigger('POST:Module:' . static::MODULE_NAME . '-' . $trigger . '-relation', '', [
|
||||
$request->getHEader()->getAccount(),
|
||||
$request->getHeader()->getAccount(),
|
||||
$rel1, $rel2,
|
||||
0, 0,
|
||||
static::MODULE_NAME,
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ class SmartDateTime extends \DateTime
|
|||
*/
|
||||
public function getStartOfWeek() : self
|
||||
{
|
||||
$w = \strtotime('-' . \date('w', $this->getTimestamp()) .' days', $this->getTimestamp());
|
||||
$w = (int) \strtotime('-' . \date('w', $this->getTimestamp()) .' days', $this->getTimestamp());
|
||||
|
||||
return new self(\date('Y-m-d', $w));
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ class SmartDateTime extends \DateTime
|
|||
*/
|
||||
public function getEndOfWeek() : self
|
||||
{
|
||||
$w = \strtotime('+' . (6 - \date('w', $this->getTimestamp())) .' days', $this->getTimestamp());
|
||||
$w = (int) \strtotime('+' . (6 - (int) \date('w', $this->getTimestamp())) .' days', $this->getTimestamp());
|
||||
|
||||
return new self(\date('Y-m-d', $w));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,16 @@ class ModuleAbstractTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('1.2.3', $this->module::MODULE_VERSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The name of the module can be returned
|
||||
* @covers phpOMS\Module\ModuleAbstract<extended>
|
||||
* @group framework
|
||||
*/
|
||||
public function testName() : void
|
||||
{
|
||||
self::assertEquals('Test', $this->module->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The dependencies of the module can be returned
|
||||
* @covers phpOMS\Module\ModuleAbstract<extended>
|
||||
|
|
@ -71,6 +81,27 @@ class ModuleAbstractTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals([1, 2], $this->module->getDependencies());
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The providings of the module can be returned
|
||||
* @covers phpOMS\Module\ModuleAbstract<extended>
|
||||
* @group framework
|
||||
*/
|
||||
public function testProviding() : void
|
||||
{
|
||||
self::assertEquals([1, 2], $this->module->getProviding());
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A module can receive information and functionality from another module
|
||||
* @covers phpOMS\Module\ModuleAbstract<extended>
|
||||
* @group framework
|
||||
*/
|
||||
public function testReceiving() : void
|
||||
{
|
||||
$this->module->addReceiving('Test2');
|
||||
self::assertTrue(\in_array('Test2', $this->module->getReceiving()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A invalid language or theme returns in an empty localization/language dataset
|
||||
* @covers phpOMS\Module\ModuleAbstract<extended>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user