mirror of
https://github.com/Karaka-Management/oms-Billing.git
synced 2026-02-02 09:48:41 +00:00
fix phpstan and phpcs
This commit is contained in:
parent
fee144f10d
commit
d91cfc9dbe
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
|
@ -26,7 +26,7 @@ jobs:
|
|||
- name: Setup Composer
|
||||
run: composer install
|
||||
- name: Autoformat
|
||||
run: 'vendor/bin/php-cs-fixer fix ./ --rules=''{"array_syntax": {"syntax": "short"}, "blank_line_after_namespace": true, "binary_operator_spaces": {"operators": {"=": "align", ".=": "align", "+=": "align", "-=": "align", "*=": "align", "/=": "align", "|=": "align", "&=": "align", "=>": "align", "??=": "align"}}, "cast_spaces": {"space": "single"}, "class_attributes_separation": { "elements": ["const", "method", "property"] }, "combine_consecutive_issets": true, "compact_nullable_typehint": true, "declare_strict_types": true, "declare_equal_normalize": {"space": "none"}, "elseif": true, "encoding": true, "explicit_indirect_variable": true, "explicit_string_variable": true, "function_to_constant": true, "implode_call": true, "increment_style": {"style": "pre"}, "is_null": {"use_yoda_style": false}, "line_ending": true, "logical_operators": true, "lowercase_cast": true, "lowercase_constants": true, "lowercase_keywords": true, "modernize_types_casting": true, "native_constant_invocation": true, "native_function_casing": true, "native_function_invocation": true, "new_with_braces": true, "no_extra_blank_lines": ["break", "case", "continue", "curly_brace_block", "extra", "return", "switch", "throw", "use"], "no_spaces_after_function_name": true, "no_alias_functions": true, "no_closing_tag": true, "no_empty_comment": true, "no_empty_phpdoc": true, "no_empty_statement": true, "no_homoglyph_names": true, "no_mixed_echo_print": {"use": "echo"}, "no_php4_constructor": true, "no_singleline_whitespace_before_semicolons": true, "no_spaces_inside_parenthesis": true, "no_trailing_whitespace": true, "no_unneeded_final_method": true, "no_unused_imports": true, "no_useless_return": true, "no_whitespace_before_comma_in_array": true, "no_whitespace_in_blank_line": true, "non_printable_character": true, "normalize_index_brace": true, "ordered_imports": {"sort_algorithm": "alpha"}, "ordered_interfaces": {"order": "alpha"}, "php_unit_construct": true, "php_unit_internal_class": true, "php_unit_ordered_covers": true, "php_unit_set_up_tear_down_visibility": true, "phpdoc_indent": true, "phpdoc_align": {"align": "vertical"}, "phpdoc_annotation_without_dot": true, "phpdoc_scalar": true, "phpdoc_return_self_reference": {"this": "self"}, "phpdoc_trim": true, "phpdoc_trim_consecutive_blank_line_separation": true, "random_api_migration": true, "self_accessor": true, "return_type_declaration": {"space_before": "one"}, "semicolon_after_instruction": true, "set_type_to_cast": true, "short_scalar_cast": true, "single_blank_line_at_eof": true, "single_line_after_imports": true, "standardize_increment": true, "trailing_comma_in_multiline_array": true, "trim_array_spaces": true, "visibility_required": true, "void_return": true}'' --allow-risky=yes'
|
||||
run: 'vendor/bin/php-cs-fixer fix ./ --rules=''{"array_syntax": {"syntax": "short"}, "blank_line_after_namespace": true, "binary_operator_spaces": {"operators": {"=": "align", ".=": "align", "+=": "align", "-=": "align", "*=": "align", "/=": "align", "|=": "align", "&=": "align", "=>": "align", "??=": "align"}}, "cast_spaces": {"space": "single"}, "class_attributes_separation": { "elements": {"const": "one", "method": "one", "property": "one"} }, "combine_consecutive_issets": true, "compact_nullable_typehint": true, "declare_strict_types": true, "declare_equal_normalize": {"space": "none"}, "elseif": true, "encoding": true, "explicit_indirect_variable": true, "explicit_string_variable": true, "function_to_constant": true, "implode_call": true, "increment_style": {"style": "pre"}, "is_null": true, "yoda_style": {"equal": false, "identical": false, "less_and_greater": false}, "line_ending": true, "logical_operators": true, "lowercase_cast": true, "constant_case": {"case": "lower"}, "lowercase_keywords": true, "modernize_types_casting": true, "native_constant_invocation": true, "native_function_casing": true, "native_function_invocation": true, "new_with_braces": true, "no_extra_blank_lines": {"tokens": ["break", "case", "continue", "curly_brace_block", "extra", "return", "switch", "throw", "use"]}, "no_spaces_after_function_name": true, "no_alias_functions": true, "no_closing_tag": true, "no_empty_comment": true, "no_empty_phpdoc": true, "no_empty_statement": true, "no_homoglyph_names": true, "no_mixed_echo_print": {"use": "echo"}, "no_php4_constructor": true, "no_singleline_whitespace_before_semicolons": true, "no_spaces_inside_parenthesis": true, "no_trailing_whitespace": true, "no_unneeded_final_method": true, "no_unused_imports": true, "no_useless_return": true, "no_whitespace_before_comma_in_array": true, "no_whitespace_in_blank_line": true, "non_printable_character": true, "normalize_index_brace": true, "ordered_imports": {"sort_algorithm": "alpha"}, "ordered_interfaces": {"order": "alpha"}, "php_unit_construct": true, "php_unit_internal_class": true, "php_unit_set_up_tear_down_visibility": true, "phpdoc_indent": true, "phpdoc_align": {"align": "vertical"}, "phpdoc_annotation_without_dot": true, "phpdoc_scalar": true, "phpdoc_return_self_reference": {"replacements": {"this": "self"}}, "phpdoc_trim": true, "phpdoc_trim_consecutive_blank_line_separation": true, "random_api_migration": true, "self_accessor": true, "return_type_declaration": {"space_before": "one"}, "semicolon_after_instruction": true, "set_type_to_cast": true, "short_scalar_cast": true, "single_blank_line_at_eof": true, "single_line_after_imports": true, "standardize_increment": true, "trailing_comma_in_multiline": true, "trim_array_spaces": true, "visibility_required": true, "void_return": true}'' --allow-risky=yes'
|
||||
- name: Check for modified files
|
||||
id: git-check
|
||||
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)
|
||||
|
|
|
|||
|
|
@ -55,9 +55,7 @@ class Bill implements \JsonSerializable
|
|||
* @var int|BillType
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int |
|
||||
|
||||
BillType $type = 0;
|
||||
public int | BillType $type = 0;
|
||||
|
||||
/**
|
||||
* Bill status.
|
||||
|
|
|
|||
|
|
@ -91,9 +91,7 @@ class BillElement implements \JsonSerializable
|
|||
*/
|
||||
public int $promotion = 0;
|
||||
|
||||
public int |
|
||||
|
||||
Bill $bill = 0;
|
||||
public int | Bill $bill = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ class BillType
|
|||
*
|
||||
* @var string|BillTypeL11n
|
||||
*/
|
||||
protected string |
|
||||
|
||||
BillTypeL11n $l11n;
|
||||
protected string | BillTypeL11n $l11n;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
|||
|
|
@ -41,9 +41,7 @@ class BillTypeL11n implements \JsonSerializable, ArrayableInterface
|
|||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int |
|
||||
|
||||
BillType $type = 0;
|
||||
protected int | BillType $type = 0;
|
||||
|
||||
/**
|
||||
* Language.
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
*/
|
||||
protected static string $model = Bill::class;
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getPurchaseBeforePivot(
|
||||
mixed $pivot,
|
||||
string $column = null,
|
||||
|
|
@ -53,6 +56,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return self::getBeforePivot($pivot, $column, $limit, $relations, $depth, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getPurchaseAfterPivot(
|
||||
mixed $pivot,
|
||||
string $column = null,
|
||||
|
|
@ -68,6 +74,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return self::getAfterPivot($pivot, $column, $limit, $relations, $depth, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getPurchaseByItemId(int $id, \DateTime $start, \DateTime $end) : Money
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -84,6 +93,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return new Money((int) $result[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getPurchaseBySupplierId(int $id, \DateTime $start, \DateTime $end) : Money
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -98,6 +110,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return new Money((int) $result[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getAvgPurchasePriceByItemId(int $id, \DateTime $start, \DateTime $end) : Money
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -114,6 +129,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return new Money($result === false || $result[1] == 0 ? 0 : (int) (((int) $result[0]) / ((int) $result[1])));
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getLastOrderDateByItemId(int $id) : ?\DateTimeImmutable
|
||||
{
|
||||
// @todo: only delivers/invoice/production (no offers ...)
|
||||
|
|
@ -131,6 +149,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return $result === false ? null : new \DateTimeImmutable($result[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getLastOrderDateBySupplierId(int $id) : ?\DateTimeImmutable
|
||||
{
|
||||
// @todo: only delivers/invoice/production (no offers ...)
|
||||
|
|
@ -146,16 +167,25 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return $result === false ? null : new \DateTimeImmutable($result[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemRetentionRate(int $id, \DateTime $start, \DateTime $end) : float
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemLivetimeValue(int $id, \DateTime $start, \DateTime $end) : Money
|
||||
{
|
||||
return new Money();
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getNewestItemInvoices(int $id, int $limit = 10) : array
|
||||
{
|
||||
$depth = 3;
|
||||
|
|
@ -177,6 +207,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return self::getAllByQuery($query, RelationType::ALL, $depth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getNewestSupplierInvoices(int $id, int $limit = 10) : array
|
||||
{
|
||||
$depth = 3;
|
||||
|
|
@ -196,6 +229,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return self::getAllByQuery($query, RelationType::ALL, $depth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemTopSuppliers(int $id, \DateTime $start, \DateTime $end, int $limit = 10) : array
|
||||
{
|
||||
$depth = 3;
|
||||
|
|
@ -219,6 +255,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return [$suppliers, $data];
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemRegionPurchase(int $id, \DateTime $start, \DateTime $end) : array
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -239,6 +278,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemCountryPurchase(int $id, \DateTime $start, \DateTime $end, int $limit = 10) : array
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -261,6 +303,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemMonthlyPurchaseCosts(int $id, \DateTime $start, \DateTime $end) : array
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -282,6 +327,9 @@ final class PurchaseBillMapper extends BillMapper
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getSupplierMonthlyPurchaseCosts(int $id, \DateTime $start, \DateTime $end) : array
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ final class SalesBillMapper extends BillMapper
|
|||
*/
|
||||
protected static string $model = Bill::class;
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getSalesBeforePivot(
|
||||
mixed $pivot,
|
||||
string $column = null,
|
||||
|
|
@ -53,6 +56,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return self::getBeforePivot($pivot, $column, $limit, $relations, $depth, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getSalesAfterPivot(
|
||||
mixed $pivot,
|
||||
string $column = null,
|
||||
|
|
@ -68,6 +74,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return self::getAfterPivot($pivot, $column, $limit, $relations, $depth, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getSalesByItemId(int $id, \DateTime $start, \DateTime $end) : Money
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -84,6 +93,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return new Money((int) $result[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getSalesByClientId(int $id, \DateTime $start, \DateTime $end) : Money
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -98,6 +110,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return new Money((int) $result[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getAvgSalesPriceByItemId(int $id, \DateTime $start, \DateTime $end) : Money
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -114,6 +129,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return new Money($result === false || $result[1] == 0 ? 0 : (int) (((int) $result[0]) / ((int) $result[1])));
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getLastOrderDateByItemId(int $id) : ?\DateTimeImmutable
|
||||
{
|
||||
// @todo: only delivers/invoice/production (no offers ...)
|
||||
|
|
@ -131,6 +149,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return $result === false ? null : new \DateTimeImmutable($result[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getLastOrderDateByClientId(int $id) : ?\DateTimeImmutable
|
||||
{
|
||||
// @todo: only delivers/invoice/production (no offers ...)
|
||||
|
|
@ -146,16 +167,25 @@ final class SalesBillMapper extends BillMapper
|
|||
return $result === false ? null : new \DateTimeImmutable($result[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemRetentionRate(int $id, \DateTime $start, \DateTime $end) : float
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemLivetimeValue(int $id, \DateTime $start, \DateTime $end) : Money
|
||||
{
|
||||
return new Money();
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getNewestItemInvoices(int $id, int $limit = 10) : array
|
||||
{
|
||||
$depth = 3;
|
||||
|
|
@ -177,6 +207,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return self::getAllByQuery($query, RelationType::ALL, $depth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getNewestClientInvoices(int $id, int $limit = 10) : array
|
||||
{
|
||||
$depth = 3;
|
||||
|
|
@ -196,6 +229,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return self::getAllByQuery($query, RelationType::ALL, $depth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemTopCustomers(int $id, \DateTime $start, \DateTime $end, int $limit = 10) : array
|
||||
{
|
||||
$depth = 3;
|
||||
|
|
@ -219,6 +255,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return [$clients, $data];
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemBills(int $id, \DateTime $start, \DateTime $end) : array
|
||||
{
|
||||
$depth = 3;
|
||||
|
|
@ -240,6 +279,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return self::getAllByQuery($query, RelationType::ALL, $depth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getClientItem(int $client, \DateTime $start, \DateTime $end) : array
|
||||
{
|
||||
$depth = 3;
|
||||
|
|
@ -261,6 +303,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return BillElementMapper::getAllByQuery($query, RelationType::ALL, $depth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemRegionSales(int $id, \DateTime $start, \DateTime $end) : array
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -281,6 +326,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemCountrySales(int $id, \DateTime $start, \DateTime $end, int $limit = 10) : array
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -303,6 +351,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getItemMonthlySalesCosts(int $id, \DateTime $start, \DateTime $end) : array
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
@ -324,6 +375,9 @@ final class SalesBillMapper extends BillMapper
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getClientMonthlySalesCosts(int $id, \DateTime $start, \DateTime $end) : array
|
||||
{
|
||||
$query = new Builder(self::$db);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ final class StockBillMapper extends BillMapper
|
|||
*/
|
||||
protected static string $model = Bill::class;
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getStockBeforePivot(
|
||||
mixed $pivot,
|
||||
string $column = null,
|
||||
|
|
@ -50,6 +53,9 @@ final class StockBillMapper extends BillMapper
|
|||
return self::getBeforePivot($pivot, $column, $limit, $relations, $depth, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placeholder
|
||||
*/
|
||||
public static function getStockAfterPivot(
|
||||
mixed $pivot,
|
||||
string $column = null,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
],
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": ">=9.4",
|
||||
"friendsofphp/php-cs-fixer": ">=3.0",
|
||||
"friendsofphp/php-cs-fixer": ">=3.2",
|
||||
"squizlabs/php_codesniffer": ">=3.6",
|
||||
"phpmd/phpmd": ">=2.9",
|
||||
"phpstan/phpstan": ">=0.12.58",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user