mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
fix phpstan and phpcs
This commit is contained in:
parent
6338db6631
commit
ba7f68f69f
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)
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ final class Kmeans
|
|||
* Constructor
|
||||
*
|
||||
* @param PointInterface[] $points Points to cluster
|
||||
* @param int $clusters Amount of clusters
|
||||
* @param int<0, max> $clusters Amount of clusters
|
||||
* @param null|\Closure $metric metric to use for the distance between two points
|
||||
*
|
||||
* @since 1.0.0
|
||||
|
|
@ -114,7 +114,7 @@ final class Kmeans
|
|||
* Generate the clusters of the points
|
||||
*
|
||||
* @param PointInterface[] $points Points to cluster
|
||||
* @param int $clusters Amount of clusters
|
||||
* @param int<0, max> $clusters Amount of clusters
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -207,7 +207,7 @@ final class Kmeans
|
|||
* Initializae cluster centers
|
||||
*
|
||||
* @param PointInterface[] $points Points to use for the cluster center initialization
|
||||
* @param int $n Amount of clusters to use
|
||||
* @param int<0, max> $n Amount of clusters to use
|
||||
*
|
||||
* @return PointInterface[]
|
||||
*
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ final class Bounded
|
|||
public static function solve(array $items, BackpackInterface $backpack) : BackpackInterface
|
||||
{
|
||||
$n = \count($items);
|
||||
|
||||
// @var int<0, max> $maxCost
|
||||
$maxCost = (int) $backpack->getMaxCost();
|
||||
$mm = \array_fill(0, ($maxCost + 1), 0);
|
||||
$m = [];
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ class MazeGenerator
|
|||
/**
|
||||
* Generate a random maze
|
||||
*
|
||||
* @param int $width Width
|
||||
* @param int $height Height
|
||||
* @param int<0, max> $width Width
|
||||
* @param int<0, max> $height Height
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ final class BitonicSort implements SortInterface
|
|||
return $list;
|
||||
}
|
||||
|
||||
$first = self::sort(\array_slice($list, 0, $n / 2), SortOrder::ASC);
|
||||
$second = self::sort(\array_slice($list, $n / 2), SortOrder::DESC);
|
||||
$first = self::sort(\array_slice($list, 0, (int) ($n / 2)), SortOrder::ASC);
|
||||
$second = self::sort(\array_slice($list, (int) ($n / 2)), SortOrder::DESC);
|
||||
|
||||
return self::merge(\array_merge($first, $second), $order);
|
||||
}
|
||||
|
|
@ -78,8 +78,8 @@ final class BitonicSort implements SortInterface
|
|||
}
|
||||
}
|
||||
|
||||
$first = self::merge(\array_slice($list, 0, $n / 2), $order);
|
||||
$second = self::merge(\array_slice($list, $n / 2), $order);
|
||||
$first = self::merge(\array_slice($list, 0, (int) ($n / 2)), $order);
|
||||
$second = self::merge(\array_slice($list, (int) ($n / 2)), $order);
|
||||
|
||||
return \array_merge($first, $second);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ final class IdentityMatrix extends Matrix
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param int $n Matrix dimension
|
||||
* @param int<0, max> $n Matrix dimension
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var int
|
||||
* @var int<0, max>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $n = 0;
|
||||
|
|
@ -48,7 +48,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
/**
|
||||
* Rows.
|
||||
*
|
||||
* @var int
|
||||
* @var int<0, max>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $m = 0;
|
||||
|
|
@ -64,8 +64,8 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param int $m Rows
|
||||
* @param int $n Columns
|
||||
* @param int<0, max> $m Rows
|
||||
* @param int<0, max> $n Columns
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -442,7 +442,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
/**
|
||||
* Get matrix rows.
|
||||
*
|
||||
* @return int
|
||||
* @return int<0, max>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -454,7 +454,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
/**
|
||||
* Get matrix columns.
|
||||
*
|
||||
* @return int
|
||||
* @return int<0, max>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
|
@ -748,7 +748,7 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
*/
|
||||
public function offsetSet($offset, $value) : void
|
||||
{
|
||||
$row = (int) ($offset / $this->m);
|
||||
$row = (int) ((int) $offset / $this->m);
|
||||
$this->matrix[$row][$offset - $row * $this->n] = $value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class LZW implements CompressionInterface
|
|||
for ($i = 1; $i < $count; ++$i) {
|
||||
$k = (int) $compressed[$i];
|
||||
|
||||
if ($dictionary[$k]) {
|
||||
if (isset($dictionary[$k]) && !empty($dictionary[$k])) {
|
||||
$entry = $dictionary[$k];
|
||||
} elseif ($k === $dictSize) {
|
||||
$entry = $w . $w[0];
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
1031
composer.lock
generated
1031
composer.lock
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user