phpcs autofixes

This commit is contained in:
Dennis Eichhorn 2023-05-28 12:19:03 +00:00
parent cb76b873e1
commit 94b2a4d0a2
17 changed files with 335 additions and 343 deletions

View File

@ -26,7 +26,7 @@ jobs:
- name: Setup Composer - name: Setup Composer
run: composer install run: composer install
- name: Autoformat - name: Autoformat
run: 'vendor/bin/php-cs-fixer fix ./ --rules=''{"array_syntax": {"syntax": "short"}, "blank_line_after_namespace": true, "global_namespace_import": {"import_classes": false, "import_constants": false, "import_functions": false}, "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": {"include": ["@all"]}, "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' run: 'vendor/bin/php-cs-fixer fix ./ --rules=''{"array_syntax": {"syntax": "short"}, "blank_line_after_namespace": true, "global_namespace_import": {"import_classes": false, "import_constants": false, "import_functions": false}, "binary_operator_spaces": {"operators": {"=": "align", ".=": "align", "+=": "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": {"include": ["@all"]}, "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 - name: Check for modified files
id: git-check id: git-check
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)

View File

@ -14,8 +14,6 @@ declare(strict_types=1);
namespace Modules\Admin\Admin\Install; namespace Modules\Admin\Admin\Install;
use Model\Setting;
use Model\SettingMapper;
use Modules\Admin\Models\SettingsEnum; use Modules\Admin\Models\SettingsEnum;
use phpOMS\Application\ApplicationAbstract; use phpOMS\Application\ApplicationAbstract;
@ -51,30 +49,30 @@ class Media
'name' => SettingsEnum::DEFAULT_LIST_EXPORTS, 'name' => SettingsEnum::DEFAULT_LIST_EXPORTS,
'content' => (string) $media['collection'][4]['id'], 'content' => (string) $media['collection'][4]['id'],
'pattern' => '\\d+', 'pattern' => '\\d+',
'module' => 'Admin' 'module' => 'Admin',
], ],
[ [
'type' => 'setting', 'type' => 'setting',
'name' => SettingsEnum::DEFAULT_LETTERS, 'name' => SettingsEnum::DEFAULT_LETTERS,
'content' => (string) $media['collection'][5]['id'], 'content' => (string) $media['collection'][5]['id'],
'pattern' => '\\d+', 'pattern' => '\\d+',
'module' => 'Admin' 'module' => 'Admin',
], ],
[ [
'type' => 'setting', 'type' => 'setting',
'name' => SettingsEnum::DEFAULT_ASSETS, 'name' => SettingsEnum::DEFAULT_ASSETS,
'content' => (string) $media['upload'][0]['id'], 'content' => (string) $media['upload'][0]['id'],
'pattern' => '\\d+', 'pattern' => '\\d+',
'module' => 'Admin' 'module' => 'Admin',
], ],
[ [
'type' => 'setting', 'type' => 'setting',
'name' => SettingsEnum::DEFAULT_TEMPLATES, 'name' => SettingsEnum::DEFAULT_TEMPLATES,
'content' => (string) $media['upload'][1]['id'], 'content' => (string) $media['upload'][1]['id'],
'pattern' => '\\d+', 'pattern' => '\\d+',
'module' => 'Admin' 'module' => 'Admin',
] ],
] ],
] ]
); );
} }

View File

@ -15,7 +15,6 @@ declare(strict_types=1);
use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter; use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter;
use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing; use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing;
use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup; use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup;
use phpOMS\Autoloader;
class DefaultExcel extends \PhpOffice\PhpSpreadsheet\Spreadsheet class DefaultExcel extends \PhpOffice\PhpSpreadsheet\Spreadsheet
{ {
@ -48,5 +47,4 @@ class DefaultExcel extends \PhpOffice\PhpSpreadsheet\Spreadsheet
->addImage($drawing, HeaderFooter::IMAGE_HEADER_LEFT); ->addImage($drawing, HeaderFooter::IMAGE_HEADER_LEFT);
*/ */
} }
} }

View File

@ -66,7 +66,7 @@ class DefaultPdf extends TCPDF
'TaxNumber' => 'Steuernummer', 'TaxNumber' => 'Steuernummer',
'Swift' => 'BIC', 'Swift' => 'BIC',
'BankAccount' => 'IBAN', 'BankAccount' => 'IBAN',
] ],
]; ];
public array $attributes = [ public array $attributes = [
@ -154,7 +154,7 @@ class DefaultPdf extends TCPDF
$x = 0; $x = 0;
$dx = 0; $dx = 0;
if (!$this->header_xobj_autoreset AND $this->booklet AND (($this->page % 2) == 0)) { if (!$this->header_xobj_autoreset && $this->booklet && (($this->page % 2) == 0)) {
// adjust margins for booklet mode // adjust margins for booklet mode
$dx = ($this->original_lMargin - $this->original_rMargin); $dx = ($this->original_lMargin - $this->original_rMargin);
} }

View File

@ -56,7 +56,7 @@ class DefaultWord extends \PhpOffice\PhpWord\PhpWord
'TaxNumber' => 'Steuernummer', 'TaxNumber' => 'Steuernummer',
'Swift' => 'BIC', 'Swift' => 'BIC',
'BankAccount' => 'IBAN', 'BankAccount' => 'IBAN',
] ],
]; ];
public array $attributes = [ public array $attributes = [

View File

@ -14,8 +14,6 @@ declare(strict_types=1);
namespace Modules\Admin\Admin\Install; namespace Modules\Admin\Admin\Install;
use Model\Setting;
use Model\SettingMapper;
use Modules\Admin\Models\SettingsEnum; use Modules\Admin\Models\SettingsEnum;
use phpOMS\Application\ApplicationAbstract; use phpOMS\Application\ApplicationAbstract;
use phpOMS\Message\Http\HttpRequest; use phpOMS\Message\Http\HttpRequest;

View File

@ -582,7 +582,7 @@ final class ApiController extends Controller
'group' => $new->group, 'group' => $new->group,
'account' => $new->account, 'account' => $new->account,
'isEncrypted' => $new->isEncrypted, 'isEncrypted' => $new->isEncrypted,
] ],
], false); ], false);
$this->updateModel($request->header->account, $old, $new, SettingMapper::class, 'settings', $request->getOrigin()); $this->updateModel($request->header->account, $old, $new, SettingMapper::class, 'settings', $request->getOrigin());
@ -1758,7 +1758,7 @@ final class ApiController extends Controller
$dataChange->createdBy = $account->id; $dataChange->createdBy = $account->id;
$dataChange->data = \json_encode([ $dataChange->data = \json_encode([
'status' => AccountStatus::ACTIVE 'status' => AccountStatus::ACTIVE,
]); ]);
$tries = 0; $tries = 0;
@ -1827,7 +1827,7 @@ final class ApiController extends Controller
UriFactory::hasQuery('/' . \strtolower($app->name)) UriFactory::hasQuery('/' . \strtolower($app->name))
? UriFactory::build('{/' . \strtolower($app->name) . '}/' . \strtolower($app->name) . '/signup/confirmation?hash=' . $dataChange->getHash()) ? UriFactory::build('{/' . \strtolower($app->name) . '}/' . \strtolower($app->name) . '/signup/confirmation?hash=' . $dataChange->getHash())
: UriFactory::build('{/tld}/{/lang}/' . \strtolower($app->name) . '/signup/confirmation?hash=' . $dataChange->getHash()), : UriFactory::build('{/tld}/{/lang}/' . \strtolower($app->name) . '/signup/confirmation?hash=' . $dataChange->getHash()),
$account->login $account->login,
], ],
$mailL11n->body $mailL11n->body
); );
@ -1841,7 +1841,7 @@ final class ApiController extends Controller
UriFactory::hasQuery('/' . \strtolower($app->name)) UriFactory::hasQuery('/' . \strtolower($app->name))
? UriFactory::build('{/' . \strtolower($app->name) . '}/' . \strtolower($app->name) . '/signup/confirmation?hash=' . $dataChange->getHash()) ? UriFactory::build('{/' . \strtolower($app->name) . '}/' . \strtolower($app->name) . '/signup/confirmation?hash=' . $dataChange->getHash())
: UriFactory::build('{/tld}/{/lang}/' . \strtolower($app->name) . '/signup/confirmation?hash=' . $dataChange->getHash()), : UriFactory::build('{/tld}/{/lang}/' . \strtolower($app->name) . '/signup/confirmation?hash=' . $dataChange->getHash()),
$account->login $account->login,
], ],
$mailL11n->bodyAlt $mailL11n->bodyAlt
); );

View File

@ -14,10 +14,7 @@ declare(strict_types=1);
namespace Modules\Admin\Models; namespace Modules\Admin\Models;
use phpOMS\Account\AccountStatus;
use phpOMS\Auth\LoginReturnType;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\DataStorage\Database\Query\Builder;
/** /**
* Account mapper class. * Account mapper class.

View File

@ -25,7 +25,8 @@ use phpOMS\Stdlib\Base\Enum;
* @since 1.0.0 * @since 1.0.0
*/ */
abstract class SettingsEnum extends Enum abstract class SettingsEnum extends Enum
{ /* Logging settings */ {
/* Logging settings */
public const PASSWORD_PATTERN = '1000000001'; public const PASSWORD_PATTERN = '1000000001';
public const LOGIN_TIMEOUT = '1000000002'; public const LOGIN_TIMEOUT = '1000000002';