mirror of
https://github.com/Karaka-Management/oms-Billing.git
synced 2026-02-05 19:18:41 +00:00
phpstan, phpcs, phpunit fixes
This commit is contained in:
parent
5584be47cf
commit
58a8ffad90
|
|
@ -41,7 +41,7 @@
|
|||
"billing_type_is_template": {
|
||||
"description": "What kind of bill is it?",
|
||||
"name": "billing_type_is_template",
|
||||
"type": "TINYINT",
|
||||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
}
|
||||
}
|
||||
|
|
@ -659,7 +659,7 @@
|
|||
},
|
||||
"billing_bill_subscription_account": {
|
||||
"name": "billing_bill_subscription_account",
|
||||
"type": "TINYINT(1)",
|
||||
"type": "INT",
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "account",
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ use Modules\Media\Models\UploadStatus;
|
|||
use Modules\SupplierManagement\Models\NullSupplier;
|
||||
use Modules\SupplierManagement\Models\SupplierMapper;
|
||||
use phpOMS\Autoloader;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Localization\Money;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
|
|
|
|||
|
|
@ -622,13 +622,13 @@ class Bill implements \JsonSerializable
|
|||
/**
|
||||
* Add Bill element.
|
||||
*
|
||||
* @param mixed $element Bill element
|
||||
* @param BillElement $element Bill element
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function addElement($element) : void
|
||||
public function addElement(BillElement $element) : void
|
||||
{
|
||||
$this->elements[] = $element;
|
||||
}
|
||||
|
|
@ -713,13 +713,13 @@ class Bill implements \JsonSerializable
|
|||
/**
|
||||
* Get media file by type
|
||||
*
|
||||
* @param null|int $type Media type
|
||||
* @param int $type Media type
|
||||
*
|
||||
* @return Media
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getFileByType(int $type = null) : Media
|
||||
public function getFileByType(int $type) : Media
|
||||
{
|
||||
foreach ($this->media as $file) {
|
||||
if ($file->type->getId() === $type) {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ final class BillElementMapper extends DataMapperFactory
|
|||
/**
|
||||
* Belongs to.
|
||||
*
|
||||
* @var array<string, array{mapper:string, external:string, column?:string, by?:string}>
|
||||
* @var array<string, array{mapper:class-string, external:string, column?:string, by?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const BELONGS_TO = [
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class BillMapper extends DataMapperFactory
|
|||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const HAS_MANY = [
|
||||
|
|
@ -113,7 +113,7 @@ class BillMapper extends DataMapperFactory
|
|||
/**
|
||||
* Has one relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const OWNS_ONE = [
|
||||
|
|
@ -130,7 +130,7 @@ class BillMapper extends DataMapperFactory
|
|||
/**
|
||||
* Belongs to.
|
||||
*
|
||||
* @var array<string, array{mapper:string, external:string, column?:string, by?:string}>
|
||||
* @var array<string, array{mapper:class-string, external:string, column?:string, by?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const BELONGS_TO = [
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ class BillType implements \JsonSerializable
|
|||
*/
|
||||
protected string | BaseStringL11n $l11n;
|
||||
|
||||
public bool $isTemplate = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
|
@ -94,7 +96,8 @@ class BillType implements \JsonSerializable
|
|||
if ($l11n instanceof BaseStringL11n) {
|
||||
$this->l11n = $l11n;
|
||||
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->setLanguage($lang);
|
||||
} else {
|
||||
$this->l11n = new BaseStringL11n();
|
||||
$this->l11n->content = $l11n;
|
||||
|
|
@ -110,6 +113,10 @@ class BillType implements \JsonSerializable
|
|||
*/
|
||||
public function getL11n() : string
|
||||
{
|
||||
if (!isset($this->l11n)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ final class BillTypeL11nMapper extends DataMapperFactory
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var string
|
||||
* @var class-string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
|
|
|
|||
|
|
@ -40,12 +40,13 @@ final class BillTypeMapper extends DataMapperFactory
|
|||
'billing_type_template' => ['name' => 'billing_type_template', 'type' => 'int', 'internal' => 'template'],
|
||||
'billing_type_transfer_type' => ['name' => 'billing_type_transfer_type', 'type' => 'int', 'internal' => 'transferType'],
|
||||
'billing_type_transfer_stock' => ['name' => 'billing_type_transfer_stock', 'type' => 'bool', 'internal' => 'transferStock'],
|
||||
'billing_type_is_template' => ['name' => 'billing_type_is_template', 'type' => 'bool', 'internal' => 'isTemplate'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Belongs to.
|
||||
*
|
||||
* @var array<string, array{mapper:string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const OWNS_ONE = [
|
||||
|
|
@ -58,7 +59,7 @@ final class BillTypeMapper extends DataMapperFactory
|
|||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const HAS_MANY = [
|
||||
|
|
@ -74,7 +75,7 @@ final class BillTypeMapper extends DataMapperFactory
|
|||
/**
|
||||
* Belongs to.
|
||||
*
|
||||
* @var array<string, array{mapper:string, self:string}>
|
||||
* @var array<string, array{mapper:class-string, self:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
/*
|
||||
|
|
@ -89,7 +90,7 @@ final class BillTypeMapper extends DataMapperFactory
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var string
|
||||
* @var class-string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BillType::class;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ final class PurchaseBillMapper extends BillMapper
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var string
|
||||
* @var class-string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = Bill::class;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ final class SalesBillMapper extends BillMapper
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var string
|
||||
* @var class-string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = Bill::class;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ final class StockBillMapper extends BillMapper
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var string
|
||||
* @var class-string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = Bill::class;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user