cs and phpstan fixes

This commit is contained in:
Dennis Eichhorn 2020-10-24 17:52:23 +02:00
parent ce16c22f74
commit aa60478886
10 changed files with 35 additions and 24 deletions

View File

@ -35,11 +35,12 @@ final class Installer extends InstallerAbstract
/**
* {@inheritdoc}
*/
/*
public static function install(DatabasePool $dbPool, ModuleInfo $info, SettingsInterface $cfgHandler) : void
{
parent::install($dbPool, $info, $cfgHandler);
/*
$interfaces = Directory::list(__DIR__ . '/../Interfaces', '.*interface\.json', true);
foreach ($interfaces as $interface) {
@ -47,6 +48,7 @@ final class Installer extends InstallerAbstract
$exchange->load();
InterfaceManagerMapper::create($exchange);
}*/
}
}
*/
}

View File

@ -62,6 +62,7 @@ use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Message\RequestAbstract;
use phpOMS\System\File\Local\Directory;
use phpOMS\Utils\IO\Zip\Zip;
use Modules\ItemManagement\Models\ItemAttributeValue;
/**
* GSD import class
@ -79,7 +80,7 @@ final class Importer extends ImporterAbstract
* @var ConnectionAbstract
* @since 1.0.0
*/
private ?ConnectionAbstract $remote = null;
private ConnectionAbstract $remote;
/**
* Account
@ -412,9 +413,9 @@ final class Importer extends ImporterAbstract
/**
* Import articles
*
* @param \DateTime $start Start time (inclusive)
* @param \DateTime $end End time (inclusive)
* @param array $images Article images
* @param \DateTime $start Start time (inclusive)
* @param \DateTime $end End time (inclusive)
* @param array $files Article images
*
* @return void
*
@ -456,6 +457,8 @@ final class Importer extends ImporterAbstract
$images = \array_merge($jpg, $png);
$images = \array_diff($images, $imagesOld);
/** @var string[] $images */
/** @var string $image */
foreach ($images as $image) {
$number = (int) \explode('.', $image)[0];
@ -465,7 +468,7 @@ final class Importer extends ImporterAbstract
$media[$number]->setPath('/Modules/Media/Files/Modules/ItemManagement/Articles/Images/' . $image);
$media[$number]->setVirtualPath('/Modules/ItemManagement/Articles/Images');
$media[$number]->setExtension(\explode('.', $image)[1]);
$media[$number]->setSize(\filesize($imagePath . '/' . $image));
$media[$number]->setSize((int) \filesize($imagePath . '/' . $image));
$media[$number]->setCreatedBy(new NullAccount($this->account));
MediaMapper::create($media[$number]);
@ -613,7 +616,7 @@ final class Importer extends ImporterAbstract
/**
* Create and get item attribute values
*
* @param ItemAttributeType[] $itemAttributeType Attribute types
* @param ItemAttributeType[] $itemAttrType Attribute types
*
* @return ItemAttributeValue[]
*

View File

@ -81,7 +81,7 @@ class GSDCostCenter implements \JsonSerializable
*/
public function getCreatedAt() : \DateTimeImmutable
{
return $this->createdAt ?? new \DateTime();
return $this->createdAt ?? new \DateTimeImmutable();
}
/**

View File

@ -81,7 +81,7 @@ class GSDCostObject implements \JsonSerializable
*/
public function getCreatedAt() : \DateTimeImmutable
{
return $this->createdAt ?? new \DateTime();
return $this->createdAt ?? new \DateTimeImmutable();
}
/**

View File

@ -24,12 +24,6 @@ namespace Modules\Exchange\Interfaces\GSD\Model;
*/
class GSDCustomer
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
public int $id = 0;
public int $createdBy = 0;

View File

@ -65,6 +65,12 @@ final class GSDCustomerMapper extends DataMapperAbstract
'_Partnernummer6' => ['name' => '_Partnernummer6', 'type' => 'string', 'internal' => 'partner/6'],
];
/**
* Has one relation.
*
* @var array<string, array{mapper:string, external:string, by?:string, column?:string, conditional?:bool}>
* @since 1.0.0
*/
protected static array $ownsOne = [
'addr' => [
'mapper' => GSDAddressMapper::class,

View File

@ -26,7 +26,7 @@ class GSDSupplier
{
public int $id = 0;
public $createdBy = 0;
public int $createdBy = 0;
public \DateTimeImmutable $createdAt;

View File

@ -45,6 +45,12 @@ final class GSDSupplierMapper extends DataMapperAbstract
'AdressId' => ['name' => 'AdressId', 'type' => 'int', 'internal' => 'addr'],
];
/**
* Has one relation.
*
* @var array<string, array{mapper:string, external:string, by?:string, column?:string, conditional?:bool}>
* @since 1.0.0
*/
protected static array $ownsOne = [
'addr' => [
'mapper' => GSDAddressMapper::class,

View File

@ -61,7 +61,7 @@ class ExchangeLog implements \JsonSerializable, ArrayableInterface
/**
* Date type.
*
* @var int
* @var \DateTimeImmutable
* @since 1.0.0
*/
private \DateTimeImmutable $createdAt;
@ -167,7 +167,7 @@ class ExchangeLog implements \JsonSerializable, ArrayableInterface
/**
* Get created at.
*
* @return DateTimeImmutable
* @return \DateTimeImmutable
*
* @since 1.0.0
*/

View File

@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Modules\Exchange\Models;
use phpOMS\DataStorage\Database\Connection\ConnectionInterface;
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
use phpOMS\Message\RequestAbstract;
/**
@ -30,19 +30,19 @@ abstract class ImporterAbstract
/**
* Database connection.
*
* @var ConnectionInterface
* @var ConnectionAbstract
* @since 1.0.0
*/
protected $local = null;
protected ConnectionAbstract $local;
/**
* Constructor
*
* @param ConnectionInterface $local Database connection
* @param ConnectionAbstract $local Database connection
*
* @since 1.0.0
*/
public function __construct(ConnectionInterface $local)
public function __construct(ConnectionAbstract $local)
{
$this->local = $local;
}