diff --git a/.php_cs.cache b/.php_cs.cache
index 76d211ab..56ca9418 100644
--- a/.php_cs.cache
+++ b/.php_cs.cache
@@ -1 +1 @@
-{"php":"7.3.6","version":"2.16.0:v2.16.0#ceaff36bee1ed3f1bbbedca36d2528c0826c336d","indent":" ","lineEnding":"\n","rules":{"array_syntax":{"syntax":"short"},"binary_operator_spaces":true,"blank_line_after_opening_tag":true,"blank_line_before_statement":{"statements":["return"]},"braces":{"allow_single_line_closure":true},"cast_spaces":true,"class_attributes_separation":{"elements":["method"]},"class_definition":{"single_line":true},"concat_space":true,"declare_equal_normalize":true,"function_typehint_space":true,"include":true,"increment_style":true,"lowercase_cast":true,"lowercase_static_reference":true,"magic_constant_casing":true,"magic_method_casing":true,"method_argument_space":true,"native_function_casing":true,"native_function_type_declaration_casing":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["curly_brace_block","extra","parenthesis_brace_block","square_brace_block","throw","use"]},"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"allow_mixed":true,"allow_unused_params":true},"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_unneeded_control_parentheses":true,"no_unneeded_curly_braces":true,"no_unneeded_final_method":true,"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"object_operator_without_whitespace":true,"ordered_imports":true,"php_unit_fqcn_annotation":true,"phpdoc_align":{"tags":["method","param","property","return","throws","type","var"]},"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":{"null_adjustment":"always_last","sort_algorithm":"none"},"phpdoc_var_without_name":true,"return_type_declaration":true,"semicolon_after_instruction":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_class_element_per_statement":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"single_trait_insert_per_statement":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"ternary_operator_spaces":true,"trailing_comma_in_multiline_array":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"yoda_style":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"dir_constant":true,"ereg_to_preg":true,"error_suppression":true,"fopen_flag_order":true,"function_to_constant":true,"implode_call":true,"is_null":true,"modernize_types_casting":true,"native_constant_invocation":{"fix_built_in":false,"include":["DIRECTORY_SEPARATOR","PHP_SAPI","PHP_VERSION_ID"],"scope":"namespaced"},"native_function_invocation":{"include":["@compiler_optimized"],"scope":"namespaced","strict":true},"no_alias_functions":true,"no_homoglyph_names":true,"non_printable_character":true,"php_unit_construct":true,"php_unit_mock_short_will_return":true,"psr4":true,"self_accessor":true,"set_type_to_cast":true,"php_unit_dedicate_assert_internal_type":{"target":"7.5"},"php_unit_namespaced":{"target":"6.0"},"php_unit_dedicate_assert":{"target":"5.6"},"php_unit_expectation":{"target":"5.6"},"php_unit_mock":{"target":"5.5"},"php_unit_no_expectation_annotation":{"target":"4.3"},"combine_nested_dirname":true},"hashes":{"src\\Command\\CleanAttachmentsCommand.php":2908442282,"src\\Command\\ConvertBBCodeCommand.php":2987395581,"src\\Command\\SetPasswordCommand.php":2214878570,"src\\Command\\UpdateExchangeRatesCommand.php":2478314487,"src\\Configuration\\PermissionsConfiguration.php":2292703041,"src\\Controller\\AdminPages\\AttachmentTypeController.php":2043735562,"src\\Controller\\AdminPages\\BaseAdminController.php":199943669,"src\\Controller\\AdminPages\\CategoryController.php":2332760319,"src\\Controller\\AdminPages\\CurrencyController.php":1707599961,"src\\Controller\\AdminPages\\DeviceController.php":1643684955,"src\\Controller\\AdminPages\\FootprintController.php":4274611247,"src\\Controller\\AdminPages\\ManufacturerController.php":398603842,"src\\Controller\\AdminPages\\MeasurementUnitController.php":3602410282,"src\\Controller\\AdminPages\\StorelocationController.php":2319716752,"src\\Controller\\AdminPages\\SupplierController.php":981802406,"src\\Controller\\AttachmentFileController.php":1843792477,"src\\Controller\\DebugController.php":1887303631,"src\\Controller\\GroupController.php":2553259838,"src\\Controller\\HomepageController.php":890878176,"src\\Controller\\PartController.php":422633708,"src\\Controller\\PartListsController.php":2203269023,"src\\Controller\\RedirectController.php":3017636547,"src\\Controller\\SecurityController.php":3402949811,"src\\Controller\\TreeController.php":1098072083,"src\\Controller\\TypeaheadController.php":701921162,"src\\Controller\\UserController.php":2302195322,"src\\DataFixtures\\AppFixtures.php":2963967304,"src\\DataFixtures\\DataStructureFixtures.php":431104433,"src\\DataFixtures\\GroupFixtures.php":3858137367,"src\\DataFixtures\\UserFixtures.php":3167825813,"src\\DataTables\\AttachmentDataTable.php":4057506203,"src\\DataTables\\Column\\EntityColumn.php":1510470116,"src\\DataTables\\Column\\LocaleDateTimeColumn.php":908976159,"src\\DataTables\\PartsDataTable.php":190824757,"src\\Entity\\Attachments\\Attachment.php":3179331481,"src\\Entity\\Attachments\\AttachmentContainingDBElement.php":1075739443,"src\\Entity\\Attachments\\AttachmentType.php":2791499020,"src\\Entity\\Attachments\\AttachmentTypeAttachment.php":2485692758,"src\\Entity\\Attachments\\CategoryAttachment.php":2403256637,"src\\Entity\\Attachments\\CurrencyAttachment.php":24135120,"src\\Entity\\Attachments\\DeviceAttachment.php":2324000529,"src\\Entity\\Attachments\\FootprintAttachment.php":2560722039,"src\\Entity\\Attachments\\GroupAttachment.php":3895624202,"src\\Entity\\Attachments\\ManufacturerAttachment.php":515231899,"src\\Entity\\Attachments\\MeasurementUnitAttachment.php":3485510744,"src\\Entity\\Attachments\\PartAttachment.php":4250738841,"src\\Entity\\Attachments\\StorelocationAttachment.php":3453695181,"src\\Entity\\Attachments\\SupplierAttachment.php":3954069882,"src\\Entity\\Attachments\\UserAttachment.php":4186678762,"src\\Entity\\Base\\Company.php":1915616836,"src\\Entity\\Base\\DBElement.php":1101919543,"src\\Entity\\Base\\MasterAttachmentTrait.php":837971824,"src\\Entity\\Base\\NamedDBElement.php":803194601,"src\\Entity\\Base\\PartsContainingDBElement.php":646909351,"src\\Entity\\Base\\StructuralDBElement.php":2044199864,"src\\Entity\\Base\\TimestampTrait.php":2708737647,"src\\Entity\\Devices\\Device.php":1508962504,"src\\Entity\\Devices\\DevicePart.php":35018670,"src\\Entity\\Parts\\Category.php":774843680,"src\\Entity\\Parts\\Footprint.php":3859634492,"src\\Entity\\Parts\\Manufacturer.php":3809823616,"src\\Entity\\Parts\\MeasurementUnit.php":2912156176,"src\\Entity\\Parts\\Part.php":4192739584,"src\\Entity\\Parts\\PartLot.php":2180429772,"src\\Entity\\Parts\\PartTraits\\AdvancedPropertyTrait.php":1202738823,"src\\Entity\\Parts\\PartTraits\\BasicPropertyTrait.php":4185734632,"src\\Entity\\Parts\\PartTraits\\InstockTrait.php":1873097051,"src\\Entity\\Parts\\PartTraits\\ManufacturerTrait.php":3468487154,"src\\Entity\\Parts\\PartTraits\\OrderTrait.php":3932234196,"src\\Entity\\Parts\\Storelocation.php":2765793307,"src\\Entity\\Parts\\Supplier.php":3420235130,"src\\Entity\\PriceInformations\\Currency.php":1085803866,"src\\Entity\\PriceInformations\\Orderdetail.php":2190484276,"src\\Entity\\PriceInformations\\Pricedetail.php":4018021368,"src\\Entity\\UserSystem\\Group.php":403305251,"src\\Entity\\UserSystem\\PermissionsEmbed.php":205366727,"src\\Entity\\UserSystem\\User.php":4200871585,"src\\EntityListeners\\AttachmentDeleteListener.php":3708835753,"src\\EntityListeners\\TreeCacheInvalidationListener.php":4271177067,"src\\EventSubscriber\\LoginSuccessListener.php":3290811941,"src\\EventSubscriber\\LogoutOnDisabledUserListener.php":1379035211,"src\\EventSubscriber\\SymfonyDebugToolbarSubscriber.php":3244347947,"src\\EventSubscriber\\TimezoneListener.php":1719734434,"src\\Exceptions\\AttachmentDownloadException.php":2916573626,"src\\Exceptions\\EntityNotSupportedException.php":2435284975,"src\\Form\\AdminPages\\AttachmentTypeAdminForm.php":2650814797,"src\\Form\\AdminPages\\BaseEntityAdminForm.php":707930465,"src\\Form\\AdminPages\\CategoryAdminForm.php":3496349857,"src\\Form\\AdminPages\\CompanyForm.php":1291902630,"src\\Form\\AdminPages\\CurrencyAdminForm.php":2310942389,"src\\Form\\AdminPages\\FootprintAdminForm.php":3045276981,"src\\Form\\AdminPages\\GroupAdminForm.php":3121051016,"src\\Form\\AdminPages\\ImportType.php":4176723793,"src\\Form\\AdminPages\\MassCreationForm.php":888518718,"src\\Form\\AdminPages\\MeasurementUnitAdminForm.php":3004432840,"src\\Form\\AdminPages\\StorelocationAdminForm.php":2323716743,"src\\Form\\AdminPages\\SupplierForm.php":4018499008,"src\\Form\\AttachmentFormType.php":3210088880,"src\\Form\\Part\\OrderdetailType.php":2662506322,"src\\Form\\Part\\PartBaseType.php":898045911,"src\\Form\\Part\\PartLotType.php":2338377803,"src\\Form\\Part\\PricedetailType.php":1490806012,"src\\Form\\Permissions\\PermissionGroupType.php":2524182940,"src\\Form\\Permissions\\PermissionsMapper.php":1163401752,"src\\Form\\Permissions\\PermissionsType.php":1106564554,"src\\Form\\Permissions\\PermissionType.php":331672534,"src\\Form\\Type\\CurrencyEntityType.php":3759799614,"src\\Form\\Type\\MasterPictureAttachmentType.php":2603681397,"src\\Form\\Type\\SIUnitType.php":2016913257,"src\\Form\\Type\\StructuralEntityType.php":589624973,"src\\Form\\Type\\TriStateCheckboxType.php":1561238730,"src\\Form\\UserAdminForm.php":1522499243,"src\\Form\\UserSettingsType.php":2161828990,"src\\Helpers\\BBCodeToMarkdownConverter.php":96305637,"src\\Helpers\\TreeViewNode.php":4023335168,"src\\Helpers\\TreeViewNodeState.php":1494408863,"src\\Helpers\\UTCDateTimeType.php":2732968354,"src\\Kernel.php":1116622545,"src\\Migrations\\Version1.php":4120408624,"src\\Migrations\\Version20190902140506.php":3292952863,"src\\Migrations\\Version20190913141126.php":2563793341,"src\\Migrations\\Version20190924113252.php":3219990553,"src\\Repository\\PartRepository.php":2577496518,"src\\Repository\\StructuralDBElementRepository.php":677611017,"src\\Repository\\UserRepository.php":3545774539,"src\\Security\\Annotations\\ColumnSecurity.php":566606204,"src\\Security\\EntityListeners\\ElementPermissionListener.php":2460254839,"src\\Security\\Interfaces\\HasPermissionsInterface.php":2020026839,"src\\Security\\UserChecker.php":3891573841,"src\\Security\\Voter\\AttachmentVoter.php":831559087,"src\\Security\\Voter\\ExtendedVoter.php":849288942,"src\\Security\\Voter\\GroupVoter.php":3159044518,"src\\Security\\Voter\\PartVoter.php":44030195,"src\\Security\\Voter\\PermissionVoter.php":3336939541,"src\\Security\\Voter\\StructureVoter.php":2372406494,"src\\Security\\Voter\\UserVoter.php":2043762541,"src\\Services\\AmountFormatter.php":1174463127,"src\\Services\\Attachments\\AttachmentManager.php":1767336959,"src\\Services\\Attachments\\AttachmentPathResolver.php":3903709913,"src\\Services\\Attachments\\AttachmentReverseSearch.php":4106615088,"src\\Services\\Attachments\\AttachmentSubmitHandler.php":214831333,"src\\Services\\Attachments\\AttachmentURLGenerator.php":4159809971,"src\\Services\\Attachments\\BuiltinAttachmentsFinder.php":4197852886,"src\\Services\\Attachments\\FileTypeFilterTools.php":2265205006,"src\\Services\\Attachments\\PartPreviewGenerator.php":3296326077,"src\\Services\\ElementTypeNameGenerator.php":1146150845,"src\\Services\\EntityExporter.php":1214704187,"src\\Services\\EntityImporter.php":852222861,"src\\Services\\EntityURLGenerator.php":2045229148,"src\\Services\\GitVersionInfo.php":2876352447,"src\\Services\\MarkdownParser.php":1800926498,"src\\Services\\MoneyFormatter.php":2556966976,"src\\Services\\PermissionResolver.php":2769642819,"src\\Services\\PricedetailHelper.php":698230535,"src\\Services\\SIFormatter.php":1138826431,"src\\Services\\StructuralElementRecursionHelper.php":350965913,"src\\Services\\TagFinder.php":4108516166,"src\\Services\\ToolsTreeBuilder.php":1079849839,"src\\Services\\TranslationExtractor\\PermissionExtractor.php":2379032323,"src\\Services\\TreeBuilder.php":773475422,"src\\Services\\UserCacheKeyGenerator.php":602924229,"src\\Twig\\AppExtension.php":1446709883,"src\\Validator\\Constraints\\AllowedFileExtension.php":2636718005,"src\\Validator\\Constraints\\AllowedFileExtensionValidator.php":2759618947,"src\\Validator\\Constraints\\NoLockout.php":3624981320,"src\\Validator\\Constraints\\NoLockoutValidator.php":3493345860,"src\\Validator\\Constraints\\NoneOfItsChildren.php":1276347049,"src\\Validator\\Constraints\\NoneOfItsChildrenValidator.php":2211921658,"src\\Validator\\Constraints\\Selectable.php":4202102224,"src\\Validator\\Constraints\\SelectableValidator.php":3834058426,"src\\Validator\\Constraints\\UrlOrBuiltin.php":853948628,"src\\Validator\\Constraints\\UrlOrBuiltinValidator.php":3558280999,"src\\Validator\\Constraints\\ValidFileFilter.php":630385033,"src\\Validator\\Constraints\\ValidFileFilterValidator.php":4287615068,"src\\Validator\\Constraints\\ValidPartLot.php":1207490428,"src\\Validator\\Constraints\\ValidPartLotValidator.php":2590613882,"src\\Validator\\Constraints\\ValidPermission.php":2714384844,"src\\Validator\\Constraints\\ValidPermissionValidator.php":2719956864,"tests\\Controller\\AdminPages\\AbstractAdminControllerTest.php":1062895990,"tests\\Controller\\AdminPages\\AttachmentTypeControllerTest.php":1851572998,"tests\\Controller\\AdminPages\\CategoryControllerTest.php":3055054466,"tests\\Controller\\AdminPages\\DeviceControllerTest.php":298260400,"tests\\Controller\\AdminPages\\FootprintControllerTest.php":3545271305,"tests\\Controller\\AdminPages\\ManufacturerControllerTest.php":3593233112,"tests\\Controller\\AdminPages\\MeasurementUnitControllerTest.php":4008297325,"tests\\Controller\\AdminPages\\StorelocationControllerTest.php":3328115423,"tests\\Controller\\AdminPages\\SupplierControllerTest.php":2990639805,"tests\\Controller\\RedirectControllerTest.php":2162110459,"tests\\Entity\\Attachments\\AttachmentTest.php":4196625113,"tests\\Entity\\Attachments\\AttachmentTypeTest.php":2179722054,"tests\\Entity\\Parts\\PartLotTest.php":3186371808,"tests\\Entity\\Parts\\PartTest.php":2431087462,"tests\\Entity\\PriceSystem\\CurrencyTest.php":3047106740,"tests\\Entity\\PriceSystem\\OrderdetailTest.php":3366114275,"tests\\Entity\\PriceSystem\\PricedetailTest.php":2947791329,"tests\\Entity\\StructuralDBElementTest.php":4091822439,"tests\\Entity\\UserSystem\\PermissionsEmbedTest.php":1625719810,"tests\\Entity\\UserSystem\\UserTest.php":3005477241,"tests\\Helpers\\BBCodeToMarkdownConverterTest.php":722308221,"tests\\Helpers\\TreeViewNodeTest.php":479496228,"tests\\Services\\AmountFormatterTest.php":2220293280,"tests\\Services\\Attachments\\AttachmentPathResolverTest.php":1244829604,"tests\\Services\\Attachments\\AttachmentURLGeneratorTest.php":1468896953,"tests\\Services\\Attachments\\BuiltinAttachmentsFinderTest.php":2778824448,"tests\\Services\\Attachments\\FileTypeFilterToolsTest.php":2163556490,"tests\\Services\\PermissionResolverTest.php":2934090111,"tests\\Services\\PricedetailHelperTest.php":2101366552,"tests\\Services\\SIFormatterTest.php":2424942615,".php_cs.dist":3212446582}}
\ No newline at end of file
+{"php":"7.3.6","version":"2.16.1:v2.16.1#c8afb599858876e95e8ebfcd97812d383fa23f02","indent":" ","lineEnding":"\n","rules":{"array_syntax":{"syntax":"short"},"binary_operator_spaces":true,"blank_line_after_opening_tag":true,"blank_line_before_statement":{"statements":["return"]},"braces":{"allow_single_line_closure":true},"cast_spaces":true,"class_attributes_separation":{"elements":["method"]},"class_definition":{"single_line":true},"concat_space":true,"declare_equal_normalize":true,"function_typehint_space":true,"include":true,"increment_style":true,"lowercase_cast":true,"lowercase_static_reference":true,"magic_constant_casing":true,"magic_method_casing":true,"method_argument_space":true,"native_function_casing":true,"native_function_type_declaration_casing":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["curly_brace_block","extra","parenthesis_brace_block","square_brace_block","throw","use"]},"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"allow_mixed":true,"allow_unused_params":true},"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_unneeded_control_parentheses":true,"no_unneeded_curly_braces":true,"no_unneeded_final_method":true,"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"object_operator_without_whitespace":true,"ordered_imports":true,"php_unit_fqcn_annotation":true,"phpdoc_align":{"tags":["method","param","property","return","throws","type","var"]},"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":{"null_adjustment":"always_last","sort_algorithm":"none"},"phpdoc_var_without_name":true,"return_type_declaration":true,"semicolon_after_instruction":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_class_element_per_statement":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"single_trait_insert_per_statement":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"ternary_operator_spaces":true,"trailing_comma_in_multiline_array":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"yoda_style":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"dir_constant":true,"ereg_to_preg":true,"error_suppression":true,"fopen_flag_order":true,"function_to_constant":true,"implode_call":true,"is_null":true,"modernize_types_casting":true,"native_constant_invocation":{"fix_built_in":false,"include":["DIRECTORY_SEPARATOR","PHP_SAPI","PHP_VERSION_ID"],"scope":"namespaced"},"native_function_invocation":{"include":["@compiler_optimized"],"scope":"namespaced","strict":true},"no_alias_functions":true,"no_homoglyph_names":true,"non_printable_character":true,"php_unit_construct":true,"php_unit_mock_short_will_return":true,"psr4":true,"self_accessor":true,"set_type_to_cast":true,"php_unit_dedicate_assert_internal_type":{"target":"7.5"},"php_unit_namespaced":{"target":"6.0"},"php_unit_dedicate_assert":{"target":"5.6"},"php_unit_expectation":{"target":"5.6"},"php_unit_mock":{"target":"5.5"},"php_unit_no_expectation_annotation":{"target":"4.3"},"combine_nested_dirname":true},"hashes":{"src\\Command\\CleanAttachmentsCommand.php":2908442282,"src\\Command\\ConvertBBCodeCommand.php":1482865090,"src\\Command\\SetPasswordCommand.php":2214878570,"src\\Command\\UpdateExchangeRatesCommand.php":2478314487,"src\\Configuration\\PermissionsConfiguration.php":2292703041,"src\\Controller\\AdminPages\\AttachmentTypeController.php":2043735562,"src\\Controller\\AdminPages\\BaseAdminController.php":256092476,"src\\Controller\\AdminPages\\CategoryController.php":2332760319,"src\\Controller\\AdminPages\\CurrencyController.php":1707599961,"src\\Controller\\AdminPages\\DeviceController.php":1643684955,"src\\Controller\\AdminPages\\FootprintController.php":4274611247,"src\\Controller\\AdminPages\\ManufacturerController.php":398603842,"src\\Controller\\AdminPages\\MeasurementUnitController.php":3602410282,"src\\Controller\\AdminPages\\StorelocationController.php":2319716752,"src\\Controller\\AdminPages\\SupplierController.php":981802406,"src\\Controller\\AttachmentFileController.php":2383997058,"src\\Controller\\GroupController.php":2553259838,"src\\Controller\\HomepageController.php":890878176,"src\\Controller\\PartController.php":2130525158,"src\\Controller\\PartListsController.php":2203269023,"src\\Controller\\RedirectController.php":3569803328,"src\\Controller\\SecurityController.php":1331676061,"src\\Controller\\TreeController.php":3639241516,"src\\Controller\\TypeaheadController.php":3709661949,"src\\Controller\\UserController.php":2525832481,"src\\Controller\\UserSettingsController.php":796319787,"src\\DataFixtures\\AppFixtures.php":2963967304,"src\\DataFixtures\\DataStructureFixtures.php":431104433,"src\\DataFixtures\\GroupFixtures.php":3858137367,"src\\DataFixtures\\UserFixtures.php":3167825813,"src\\DataTables\\Adapter\\CustomORMAdapter.php":3030912758,"src\\DataTables\\AttachmentDataTable.php":3904233810,"src\\DataTables\\Column\\EntityColumn.php":1510470116,"src\\DataTables\\Column\\LocaleDateTimeColumn.php":908976159,"src\\DataTables\\Column\\MarkdownColumn.php":477805935,"src\\DataTables\\Column\\PartAttachmentsColumn.php":2186182482,"src\\DataTables\\Column\\TagsColumn.php":3096658795,"src\\DataTables\\PartsDataTable.php":3452233661,"src\\Entity\\Attachments\\Attachment.php":3244726569,"src\\Entity\\Attachments\\AttachmentContainingDBElement.php":3424378770,"src\\Entity\\Attachments\\AttachmentType.php":45140778,"src\\Entity\\Attachments\\AttachmentTypeAttachment.php":662823187,"src\\Entity\\Attachments\\CategoryAttachment.php":1564223450,"src\\Entity\\Attachments\\CurrencyAttachment.php":2416359971,"src\\Entity\\Attachments\\DeviceAttachment.php":1409656804,"src\\Entity\\Attachments\\FootprintAttachment.php":1347173291,"src\\Entity\\Attachments\\GroupAttachment.php":1910690777,"src\\Entity\\Attachments\\ManufacturerAttachment.php":2582905765,"src\\Entity\\Attachments\\MeasurementUnitAttachment.php":2392084428,"src\\Entity\\Attachments\\PartAttachment.php":3427564800,"src\\Entity\\Attachments\\StorelocationAttachment.php":3826820211,"src\\Entity\\Attachments\\SupplierAttachment.php":163134674,"src\\Entity\\Attachments\\UserAttachment.php":776633738,"src\\Entity\\Base\\Company.php":1078622764,"src\\Entity\\Base\\DBElement.php":636968900,"src\\Entity\\Base\\MasterAttachmentTrait.php":1512749825,"src\\Entity\\Base\\NamedDBElement.php":1185301949,"src\\Entity\\Base\\PartsContainingDBElement.php":1569328311,"src\\Entity\\Base\\StructuralDBElement.php":192167616,"src\\Entity\\Base\\TimestampTrait.php":563171586,"src\\Entity\\Devices\\Device.php":889649260,"src\\Entity\\Devices\\DevicePart.php":35018670,"src\\Entity\\Parts\\Category.php":4284005815,"src\\Entity\\Parts\\Footprint.php":246420221,"src\\Entity\\Parts\\Manufacturer.php":3809823616,"src\\Entity\\Parts\\MeasurementUnit.php":3260810861,"src\\Entity\\Parts\\Part.php":3664161653,"src\\Entity\\Parts\\PartLot.php":237114760,"src\\Entity\\Parts\\PartTraits\\AdvancedPropertyTrait.php":3686526974,"src\\Entity\\Parts\\PartTraits\\BasicPropertyTrait.php":3244877855,"src\\Entity\\Parts\\PartTraits\\InstockTrait.php":2585222633,"src\\Entity\\Parts\\PartTraits\\ManufacturerTrait.php":97336763,"src\\Entity\\Parts\\PartTraits\\OrderTrait.php":829848325,"src\\Entity\\Parts\\Storelocation.php":4230952,"src\\Entity\\Parts\\Supplier.php":1358101007,"src\\Entity\\PriceInformations\\Currency.php":561869192,"src\\Entity\\PriceInformations\\Orderdetail.php":3298257124,"src\\Entity\\PriceInformations\\Pricedetail.php":3355333891,"src\\Entity\\UserSystem\\Group.php":2867735914,"src\\Entity\\UserSystem\\PermissionsEmbed.php":23369016,"src\\Entity\\UserSystem\\U2FKey.php":604173559,"src\\Entity\\UserSystem\\User.php":42978899,"src\\EntityListeners\\AttachmentDeleteListener.php":3708835753,"src\\EntityListeners\\TreeCacheInvalidationListener.php":4271177067,"src\\EventSubscriber\\LoginSuccessListener.php":3290811941,"src\\EventSubscriber\\LogoutOnDisabledUserListener.php":1379035211,"src\\EventSubscriber\\MailFromListener.php":1845580262,"src\\EventSubscriber\\PasswordChangeNeededSubscriber.php":3037661002,"src\\EventSubscriber\\SymfonyDebugToolbarSubscriber.php":3244347947,"src\\EventSubscriber\\TimezoneListener.php":1719734434,"src\\EventSubscriber\\U2FRegistrationSubscriber.php":3148688035,"src\\Exceptions\\AttachmentDownloadException.php":2916573626,"src\\Exceptions\\EntityNotSupportedException.php":2435284975,"src\\Form\\AdminPages\\AttachmentTypeAdminForm.php":1491465139,"src\\Form\\AdminPages\\BaseEntityAdminForm.php":632889234,"src\\Form\\AdminPages\\CategoryAdminForm.php":1791318147,"src\\Form\\AdminPages\\CompanyForm.php":105808960,"src\\Form\\AdminPages\\CurrencyAdminForm.php":3039183169,"src\\Form\\AdminPages\\FootprintAdminForm.php":587923576,"src\\Form\\AdminPages\\GroupAdminForm.php":1282028013,"src\\Form\\AdminPages\\ImportType.php":515771511,"src\\Form\\AdminPages\\MassCreationForm.php":1194578061,"src\\Form\\AdminPages\\MeasurementUnitAdminForm.php":1587015569,"src\\Form\\AdminPages\\StorelocationAdminForm.php":2208707860,"src\\Form\\AdminPages\\SupplierForm.php":3689965036,"src\\Form\\AttachmentFormType.php":3882974278,"src\\Form\\Part\\OrderdetailType.php":783797031,"src\\Form\\Part\\PartBaseType.php":4246592018,"src\\Form\\Part\\PartLotType.php":3825875775,"src\\Form\\Part\\PricedetailType.php":1020268253,"src\\Form\\Permissions\\PermissionGroupType.php":2524182940,"src\\Form\\Permissions\\PermissionsMapper.php":1163401752,"src\\Form\\Permissions\\PermissionsType.php":1106564554,"src\\Form\\Permissions\\PermissionType.php":331672534,"src\\Form\\TFAGoogleSettingsType.php":3526243999,"src\\Form\\Type\\CurrencyEntityType.php":2759243750,"src\\Form\\Type\\MasterPictureAttachmentType.php":2603681397,"src\\Form\\Type\\SIUnitType.php":1102554341,"src\\Form\\Type\\StructuralEntityType.php":1976870620,"src\\Form\\Type\\TriStateCheckboxType.php":1561238730,"src\\Form\\UserAdminForm.php":2186388949,"src\\Form\\UserSettingsType.php":4174656317,"src\\Helpers\\BBCodeToMarkdownConverter.php":1943749047,"src\\Helpers\\Trees\\StructuralDBElementIterator.php":2352508998,"src\\Helpers\\Trees\\TreeViewNode.php":1548284390,"src\\Helpers\\Trees\\TreeViewNodeIterator.php":2240097370,"src\\Helpers\\Trees\\TreeViewNodeState.php":3129795795,"src\\Helpers\\UTCDateTimeType.php":2732968354,"src\\Kernel.php":1116622545,"src\\Migrations\\Version1.php":4120408624,"src\\Migrations\\Version20190902140506.php":3292952863,"src\\Migrations\\Version20190913141126.php":2846559568,"src\\Migrations\\Version20190924113252.php":3219990553,"src\\Migrations\\Version20191214153125.php":2838818916,"src\\Repository\\NamedDBElementRepository.php":1021749357,"src\\Repository\\PartRepository.php":2577496518,"src\\Repository\\StructuralDBElementRepository.php":2000596546,"src\\Repository\\UserRepository.php":2434923040,"src\\Security\\Annotations\\ColumnSecurity.php":761890876,"src\\Security\\EntityListeners\\ElementPermissionListener.php":1168879606,"src\\Security\\Interfaces\\HasPermissionsInterface.php":2020026839,"src\\Security\\UserChecker.php":1642881488,"src\\Security\\Voter\\AttachmentVoter.php":106235627,"src\\Security\\Voter\\ExtendedVoter.php":1627517194,"src\\Security\\Voter\\GroupVoter.php":879599634,"src\\Security\\Voter\\PartVoter.php":44030195,"src\\Security\\Voter\\PermissionVoter.php":3738435752,"src\\Security\\Voter\\StructureVoter.php":3663366112,"src\\Security\\Voter\\UserVoter.php":2043762541,"src\\Services\\AmountFormatter.php":2321360150,"src\\Services\\Attachments\\AttachmentManager.php":526918495,"src\\Services\\Attachments\\AttachmentPathResolver.php":1007861213,"src\\Services\\Attachments\\AttachmentReverseSearch.php":426118901,"src\\Services\\Attachments\\AttachmentSubmitHandler.php":4056610310,"src\\Services\\Attachments\\AttachmentURLGenerator.php":657162657,"src\\Services\\Attachments\\BuiltinAttachmentsFinder.php":2275426974,"src\\Services\\Attachments\\FileTypeFilterTools.php":2790388276,"src\\Services\\Attachments\\PartPreviewGenerator.php":3160794167,"src\\Services\\CustomEnvVarProcessor.php":3155830759,"src\\Services\\ElementTypeNameGenerator.php":3583980291,"src\\Services\\EntityExporter.php":1408045599,"src\\Services\\EntityImporter.php":1019284863,"src\\Services\\EntityURLGenerator.php":3986216656,"src\\Services\\FAIconGenerator.php":4235598968,"src\\Services\\GitVersionInfo.php":4016006333,"src\\Services\\MarkdownParser.php":252026679,"src\\Services\\MoneyFormatter.php":1672715893,"src\\Services\\PasswordResetManager.php":619420107,"src\\Services\\PermissionResolver.php":2405944720,"src\\Services\\PricedetailHelper.php":451798823,"src\\Services\\SIFormatter.php":2284601349,"src\\Services\\StructuralElementRecursionHelper.php":3627688813,"src\\Services\\TagFinder.php":1979223100,"src\\Services\\TFA\\BackupCodeGenerator.php":1013962649,"src\\Services\\TFA\\BackupCodeManager.php":1830708850,"src\\Services\\TranslationExtractor\\PermissionExtractor.php":2379032323,"src\\Services\\Trees\\NodesListBuilder.php":1796505146,"src\\Services\\Trees\\ToolsTreeBuilder.php":1670601808,"src\\Services\\Trees\\TreeViewGenerator.php":2147352931,"src\\Services\\UserCacheKeyGenerator.php":1716083720,"src\\Twig\\AppExtension.php":3805551397,"src\\Validator\\Constraints\\AllowedFileExtension.php":2636718005,"src\\Validator\\Constraints\\AllowedFileExtensionValidator.php":2759618947,"src\\Validator\\Constraints\\NoLockout.php":3624981320,"src\\Validator\\Constraints\\NoLockoutValidator.php":3493345860,"src\\Validator\\Constraints\\NoneOfItsChildren.php":1276347049,"src\\Validator\\Constraints\\NoneOfItsChildrenValidator.php":2211921658,"src\\Validator\\Constraints\\Selectable.php":4202102224,"src\\Validator\\Constraints\\SelectableValidator.php":3834058426,"src\\Validator\\Constraints\\UrlOrBuiltin.php":853948628,"src\\Validator\\Constraints\\UrlOrBuiltinValidator.php":3558280999,"src\\Validator\\Constraints\\ValidFileFilter.php":630385033,"src\\Validator\\Constraints\\ValidFileFilterValidator.php":4287615068,"src\\Validator\\Constraints\\ValidGoogleAuthCode.php":1269132927,"src\\Validator\\Constraints\\ValidGoogleAuthCodeValidator.php":3080767173,"src\\Validator\\Constraints\\ValidPartLot.php":1207490428,"src\\Validator\\Constraints\\ValidPartLotValidator.php":2590613882,"src\\Validator\\Constraints\\ValidPermission.php":2714384844,"src\\Validator\\Constraints\\ValidPermissionValidator.php":2719956864,"tests\\ApplicationAvailabilityFunctionalTest.php":808136225,"tests\\Controller\\AdminPages\\AbstractAdminControllerTest.php":3506405566,"tests\\Controller\\AdminPages\\AttachmentTypeControllerTest.php":3195269389,"tests\\Controller\\AdminPages\\CategoryControllerTest.php":1105324556,"tests\\Controller\\AdminPages\\DeviceControllerTest.php":1239165113,"tests\\Controller\\AdminPages\\FootprintControllerTest.php":1937147321,"tests\\Controller\\AdminPages\\ManufacturerControllerTest.php":3003859874,"tests\\Controller\\AdminPages\\MeasurementUnitControllerTest.php":3269436963,"tests\\Controller\\AdminPages\\StorelocationControllerTest.php":71080348,"tests\\Controller\\AdminPages\\SupplierControllerTest.php":4294641469,"tests\\Controller\\RedirectControllerTest.php":425193471,"tests\\Entity\\Attachments\\AttachmentTest.php":4196625113,"tests\\Entity\\Attachments\\AttachmentTypeTest.php":2179722054,"tests\\Entity\\Parts\\PartLotTest.php":3186371808,"tests\\Entity\\Parts\\PartTest.php":2431087462,"tests\\Entity\\PriceSystem\\CurrencyTest.php":3047106740,"tests\\Entity\\PriceSystem\\OrderdetailTest.php":3366114275,"tests\\Entity\\PriceSystem\\PricedetailTest.php":2947791329,"tests\\Entity\\StructuralDBElementTest.php":3346250825,"tests\\Entity\\UserSystem\\PermissionsEmbedTest.php":329235414,"tests\\Entity\\UserSystem\\UserTest.php":3076052370,"tests\\EventSubscriber\\PasswordChangeNeededSubscriberTest.php":579372360,"tests\\Helpers\\BBCodeToMarkdownConverterTest.php":410431632,"tests\\Helpers\\TreeViewNodeTest.php":1984635703,"tests\\Repository\\NamedDBElementRepositoryTest.php":4245963283,"tests\\Repository\\StructuralDBElementRepositoryTest.php":37642671,"tests\\Security\\Annotations\\ColumnSecurityTest.php":2795472874,"tests\\Security\\UserCheckerTest.php":3873210903,"tests\\Services\\AmountFormatterTest.php":2144558110,"tests\\Services\\Attachments\\AttachmentPathResolverTest.php":3093941818,"tests\\Services\\Attachments\\AttachmentURLGeneratorTest.php":4259606978,"tests\\Services\\Attachments\\BuiltinAttachmentsFinderTest.php":2854877161,"tests\\Services\\Attachments\\FileTypeFilterToolsTest.php":2666907227,"tests\\Services\\ElementTypeNameGeneratorTest.php":4109460717,"tests\\Services\\EntityImporterTest.php":1235862629,"tests\\Services\\FAIconGeneratorTest.php":3382627631,"tests\\Services\\PermissionResolverTest.php":2154016562,"tests\\Services\\PricedetailHelperTest.php":1696993573,"tests\\Services\\SIFormatterTest.php":4045533312,"tests\\Services\\TFA\\BackupCodeGeneratorTest.php":1380608706,"tests\\Services\\TFA\\BackupCodeManagerTest.php":3243101825,"tests\\Services\\Trees\\NodesListBuilderTest.php":1231955704,"tests\\Services\\Trees\\TreeViewGeneratorTest.php":1617190814,".php_cs.dist":2078054353}}
\ No newline at end of file
diff --git a/.php_cs.dist b/.php_cs.dist
index 8cb87fc6..b26e3bba 100644
--- a/.php_cs.dist
+++ b/.php_cs.dist
@@ -2,9 +2,8 @@
/**
* Based on the .php_cs.dist of the symfony project
- * https://github.com/symfony/symfony/blob/4.4/.php_cs.dist
+ * https://github.com/symfony/symfony/blob/4.4/.php_cs.dist.
*/
-
if (!file_exists(__DIR__.'/src')) {
exit(0);
}
diff --git a/src/Command/ConvertBBCodeCommand.php b/src/Command/ConvertBBCodeCommand.php
index 4b5870c1..30f007eb 100644
--- a/src/Command/ConvertBBCodeCommand.php
+++ b/src/Command/ConvertBBCodeCommand.php
@@ -80,8 +80,6 @@ class ConvertBBCodeCommand extends Command
/**
* Returns a list which entities and which properties need to be checked.
- *
- * @return array
*/
protected function getTargetsLists(): array
{
diff --git a/src/Controller/AttachmentFileController.php b/src/Controller/AttachmentFileController.php
index 1d7ee7d9..bec2a8d2 100644
--- a/src/Controller/AttachmentFileController.php
+++ b/src/Controller/AttachmentFileController.php
@@ -40,7 +40,6 @@ class AttachmentFileController extends AbstractController
* @Route("/attachment/{id}/download", name="attachment_download")
*
* @return BinaryFileResponse
- *
*/
public function download(Attachment $attachment, AttachmentManager $helper)
{
diff --git a/src/Controller/PartController.php b/src/Controller/PartController.php
index 1c6c84ae..9ca312e6 100644
--- a/src/Controller/PartController.php
+++ b/src/Controller/PartController.php
@@ -151,7 +151,7 @@ class PartController extends AbstractController
$cid = $request->get('cid', 1);
$category = $em->find(Category::class, $cid);
- if($category !== null) {
+ if (null !== $category) {
$new_part->setCategory($category);
}
diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php
index 26f53cfa..bdfd1941 100644
--- a/src/Controller/SecurityController.php
+++ b/src/Controller/SecurityController.php
@@ -80,7 +80,7 @@ class SecurityController extends AbstractController
$builder = $this->createFormBuilder();
$builder->add('user', TextType::class, [
'label' => $this->translator->trans('pw_reset.user_or_email'),
- 'constraints' => [new NotBlank()]
+ 'constraints' => [new NotBlank()],
]);
$builder->add('captcha', CaptchaType::class, [
'width' => 200,
@@ -88,7 +88,7 @@ class SecurityController extends AbstractController
'length' => 6,
]);
$builder->add('submit', SubmitType::class, [
- 'label' => 'pw_reset.submit'
+ 'label' => 'pw_reset.submit',
]);
$form = $builder->getForm();
@@ -97,11 +97,12 @@ class SecurityController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$passwordReset->request($form->getData()['user']);
$this->addFlash('success', 'pw_reset.request.success');
+
return $this->redirectToRoute('login');
}
return $this->render('security/pw_reset_request.html.twig', [
- 'form' => $form->createView()
+ 'form' => $form->createView(),
]);
}
@@ -121,10 +122,10 @@ class SecurityController extends AbstractController
$data = ['username' => $user, 'token' => $token];
$builder = $this->createFormBuilder($data);
$builder->add('username', TextType::class, [
- 'label' => $this->translator->trans('pw_reset.username')
+ 'label' => $this->translator->trans('pw_reset.username'),
]);
$builder->add('token', TextType::class, [
- 'label' => $this->translator->trans('pw_reset.token')
+ 'label' => $this->translator->trans('pw_reset.token'),
]);
$builder->add('new_password', RepeatedType::class, [
'type' => PasswordType::class,
@@ -138,7 +139,7 @@ class SecurityController extends AbstractController
]);
$builder->add('submit', SubmitType::class, [
- 'label' => 'pw_reset.submit'
+ 'label' => 'pw_reset.submit',
]);
$form = $builder->getForm();
@@ -152,13 +153,13 @@ class SecurityController extends AbstractController
$this->addFlash('error', 'pw_reset.new_pw.error');
} else {
$this->addFlash('success', 'pw_reset.new_pw.success');
+
return $this->redirectToRoute('login');
}
}
-
return $this->render('security/pw_reset_new_pw.html.twig', [
- 'form' => $form->createView()
+ 'form' => $form->createView(),
]);
}
diff --git a/src/Controller/TreeController.php b/src/Controller/TreeController.php
index b6f04609..f8f4de1b 100644
--- a/src/Controller/TreeController.php
+++ b/src/Controller/TreeController.php
@@ -35,6 +35,7 @@ use Symfony\Component\Routing\Annotation\Route;
/**
* This controller has the purpose to provide the data for all treeviews.
+ *
* @Route("/tree")
*/
class TreeController extends AbstractController
@@ -52,6 +53,7 @@ class TreeController extends AbstractController
public function tools(ToolsTreeBuilder $builder)
{
$tree = $builder->getTree();
+
return new JsonResponse($tree);
}
@@ -62,6 +64,7 @@ class TreeController extends AbstractController
public function categoryTree(Category $category = null)
{
$tree = $this->treeGenerator->getTreeView(Category::class, $category);
+
return new JsonResponse($tree);
}
@@ -72,6 +75,7 @@ class TreeController extends AbstractController
public function footprintTree(Footprint $footprint = null)
{
$tree = $this->treeGenerator->getTreeView(Footprint::class, $footprint);
+
return new JsonResponse($tree);
}
@@ -82,6 +86,7 @@ class TreeController extends AbstractController
public function locationTree(Storelocation $location = null)
{
$tree = $this->treeGenerator->getTreeView(Storelocation::class, $location);
+
return new JsonResponse($tree);
}
@@ -92,6 +97,7 @@ class TreeController extends AbstractController
public function manufacturerTree(Manufacturer $manufacturer = null)
{
$tree = $this->treeGenerator->getTreeView(Manufacturer::class, $manufacturer);
+
return new JsonResponse($tree);
}
@@ -102,6 +108,7 @@ class TreeController extends AbstractController
public function supplierTree(Supplier $supplier = null)
{
$tree = $this->treeGenerator->getTreeView(Supplier::class, $supplier);
+
return new JsonResponse($tree);
}
@@ -112,6 +119,7 @@ class TreeController extends AbstractController
public function deviceTree(Device $device = null)
{
$tree = $this->treeGenerator->getTreeView(Device::class, $device, '');
+
return new JsonResponse($tree);
}
}
diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php
index fd425e22..bb1b14c6 100644
--- a/src/Controller/UserController.php
+++ b/src/Controller/UserController.php
@@ -56,7 +56,7 @@ class UserController extends AdminPages\BaseAdminController
{
//Handle 2FA disabling
- if($request->request->has('reset_2fa')) {
+ if ($request->request->has('reset_2fa')) {
//Check if the admin has the needed permissions
$this->denyAccessUnlessGranted('set_password', $entity);
if ($this->isCsrfTokenValid('reset_2fa'.$entity->getId(), $request->request->get('_token'))) {
@@ -64,7 +64,7 @@ class UserController extends AdminPages\BaseAdminController
$entity->setGoogleAuthenticatorSecret(null);
$entity->setBackupCodes([]);
//Remove all U2F keys
- foreach($entity->getU2FKeys() as $key) {
+ foreach ($entity->getU2FKeys() as $key) {
$em->remove($key);
}
//Invalidate trusted devices
@@ -136,7 +136,6 @@ class UserController extends AdminPages\BaseAdminController
//If no user id was passed, then we show info about the current user
if (null === $user) {
$user = $this->getUser();
-
} else {
//Else we must check, if the current user is allowed to access $user
$this->denyAccessUnlessGranted('read', $user);
diff --git a/src/Controller/UserSettingsController.php b/src/Controller/UserSettingsController.php
index d7163adb..f9e40d9c 100644
--- a/src/Controller/UserSettingsController.php
+++ b/src/Controller/UserSettingsController.php
@@ -21,14 +21,12 @@
namespace App\Controller;
-
use App\Entity\UserSystem\U2FKey;
use App\Entity\UserSystem\User;
use App\Form\TFAGoogleSettingsType;
use App\Form\UserSettingsType;
use App\Services\TFA\BackupCodeManager;
use Doctrine\ORM\EntityManagerInterface;
-use Exception;
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticator;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
@@ -43,7 +41,6 @@ use Symfony\Component\Validator\Constraints\Length;
/**
* @Route("/user")
- * @package App\Controller
*/
class UserSettingsController extends AbstractController
{
@@ -74,7 +71,7 @@ class UserSettingsController extends AbstractController
}
return $this->render('Users/backup_codes.html.twig', [
- 'user' => $user
+ 'user' => $user,
]);
}
@@ -85,7 +82,7 @@ class UserSettingsController extends AbstractController
*/
public function removeU2FToken(Request $request, EntityManagerInterface $entityManager, BackupCodeManager $backupCodeManager)
{
- if($this->demo_mode) {
+ if ($this->demo_mode) {
throw new \RuntimeException('You can not do 2FA things in demo mode');
}
@@ -98,15 +95,14 @@ class UserSettingsController extends AbstractController
throw new \RuntimeException('This controller only works only for Part-DB User objects!');
}
-
if ($this->isCsrfTokenValid('delete'.$user->getId(), $request->request->get('_token'))) {
- if($request->request->has('key_id')) {
+ if ($request->request->has('key_id')) {
$key_id = $request->request->get('key_id');
$key_repo = $entityManager->getRepository(U2FKey::class);
/** @var U2FKey|null $u2f */
$u2f = $key_repo->find($key_id);
- if($u2f === null) {
- $this->addFlash('danger','tfa_u2f.u2f_delete.not_existing');
+ if (null === $u2f) {
+ $this->addFlash('danger', 'tfa_u2f.u2f_delete.not_existing');
throw new \RuntimeException('Key not existing!');
}
@@ -122,7 +118,7 @@ class UserSettingsController extends AbstractController
$this->addFlash('success', 'tfa.u2f.u2f_delete.success');
}
} else {
- $this->addFlash('error','csfr_invalid');
+ $this->addFlash('error', 'csfr_invalid');
}
return $this->redirectToRoute('user_settings');
@@ -133,7 +129,7 @@ class UserSettingsController extends AbstractController
*/
public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager)
{
- if($this->demo_mode) {
+ if ($this->demo_mode) {
throw new \RuntimeException('You can not do 2FA things in demo mode');
}
@@ -146,13 +142,12 @@ class UserSettingsController extends AbstractController
return new \RuntimeException('This controller only works only for Part-DB User objects!');
}
-
if ($this->isCsrfTokenValid('devices_reset'.$user->getId(), $request->request->get('_token'))) {
$user->invalidateTrustedDeviceTokens();
$entityManager->flush();
$this->addFlash('success', 'tfa_trustedDevice.invalidate.success');
} else {
- $this->addFlash('error','csfr_invalid');
+ $this->addFlash('error', 'csfr_invalid');
}
return $this->redirectToRoute('user_settings');
@@ -205,7 +200,7 @@ class UserSettingsController extends AbstractController
'data' => $user->getName(),
'attr' => ['autocomplete' => 'username'],
'disabled' => true,
- 'row_attr' => ['class' => 'd-none']
+ 'row_attr' => ['class' => 'd-none'],
])
->add('old_password', PasswordType::class, [
'label' => 'user.settings.pw_old.label',
@@ -219,7 +214,7 @@ class UserSettingsController extends AbstractController
'second_options' => ['label' => 'user.settings.pw_confirm.label'],
'invalid_message' => 'password_must_match',
'options' => [
- 'attr' => ['autocomplete' => 'new-password']
+ 'attr' => ['autocomplete' => 'new-password'],
],
'constraints' => [new Length([
'min' => 6,
@@ -260,6 +255,7 @@ class UserSettingsController extends AbstractController
$backupCodeManager->enableBackupCodes($user);
$em->flush();
$this->addFlash('success', 'user.settings.2fa.google.activated');
+
return $this->redirectToRoute('user_settings');
}
@@ -269,14 +265,15 @@ class UserSettingsController extends AbstractController
$backupCodeManager->disableBackupCodesIfUnused($user);
$em->flush();
$this->addFlash('success', 'user.settings.2fa.google.disabled');
+
return $this->redirectToRoute('user_settings');
}
}
- $backup_form = $this->get('form.factory')->createNamedBuilder('backup_codes')->add('reset_codes', SubmitType::class,[
+ $backup_form = $this->get('form.factory')->createNamedBuilder('backup_codes')->add('reset_codes', SubmitType::class, [
'label' => 'tfa_backup.regenerate_codes',
'attr' => ['class' => 'btn-danger'],
- 'disabled' => empty($user->getBackupCodes())
+ 'disabled' => empty($user->getBackupCodes()),
])->getForm();
$backup_form->handleRequest($request);
@@ -286,7 +283,6 @@ class UserSettingsController extends AbstractController
$this->addFlash('success', 'user.settings.2fa.backup_codes.regenerated');
}
-
/******************************
* Output both forms
*****************************/
@@ -303,8 +299,8 @@ class UserSettingsController extends AbstractController
'enabled' => $google_enabled,
'qrContent' => $googleAuthenticator->getQRContent($user),
'secret' => $user->getGoogleAuthenticatorSecret(),
- 'username' => $user->getGoogleAuthenticatorUsername()
- ]
+ 'username' => $user->getGoogleAuthenticatorUsername(),
+ ],
]);
}
-}
\ No newline at end of file
+}
diff --git a/src/DataTables/Adapter/CustomORMAdapter.php b/src/DataTables/Adapter/CustomORMAdapter.php
index 70d5ef6c..72bb2730 100644
--- a/src/DataTables/Adapter/CustomORMAdapter.php
+++ b/src/DataTables/Adapter/CustomORMAdapter.php
@@ -21,7 +21,6 @@
namespace App\DataTables\Adapter;
-
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Omines\DataTablesBundle\Adapter\AdapterQuery;
@@ -31,24 +30,25 @@ use Omines\DataTablesBundle\Column\AbstractColumn;
/**
* Override default ORM Adapter, to allow fetch joins (allow addSelect with ManyToOne Collections).
* This should improves performance for Part Tables.
- * Based on: https://github.com/omines/datatables-bundle/blob/master/tests/Fixtures/AppBundle/DataTable/Adapter/CustomORMAdapter.php
- * @package App\DataTables\Adapter
+ * Based on: https://github.com/omines/datatables-bundle/blob/master/tests/Fixtures/AppBundle/DataTable/Adapter/CustomORMAdapter.php.
*/
class CustomORMAdapter extends ORMAdapter
{
protected $hydrationMode;
+
public function configure(array $options)
{
parent::configure($options);
$this->hydrationMode = isset($options['hydrate']) ? $options['hydrate'] : Query::HYDRATE_OBJECT;
}
+
protected function prepareQuery(AdapterQuery $query)
{
parent::prepareQuery($query);
$query->setIdentifierPropertyPath(null);
}
+
/**
- * @param AdapterQuery $query
* @return \Traversable
*/
protected function getResults(AdapterQuery $query): \Traversable
@@ -78,4 +78,4 @@ class CustomORMAdapter extends ORMAdapter
yield $result;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/DataTables/Column/MarkdownColumn.php b/src/DataTables/Column/MarkdownColumn.php
index 7ea0b2fd..689c2412 100644
--- a/src/DataTables/Column/MarkdownColumn.php
+++ b/src/DataTables/Column/MarkdownColumn.php
@@ -21,7 +21,6 @@
namespace App\DataTables\Column;
-
use App\Services\MarkdownParser;
use Omines\DataTablesBundle\Column\AbstractColumn;
@@ -38,10 +37,11 @@ class MarkdownColumn extends AbstractColumn
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
*
* @param mixed $value The single value of the column
+ *
* @return mixed
*/
public function normalize($value)
{
return $this->markdown->markForRendering($value, true);
}
-}
\ No newline at end of file
+}
diff --git a/src/DataTables/Column/PartAttachmentsColumn.php b/src/DataTables/Column/PartAttachmentsColumn.php
index 0cc0b072..95eb3487 100644
--- a/src/DataTables/Column/PartAttachmentsColumn.php
+++ b/src/DataTables/Column/PartAttachmentsColumn.php
@@ -21,21 +21,16 @@
namespace App\DataTables\Column;
-
use App\Entity\Attachments\Attachment;
use App\Entity\Parts\Part;
use App\Services\Attachments\AttachmentManager;
-use App\Services\Attachments\AttachmentURLGenerator;
use App\Services\EntityURLGenerator;
use App\Services\FAIconGenerator;
use Omines\DataTablesBundle\Column\AbstractColumn;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
-
class PartAttachmentsColumn extends AbstractColumn
{
-
protected $FAIconGenerator;
protected $urlGenerator;
protected $attachmentManager;
@@ -51,6 +46,7 @@ class PartAttachmentsColumn extends AbstractColumn
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
*
* @param mixed $value The single value of the column
+ *
* @return mixed
*/
public function normalize($value)
@@ -63,7 +59,7 @@ class PartAttachmentsColumn extends AbstractColumn
if (!$context instanceof Part) {
throw new \RuntimeException('$context must be a Part object!');
}
- $tmp = "";
+ $tmp = '';
$attachments = $context->getAttachments()->filter(function (Attachment $attachment) {
return $attachment->getShowInTable() && $this->attachmentManager->isFileExisting($attachment);
});
@@ -74,11 +70,11 @@ class PartAttachmentsColumn extends AbstractColumn
if (--$count < 0) {
break;
}
- /** @var Attachment $attachment */
+ /* @var Attachment $attachment */
$tmp .= sprintf(
'%s',
$this->urlGenerator->viewURL($attachment),
- htmlspecialchars($attachment->getName()) . ': ' . htmlspecialchars($attachment->getFilename()),
+ htmlspecialchars($attachment->getName()).': '.htmlspecialchars($attachment->getFilename()),
$this->FAIconGenerator->generateIconHTML(
// Sometimes the extension can not be determined, so ensure a generic icon is shown
$this->FAIconGenerator->fileExtensionToFAType($attachment->getExtension() ?? 'file'),
@@ -95,4 +91,4 @@ class PartAttachmentsColumn extends AbstractColumn
{
parent::configureOptions($resolver);
}
-}
\ No newline at end of file
+}
diff --git a/src/DataTables/Column/TagsColumn.php b/src/DataTables/Column/TagsColumn.php
index 733ef100..d8527ca2 100644
--- a/src/DataTables/Column/TagsColumn.php
+++ b/src/DataTables/Column/TagsColumn.php
@@ -21,13 +21,11 @@
namespace App\DataTables\Column;
-
use Omines\DataTablesBundle\Column\AbstractColumn;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class TagsColumn extends AbstractColumn
{
-
protected $urlGenerator;
public function __construct(UrlGeneratorInterface $urlGenerator)
@@ -39,6 +37,7 @@ class TagsColumn extends AbstractColumn
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
*
* @param mixed $value The single value of the column
+ *
* @return mixed
*/
public function normalize($value)
@@ -46,6 +45,7 @@ class TagsColumn extends AbstractColumn
if (empty($value)) {
return [];
}
+
return explode(',', $value);
}
@@ -67,4 +67,4 @@ class TagsColumn extends AbstractColumn
return $html;
}
-}
\ No newline at end of file
+}
diff --git a/src/DataTables/PartsDataTable.php b/src/DataTables/PartsDataTable.php
index 71e4b598..ce7f8e58 100644
--- a/src/DataTables/PartsDataTable.php
+++ b/src/DataTables/PartsDataTable.php
@@ -27,7 +27,6 @@ use App\DataTables\Column\LocaleDateTimeColumn;
use App\DataTables\Column\MarkdownColumn;
use App\DataTables\Column\PartAttachmentsColumn;
use App\DataTables\Column\TagsColumn;
-use App\Entity\Attachments\Attachment;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
@@ -38,19 +37,15 @@ use App\Services\AmountFormatter;
use App\Services\Attachments\AttachmentURLGenerator;
use App\Services\Attachments\PartPreviewGenerator;
use App\Services\EntityURLGenerator;
-use App\Services\FAIconGenerator;
-use App\Services\MarkdownParser;
use App\Services\Trees\NodesListBuilder;
use Doctrine\ORM\QueryBuilder;
use Omines\DataTablesBundle\Adapter\Doctrine\ORM\SearchCriteriaProvider;
-use Omines\DataTablesBundle\Adapter\Doctrine\ORMAdapter;
use Omines\DataTablesBundle\Column\BoolColumn;
use Omines\DataTablesBundle\Column\MapColumn;
use Omines\DataTablesBundle\Column\TextColumn;
use Omines\DataTablesBundle\DataTable;
use Omines\DataTablesBundle\DataTableTypeInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
-use function foo\func;
class PartsDataTable implements DataTableTypeInterface
{
diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php
index 3cdff01d..30cc7219 100644
--- a/src/Entity/Attachments/Attachment.php
+++ b/src/Entity/Attachments/Attachment.php
@@ -81,7 +81,7 @@ abstract class Attachment extends NamedDBElement
protected $path = '';
/**
- * @var string The original filename the file had, when the user uploaded it.
+ * @var string the original filename the file had, when the user uploaded it
* @ORM\Column(type="string", nullable=true)
*/
protected $original_filename;
@@ -138,8 +138,6 @@ abstract class Attachment extends NamedDBElement
/**
* Check if this attachment is a 3D model and therefore can be directly shown to user.
* If the attachment is external, false is returned (3D Models must be internal).
- *
- * @return bool
*/
public function is3DModel(): bool
{
@@ -179,7 +177,7 @@ abstract class Attachment extends NamedDBElement
* Check if this attachment is saved in a secure place.
* This means that it can not be accessed directly via a web request, but must be viewed via a controller.
*
- * @return bool True, if the file is secure.
+ * @return bool true, if the file is secure
*/
public function isSecure(): bool
{
@@ -197,7 +195,7 @@ abstract class Attachment extends NamedDBElement
* Checks if the attachment file is using a builtin file. (see BUILTIN_PLACEHOLDERS const for possible placeholders)
* If a file is built in, the path is shown to user in url field (no sensitive infos are provided).
*
- * @return bool True if the attachment is using an builtin file.
+ * @return bool true if the attachment is using an builtin file
*/
public function isBuiltIn(): bool
{
@@ -215,7 +213,7 @@ abstract class Attachment extends NamedDBElement
* For a path like %BASE/path/foo.bar, bar will be returned.
* If this attachment is external null is returned.
*
- * @return string|null The file extension in lower case.
+ * @return string|null the file extension in lower case
*/
public function getExtension(): ?string
{
@@ -233,7 +231,7 @@ abstract class Attachment extends NamedDBElement
/**
* Get the element, associated with this Attachment (for example a "Part" object).
*
- * @return AttachmentContainingDBElement The associated Element.
+ * @return AttachmentContainingDBElement the associated Element
*/
public function getElement(): ?AttachmentContainingDBElement
{
@@ -243,8 +241,6 @@ abstract class Attachment extends NamedDBElement
/**
* The URL to the external file, or the path to the built in file.
* Returns null, if the file is not external (and not builtin).
- *
- * @return string|null
*/
public function getURL(): ?string
{
@@ -258,8 +254,6 @@ abstract class Attachment extends NamedDBElement
/**
* Returns the hostname where the external file is stored.
* Returns null, if the file is not external.
- *
- * @return string|null
*/
public function getHost(): ?string
{
@@ -285,8 +279,6 @@ abstract class Attachment extends NamedDBElement
* For a path like %BASE/path/foo.bar, foo.bar will be returned.
*
* If the path is a URL (can be checked via isExternal()), null will be returned.
- *
- * @return string|null
*/
public function getFilename(): ?string
{
@@ -356,10 +348,6 @@ abstract class Attachment extends NamedDBElement
* Setters
****************************************************************************************************/
- /**
- * @param bool $show_in_table
- * @return self
- */
public function setShowInTable(bool $show_in_table): self
{
$this->show_in_table = $show_in_table;
@@ -369,7 +357,7 @@ abstract class Attachment extends NamedDBElement
/**
* Sets the element that is associated with this attachment.
- * @param AttachmentContainingDBElement $element
+ *
* @return $this
*/
public function setElement(AttachmentContainingDBElement $element): self
@@ -384,8 +372,10 @@ abstract class Attachment extends NamedDBElement
}
/**
- * Sets the filepath (with relative placeholder) for this attachment
- * @param string $path The new filepath of the attachment.
+ * Sets the filepath (with relative placeholder) for this attachment.
+ *
+ * @param string $path the new filepath of the attachment
+ *
* @return Attachment
*/
public function setPath(string $path): self
@@ -396,7 +386,6 @@ abstract class Attachment extends NamedDBElement
}
/**
- * @param AttachmentType $attachement_type
* @return $this
*/
public function setAttachmentType(AttachmentType $attachement_type): self
@@ -410,7 +399,6 @@ abstract class Attachment extends NamedDBElement
* Sets the url associated with this attachment.
* If the url is empty nothing is changed, to not override the file path.
*
- * @param string|null $url
* @return Attachment
*/
public function setURL(?string $url): self
@@ -438,7 +426,7 @@ abstract class Attachment extends NamedDBElement
*
* @param string $path The path that should be checked
*
- * @return bool True if the path is pointing to a builtin resource.
+ * @return bool true if the path is pointing to a builtin resource
*/
public static function checkIfBuiltin(string $path): bool
{
@@ -455,7 +443,7 @@ abstract class Attachment extends NamedDBElement
/**
* Check if a string is a URL and is valid.
*
- * @param $string string The string which should be checked.
+ * @param $string string The string which should be checked
* @param bool $path_required If true, the string must contain a path to be valid. (e.g. foo.bar would be invalid, foo.bar/test.php would be valid).
* @param $only_http bool Set this to true, if only HTTPS or HTTP schemata should be allowed.
* *Caution: When this is set to false, a attacker could use the file:// schema, to get internal server files, like /etc/passwd.*
diff --git a/src/Entity/Attachments/AttachmentContainingDBElement.php b/src/Entity/Attachments/AttachmentContainingDBElement.php
index de84f4ac..dbce1c92 100644
--- a/src/Entity/Attachments/AttachmentContainingDBElement.php
+++ b/src/Entity/Attachments/AttachmentContainingDBElement.php
@@ -85,7 +85,6 @@ abstract class AttachmentContainingDBElement extends NamedDBElement
/**
* Removes the given attachment from this element.
*
- * @param Attachment $attachment
* @return $this
*/
public function removeAttachment(Attachment $attachment): self
diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php
index 29fad44a..42156553 100644
--- a/src/Entity/Attachments/AttachmentType.php
+++ b/src/Entity/Attachments/AttachmentType.php
@@ -88,8 +88,6 @@ class AttachmentType extends StructuralDBElement
* Gets an filter, which file types are allowed for attachment files.
* Must be in the format of accept attribute
* (See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers).
- *
- * @return string
*/
public function getFiletypeFilter(): string
{
@@ -98,7 +96,9 @@ class AttachmentType extends StructuralDBElement
/**
* Sets the filetype filter pattern.
+ *
* @param string $filetype_filter The new filetype filter
+ *
* @return $this
*/
public function setFiletypeFilter(string $filetype_filter): self
diff --git a/src/Entity/Attachments/AttachmentTypeAttachment.php b/src/Entity/Attachments/AttachmentTypeAttachment.php
index b92a65fc..50d8e824 100644
--- a/src/Entity/Attachments/AttachmentTypeAttachment.php
+++ b/src/Entity/Attachments/AttachmentTypeAttachment.php
@@ -31,7 +31,7 @@ use Doctrine\ORM\Mapping as ORM;
class AttachmentTypeAttachment extends Attachment
{
/**
- * @var AttachmentType The element this attachment is associated with.
+ * @var AttachmentType the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\AttachmentType", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
diff --git a/src/Entity/Attachments/CategoryAttachment.php b/src/Entity/Attachments/CategoryAttachment.php
index cf46221a..a1451a78 100644
--- a/src/Entity/Attachments/CategoryAttachment.php
+++ b/src/Entity/Attachments/CategoryAttachment.php
@@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
class CategoryAttachment extends Attachment
{
/**
- * @var Category The element this attachment is associated with.
+ * @var Category the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Category", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
diff --git a/src/Entity/Attachments/CurrencyAttachment.php b/src/Entity/Attachments/CurrencyAttachment.php
index 6515bee2..f174d0a5 100644
--- a/src/Entity/Attachments/CurrencyAttachment.php
+++ b/src/Entity/Attachments/CurrencyAttachment.php
@@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
class CurrencyAttachment extends Attachment
{
/**
- * @var Currency The element this attachment is associated with.
+ * @var Currency the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
diff --git a/src/Entity/Attachments/DeviceAttachment.php b/src/Entity/Attachments/DeviceAttachment.php
index 29988fb5..9af9d7cd 100644
--- a/src/Entity/Attachments/DeviceAttachment.php
+++ b/src/Entity/Attachments/DeviceAttachment.php
@@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
class DeviceAttachment extends Attachment
{
/**
- * @var Device The element this attachment is associated with.
+ * @var Device the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Devices\Device", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
diff --git a/src/Entity/Attachments/FootprintAttachment.php b/src/Entity/Attachments/FootprintAttachment.php
index f8a37868..97cb4902 100644
--- a/src/Entity/Attachments/FootprintAttachment.php
+++ b/src/Entity/Attachments/FootprintAttachment.php
@@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
class FootprintAttachment extends Attachment
{
/**
- * @var Footprint The element this attachment is associated with.
+ * @var Footprint the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Footprint", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
diff --git a/src/Entity/Attachments/GroupAttachment.php b/src/Entity/Attachments/GroupAttachment.php
index ae32fc1e..580401b0 100644
--- a/src/Entity/Attachments/GroupAttachment.php
+++ b/src/Entity/Attachments/GroupAttachment.php
@@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
class GroupAttachment extends Attachment
{
/**
- * @var Group The element this attachment is associated with.
+ * @var Group the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\Group", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
diff --git a/src/Entity/Attachments/ManufacturerAttachment.php b/src/Entity/Attachments/ManufacturerAttachment.php
index 12322193..78d8f190 100644
--- a/src/Entity/Attachments/ManufacturerAttachment.php
+++ b/src/Entity/Attachments/ManufacturerAttachment.php
@@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
class ManufacturerAttachment extends Attachment
{
/**
- * @var Manufacturer The element this attachment is associated with.
+ * @var Manufacturer the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Manufacturer", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
diff --git a/src/Entity/Attachments/MeasurementUnitAttachment.php b/src/Entity/Attachments/MeasurementUnitAttachment.php
index bb5fba35..b1fda1e0 100644
--- a/src/Entity/Attachments/MeasurementUnitAttachment.php
+++ b/src/Entity/Attachments/MeasurementUnitAttachment.php
@@ -33,7 +33,7 @@ use Doctrine\ORM\Mapping as ORM;
class MeasurementUnitAttachment extends Attachment
{
/**
- * @var Manufacturer The element this attachment is associated with.
+ * @var Manufacturer the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\MeasurementUnit", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
diff --git a/src/Entity/Attachments/PartAttachment.php b/src/Entity/Attachments/PartAttachment.php
index 955f8dae..9e1b2d75 100644
--- a/src/Entity/Attachments/PartAttachment.php
+++ b/src/Entity/Attachments/PartAttachment.php
@@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
class PartAttachment extends Attachment
{
/**
- * @var Part The element this attachment is associated with.
+ * @var Part the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
diff --git a/src/Entity/Attachments/StorelocationAttachment.php b/src/Entity/Attachments/StorelocationAttachment.php
index 072e1b8c..d226f54b 100644
--- a/src/Entity/Attachments/StorelocationAttachment.php
+++ b/src/Entity/Attachments/StorelocationAttachment.php
@@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
class StorelocationAttachment extends Attachment
{
/**
- * @var Storelocation The element this attachment is associated with.
+ * @var Storelocation the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Storelocation", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
diff --git a/src/Entity/Attachments/SupplierAttachment.php b/src/Entity/Attachments/SupplierAttachment.php
index 986deedd..4cf48d77 100644
--- a/src/Entity/Attachments/SupplierAttachment.php
+++ b/src/Entity/Attachments/SupplierAttachment.php
@@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
class SupplierAttachment extends Attachment
{
/**
- * @var Supplier The element this attachment is associated with.
+ * @var Supplier the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
diff --git a/src/Entity/Attachments/UserAttachment.php b/src/Entity/Attachments/UserAttachment.php
index daa2b357..444e152c 100644
--- a/src/Entity/Attachments/UserAttachment.php
+++ b/src/Entity/Attachments/UserAttachment.php
@@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
class UserAttachment extends Attachment
{
/**
- * @var User The element this attachment is associated with.
+ * @var User the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
diff --git a/src/Entity/Base/Company.php b/src/Entity/Base/Company.php
index 8d093e87..6731c90f 100644
--- a/src/Entity/Base/Company.php
+++ b/src/Entity/Base/Company.php
@@ -173,8 +173,6 @@ abstract class Company extends PartsContainingDBElement
* Set the addres.
*
* @param string $new_address the new address (with "\n" as line break)
- *
- * @return self
*/
public function setAddress(string $new_address): self
{
@@ -187,8 +185,6 @@ abstract class Company extends PartsContainingDBElement
* Set the phone number.
*
* @param string $new_phone_number the new phone number
- *
- * @return self
*/
public function setPhoneNumber(string $new_phone_number): self
{
@@ -201,8 +197,6 @@ abstract class Company extends PartsContainingDBElement
* Set the fax number.
*
* @param string $new_fax_number the new fax number
- *
- * @return self
*/
public function setFaxNumber(string $new_fax_number): self
{
@@ -215,8 +209,6 @@ abstract class Company extends PartsContainingDBElement
* Set the e-mail address.
*
* @param string $new_email_address the new e-mail address
- *
- * @return self
*/
public function setEmailAddress(string $new_email_address): self
{
@@ -229,8 +221,6 @@ abstract class Company extends PartsContainingDBElement
* Set the website.
*
* @param string $new_website the new website
- *
- * @return self
*/
public function setWebsite(string $new_website): self
{
@@ -243,8 +233,6 @@ abstract class Company extends PartsContainingDBElement
* Set the link to the website of an article.
*
* @param string $new_url the new URL with the placeholder %PARTNUMBER% for the part number
- *
- * @return self
*/
public function setAutoProductUrl(string $new_url): self
{
diff --git a/src/Entity/Base/MasterAttachmentTrait.php b/src/Entity/Base/MasterAttachmentTrait.php
index c1a650a7..912a1567 100644
--- a/src/Entity/Base/MasterAttachmentTrait.php
+++ b/src/Entity/Base/MasterAttachmentTrait.php
@@ -51,7 +51,6 @@ trait MasterAttachmentTrait
/**
* Sets the new master picture for this part.
*
- * @param Attachment|null $new_master_attachment
* @return $this
*/
public function setMasterPictureAttachment(?Attachment $new_master_attachment)
diff --git a/src/Entity/Base/TimestampTrait.php b/src/Entity/Base/TimestampTrait.php
index 892f5e53..30e79455 100644
--- a/src/Entity/Base/TimestampTrait.php
+++ b/src/Entity/Base/TimestampTrait.php
@@ -29,14 +29,14 @@ use Symfony\Component\Serializer\Annotation\Groups;
trait TimestampTrait
{
/**
- * @var \DateTime The date when this element was modified the last time.
+ * @var \DateTime the date when this element was modified the last time
* @ORM\Column(type="datetime", name="last_modified", options={"default"="CURRENT_TIMESTAMP"})
* @Groups({"extended", "full"})
*/
protected $lastModified;
/**
- * @var \DateTime The date when this element was created.
+ * @var \DateTime the date when this element was created
* @ORM\Column(type="datetime", name="datetime_added", options={"default"="CURRENT_TIMESTAMP"})
* @Groups({"extended", "full"})
*/
@@ -46,7 +46,7 @@ trait TimestampTrait
* Returns the last time when the element was modified.
* Returns null if the element was not yet saved to DB yet.
*
- * @return \DateTime|null The time of the last edit.
+ * @return \DateTime|null the time of the last edit
*/
public function getLastModified(): ?\DateTime
{
@@ -57,7 +57,7 @@ trait TimestampTrait
* Returns the date/time when the element was created.
* Returns null if the element was not yet saved to DB yet.
*
- * @return \DateTime|null The creation time of the part.
+ * @return \DateTime|null the creation time of the part
*/
public function getAddedDate(): ?\DateTime
{
diff --git a/src/Entity/Devices/Device.php b/src/Entity/Devices/Device.php
index 5b9072e3..56cd360f 100644
--- a/src/Entity/Devices/Device.php
+++ b/src/Entity/Devices/Device.php
@@ -133,7 +133,8 @@ class Device extends PartsContainingDBElement
/**
* Set the order quantity.
*
- * @param int $new_order_quantity the new order quantity
+ * @param int $new_order_quantity the new order quantity
+ *
* @return $this
*/
public function setOrderQuantity(int $new_order_quantity): self
@@ -150,6 +151,7 @@ class Device extends PartsContainingDBElement
* Set the "order_only_missing_parts" attribute.
*
* @param bool $new_order_only_missing_parts the new "order_only_missing_parts" attribute
+ *
* @return Device
*/
public function setOrderOnlyMissingParts(bool $new_order_only_missing_parts): self
diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php
index 92e47d5c..aeab05bb 100644
--- a/src/Entity/Parts/Category.php
+++ b/src/Entity/Parts/Category.php
@@ -117,16 +117,12 @@ class Category extends PartsContainingDBElement
return 'C'.sprintf('%09d', $this->getID());
}
- /**
- * @return string
- */
public function getPartnameHint(): string
{
return $this->partname_hint;
}
/**
- * @param string $partname_hint
* @return Category
*/
public function setPartnameHint(string $partname_hint): self
@@ -136,16 +132,12 @@ class Category extends PartsContainingDBElement
return $this;
}
- /**
- * @return string
- */
public function getPartnameRegex(): string
{
return $this->partname_regex;
}
/**
- * @param string $partname_regex
* @return Category
*/
public function setPartnameRegex(string $partname_regex): self
@@ -155,16 +147,12 @@ class Category extends PartsContainingDBElement
return $this;
}
- /**
- * @return bool
- */
public function isDisableFootprints(): bool
{
return $this->disable_footprints;
}
/**
- * @param bool $disable_footprints
* @return Category
*/
public function setDisableFootprints(bool $disable_footprints): self
@@ -174,16 +162,12 @@ class Category extends PartsContainingDBElement
return $this;
}
- /**
- * @return bool
- */
public function isDisableManufacturers(): bool
{
return $this->disable_manufacturers;
}
/**
- * @param bool $disable_manufacturers
* @return Category
*/
public function setDisableManufacturers(bool $disable_manufacturers): self
@@ -193,16 +177,12 @@ class Category extends PartsContainingDBElement
return $this;
}
- /**
- * @return bool
- */
public function isDisableAutodatasheets(): bool
{
return $this->disable_autodatasheets;
}
/**
- * @param bool $disable_autodatasheets
* @return Category
*/
public function setDisableAutodatasheets(bool $disable_autodatasheets): self
@@ -212,16 +192,12 @@ class Category extends PartsContainingDBElement
return $this;
}
- /**
- * @return bool
- */
public function isDisableProperties(): bool
{
return $this->disable_properties;
}
/**
- * @param bool $disable_properties
* @return Category
*/
public function setDisableProperties(bool $disable_properties): self
@@ -231,16 +207,12 @@ class Category extends PartsContainingDBElement
return $this;
}
- /**
- * @return string
- */
public function getDefaultDescription(): string
{
return $this->default_description;
}
/**
- * @param string $default_description
* @return Category
*/
public function setDefaultDescription(string $default_description): self
@@ -250,16 +222,12 @@ class Category extends PartsContainingDBElement
return $this;
}
- /**
- * @return string
- */
public function getDefaultComment(): string
{
return $this->default_comment;
}
/**
- * @param string $default_comment
* @return Category
*/
public function setDefaultComment(string $default_comment): self
diff --git a/src/Entity/Parts/Footprint.php b/src/Entity/Parts/Footprint.php
index df299564..c508a832 100644
--- a/src/Entity/Parts/Footprint.php
+++ b/src/Entity/Parts/Footprint.php
@@ -110,8 +110,6 @@ class Footprint extends PartsContainingDBElement
/**
* Returns the 3D Model associated with this footprint.
- *
- * @return FootprintAttachment|null
*/
public function getFootprint3d(): ?FootprintAttachment
{
@@ -128,6 +126,7 @@ class Footprint extends PartsContainingDBElement
* Sets the 3D Model associated with this footprint.
*
* @param FootprintAttachment|null $new_attachment The new 3D Model
+ *
* @return Footprint
*/
public function setFootprint3d(?FootprintAttachment $new_attachment): self
diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php
index 60739ee5..deee884a 100644
--- a/src/Entity/Parts/MeasurementUnit.php
+++ b/src/Entity/Parts/MeasurementUnit.php
@@ -113,16 +113,12 @@ class MeasurementUnit extends PartsContainingDBElement
return $this;
}
- /**
- * @return bool
- */
public function isInteger(): bool
{
return $this->is_integer;
}
/**
- * @param bool $isInteger
* @return MeasurementUnit
*/
public function setIsInteger(bool $isInteger): self
@@ -132,16 +128,12 @@ class MeasurementUnit extends PartsContainingDBElement
return $this;
}
- /**
- * @return bool
- */
public function isUseSIPrefix(): bool
{
return $this->use_si_prefix;
}
/**
- * @param bool $usesSIPrefixes
* @return MeasurementUnit
*/
public function setUseSIPrefix(bool $usesSIPrefixes): self
diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php
index 7d7e74aa..46a7ab5b 100644
--- a/src/Entity/Parts/Part.php
+++ b/src/Entity/Parts/Part.php
@@ -92,7 +92,7 @@ class Part extends AttachmentContainingDBElement
protected $addedDate;
/**
- * @var \DateTime The date when this element was modified the last time.
+ * @var \DateTime the date when this element was modified the last time
* @ColumnSecurity(type="datetime")
* @ORM\Column(type="datetime", name="last_modified", options={"default"="CURRENT_TIMESTAMP"})
*/
diff --git a/src/Entity/Parts/PartLot.php b/src/Entity/Parts/PartLot.php
index e4140cae..0e9f282c 100644
--- a/src/Entity/Parts/PartLot.php
+++ b/src/Entity/Parts/PartLot.php
@@ -112,6 +112,7 @@ class PartLot extends DBElement
* This is the case, if the expiration date is greater the the current date.
*
* @return bool|null True, if the part lot is expired. Returns null, if no expiration date was set.
+ *
* @throws \Exception If an error with the DateTime occurs
*/
public function isExpired(): ?bool
@@ -137,7 +138,6 @@ class PartLot extends DBElement
/**
* Sets the description of the part lot.
*
- * @param string $description
* @return PartLot
*/
public function setDescription(string $description): self
@@ -160,7 +160,6 @@ class PartLot extends DBElement
/**
* Sets the comment for this part lot.
*
- * @param string $comment
* @return PartLot
*/
public function setComment(string $comment): self
@@ -207,7 +206,6 @@ class PartLot extends DBElement
/**
* Sets the storage location, where this part lot is stored.
*
- * @param Storelocation|null $storage_location
* @return PartLot
*/
public function setStorageLocation(?Storelocation $storage_location): self
@@ -254,7 +252,6 @@ class PartLot extends DBElement
/**
* Set the unknown instock status of this part lot.
*
- * @param bool $instock_unknown
* @return PartLot
*/
public function setInstockUnknown(bool $instock_unknown): self
@@ -292,7 +289,6 @@ class PartLot extends DBElement
}
/**
- * @param bool $needs_refill
* @return PartLot
*/
public function setNeedsRefill(bool $needs_refill): self
diff --git a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php
index 6d3ecd18..870dbaa2 100644
--- a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php
+++ b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php
@@ -37,14 +37,14 @@ trait AdvancedPropertyTrait
protected $needs_review = false;
/**
- * @var string A comma separated list of tags, associated with the part.
+ * @var string a comma separated list of tags, associated with the part
* @ORM\Column(type="text")
* @ColumnSecurity(type="string", prefix="tags", placeholder="")
*/
protected $tags = '';
/**
- * @var float|null How much a single part unit weighs in grams.
+ * @var float|null how much a single part unit weighs in grams
* @ORM\Column(type="float", nullable=true)
* @ColumnSecurity(type="float", placeholder=null)
* @Assert\PositiveOrZero()
@@ -53,8 +53,6 @@ trait AdvancedPropertyTrait
/**
* Checks if this part is marked, for that it needs further review.
- *
- * @return bool
*/
public function isNeedsReview(): bool
{
@@ -63,7 +61,9 @@ trait AdvancedPropertyTrait
/**
* Sets the "needs review" status of this part.
+ *
* @param bool $needs_review The new status
+ *
* @return Part|self
*/
public function setNeedsReview(bool $needs_review): self
@@ -75,8 +75,6 @@ trait AdvancedPropertyTrait
/**
* Gets a comma separated list, of tags, that are assigned to this part.
- *
- * @return string
*/
public function getTags(): string
{
@@ -87,7 +85,6 @@ trait AdvancedPropertyTrait
* Sets a comma separated list of tags, that are assigned to this part.
*
* @param string $tags The new tags
- * @return self
*/
public function setTags(string $tags): self
{
@@ -99,8 +96,6 @@ trait AdvancedPropertyTrait
/**
* Returns the mass of a single part unit.
* Returns null, if the mass is unknown/not set yet.
- *
- * @return float|null
*/
public function getMass(): ?float
{
@@ -111,8 +106,7 @@ trait AdvancedPropertyTrait
* Sets the mass of a single part unit.
* Sett to null, if the mass is unknown.
*
- * @param float|null $mass The new mass.
- * @return self
+ * @param float|null $mass the new mass
*/
public function setMass(?float $mass): self
{
diff --git a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php
index 56064e14..e9e6530a 100644
--- a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php
+++ b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php
@@ -49,7 +49,7 @@ trait BasicPropertyTrait
protected $visible = true;
/**
- * @var bool True, if the part is marked as favorite.
+ * @var bool true, if the part is marked as favorite
* @ORM\Column(type="boolean")
* @ColumnSecurity(type="boolean")
*/
@@ -111,7 +111,7 @@ trait BasicPropertyTrait
* Check if this part is a favorite.
*
* @return bool * true if this part is a favorite
- * * false if this part is not a favorite.
+ * * false if this part is not a favorite
*/
public function isFavorite(): bool
{
@@ -143,8 +143,6 @@ trait BasicPropertyTrait
* Sets the description of this part.
*
* @param string $new_description the new description
- *
- * @return self
*/
public function setDescription(?string $new_description): self
{
@@ -157,8 +155,6 @@ trait BasicPropertyTrait
* Sets the comment property of this part.
*
* @param string $new_comment the new comment
- *
- * @return self
*/
public function setComment(string $new_comment): self
{
@@ -172,8 +168,6 @@ trait BasicPropertyTrait
* The category property is required for every part, so you can not pass null like the other properties (footprints).
*
* @param Category $category The new category of this part
- *
- * @return self
*/
public function setCategory(Category $category): self
{
@@ -187,8 +181,6 @@ trait BasicPropertyTrait
*
* @param Footprint|null $new_footprint The new footprint of this part. Set to null, if this part should not have
* a footprint.
- *
- * @return self
*/
public function setFootprint(?Footprint $new_footprint): self
{
@@ -202,8 +194,6 @@ trait BasicPropertyTrait
*
* @param $new_favorite_status bool The new favorite status, that should be applied on this part.
* Set this to true, when the part should be a favorite.
- *
- * @return self
*/
public function setFavorite(bool $new_favorite_status): self
{
diff --git a/src/Entity/Parts/PartTraits/InstockTrait.php b/src/Entity/Parts/PartTraits/InstockTrait.php
index f2ff68bf..b5ce4843 100644
--- a/src/Entity/Parts/PartTraits/InstockTrait.php
+++ b/src/Entity/Parts/PartTraits/InstockTrait.php
@@ -49,7 +49,7 @@ trait InstockTrait
protected $minamount = 0;
/**
- * @var ?MeasurementUnit The unit in which the part's amount is measured.
+ * @var ?MeasurementUnit the unit in which the part's amount is measured
* @ORM\ManyToOne(targetEntity="MeasurementUnit", inversedBy="parts")
* @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true)
* @ColumnSecurity(type="object", prefix="unit")
@@ -69,9 +69,6 @@ trait InstockTrait
/**
* Adds the given part lot, to the list of part lots.
* The part lot is assigned to this part.
- *
- * @param PartLot $lot
- * @return self
*/
public function addPartLot(PartLot $lot): self
{
@@ -84,9 +81,7 @@ trait InstockTrait
/**
* Removes the given part lot from the list of part lots.
*
- * @param PartLot $lot The part lot that should be deleted.
- *
- * @return self
+ * @param PartLot $lot the part lot that should be deleted
*/
public function removePartLot(PartLot $lot): self
{
@@ -98,8 +93,6 @@ trait InstockTrait
/**
* Gets the measurement unit in which the part's amount should be measured.
* Returns null if no specific unit was that. That means the parts are measured simply in quantity numbers.
- *
- * @return MeasurementUnit|null
*/
public function getPartUnit(): ?MeasurementUnit
{
@@ -109,9 +102,6 @@ trait InstockTrait
/**
* Sets the measurement unit in which the part's amount should be measured.
* Set to null, if the part should be measured in quantities.
- *
- * @param MeasurementUnit|null $partUnit
- * @return self
*/
public function setPartUnit(?MeasurementUnit $partUnit): self
{
@@ -182,8 +172,6 @@ trait InstockTrait
* See getPartUnit() for the associated unit.
*
* @param float $new_minamount the new count of parts which should be in stock at least
- *
- * @return self
*/
public function setMinAmount(float $new_minamount): self
{
diff --git a/src/Entity/Parts/PartTraits/ManufacturerTrait.php b/src/Entity/Parts/PartTraits/ManufacturerTrait.php
index a31c4481..a59a01d7 100644
--- a/src/Entity/Parts/PartTraits/ManufacturerTrait.php
+++ b/src/Entity/Parts/PartTraits/ManufacturerTrait.php
@@ -41,7 +41,7 @@ trait ManufacturerTrait
protected $manufacturer;
/**
- * @var string The url to the part on the manufacturer's homepage.
+ * @var string the url to the part on the manufacturer's homepage
* @ORM\Column(type="string")
* @Assert\Url()
* @ColumnSecurity(prefix="mpn", type="string", placeholder="")
@@ -86,7 +86,7 @@ trait ManufacturerTrait
/**
* Similar to getManufacturerProductUrl, but here only the database value is returned.
*
- * @return string The manufacturer url saved in DB for this part.
+ * @return string the manufacturer url saved in DB for this part
*/
public function getCustomProductURL(): string
{
@@ -115,7 +115,6 @@ trait ManufacturerTrait
* Sets the manufacturing status for this part
* See getManufacturingStatus() for valid values.
*
- * @param string $manufacturing_status
* @return Part
*/
public function setManufacturingStatus(string $manufacturing_status): self
@@ -137,8 +136,6 @@ trait ManufacturerTrait
/**
* Returns the assigned manufacturer product number (MPN) for this part.
- *
- * @return string
*/
public function getManufacturerProductNumber(): string
{
@@ -148,7 +145,6 @@ trait ManufacturerTrait
/**
* Sets the manufacturer product number (MPN) for this part.
*
- * @param string $manufacturer_product_number
* @return Part
*/
public function setManufacturerProductNumber(string $manufacturer_product_number): self
@@ -163,8 +159,6 @@ trait ManufacturerTrait
* Set to "" if this part should use the automatically URL based on its manufacturer.
*
* @param string $new_url The new url
- *
- * @return self
*/
public function setManufacturerProductURL(string $new_url): self
{
@@ -178,8 +172,6 @@ trait ManufacturerTrait
*
* @param Manufacturer|null $new_manufacturer The new Manufacturer of this part. Set to null, if this part should
* not have a manufacturer.
- *
- * @return self
*/
public function setManufacturer(?Manufacturer $new_manufacturer): self
{
diff --git a/src/Entity/Parts/PartTraits/OrderTrait.php b/src/Entity/Parts/PartTraits/OrderTrait.php
index de791426..742adc1e 100644
--- a/src/Entity/Parts/PartTraits/OrderTrait.php
+++ b/src/Entity/Parts/PartTraits/OrderTrait.php
@@ -31,7 +31,7 @@ use Doctrine\Common\Collections\Collection;
trait OrderTrait
{
/**
- * @var Orderdetail[]|Collection The details about how and where you can order this part.
+ * @var Orderdetail[]|Collection the details about how and where you can order this part
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid()
* @ColumnSecurity(prefix="orderdetails", type="collection")
@@ -121,9 +121,7 @@ trait OrderTrait
* Adds the given orderdetail to list of orderdetails.
* The orderdetail is assigned to this part.
*
- * @param Orderdetail $orderdetail The orderdetail that should be added.
- *
- * @return self
+ * @param Orderdetail $orderdetail the orderdetail that should be added
*/
public function addOrderdetail(Orderdetail $orderdetail): self
{
@@ -136,7 +134,6 @@ trait OrderTrait
/**
* Removes the given orderdetail from the list of orderdetails.
*
- * @param Orderdetail $orderdetail
* @return OrderTrait
*/
public function removeOrderdetail(Orderdetail $orderdetail): self
@@ -157,8 +154,6 @@ trait OrderTrait
* (if the part has exactly one orderdetails,
* set this orderdetails as order orderdetails.
* Otherwise, set "no order orderdetails")
- *
- * @return self
*/
public function setManualOrder(bool $new_manual_order, int $new_order_quantity = 1, ?Orderdetail $new_order_orderdetail = null): self
{
diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php
index af930a0a..224aeaad 100644
--- a/src/Entity/Parts/Storelocation.php
+++ b/src/Entity/Parts/Storelocation.php
@@ -145,7 +145,6 @@ class Storelocation extends PartsContainingDBElement
}
/**
- * @param bool $only_single_part
* @return Storelocation
*/
public function setOnlySinglePart(bool $only_single_part): self
@@ -166,7 +165,6 @@ class Storelocation extends PartsContainingDBElement
}
/**
- * @param bool $limit_to_existing_parts
* @return Storelocation
*/
public function setLimitToExistingParts(bool $limit_to_existing_parts): self
@@ -185,7 +183,6 @@ class Storelocation extends PartsContainingDBElement
}
/**
- * @param MeasurementUnit|null $storage_type
* @return Storelocation
*/
public function setStorageType(?MeasurementUnit $storage_type): self
diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php
index 707d217b..1475e007 100644
--- a/src/Entity/Parts/Supplier.php
+++ b/src/Entity/Parts/Supplier.php
@@ -127,7 +127,6 @@ class Supplier extends Company
/**
* Sets the default currency.
*
- * @param Currency|null $default_currency
* @return Supplier
*/
public function setDefaultCurrency(?Currency $default_currency): self
@@ -151,6 +150,7 @@ class Supplier extends Company
* Sets the shipping costs for an order with this supplier.
*
* @param string|null $shipping_costs a bcmath string with the shipping costs
+ *
* @return Supplier
*/
public function setShippingCosts(?string $shipping_costs): self
diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php
index f44ee748..2aa0bf7b 100644
--- a/src/Entity/PriceInformations/Currency.php
+++ b/src/Entity/PriceInformations/Currency.php
@@ -46,7 +46,7 @@ class Currency extends StructuralDBElement
protected $attachments;
/**
- * @var string The 3 letter ISO code of the currency.
+ * @var string the 3 letter ISO code of the currency
* @ORM\Column(type="string")
* @Assert\Currency()
*/
@@ -95,8 +95,6 @@ class Currency extends StructuralDBElement
/**
* Returns the inverse exchange rate (how many of the current currency the base unit is worth).
- *
- * @return string|null
*/
public function getInverseExchangeRate(): ?string
{
@@ -112,8 +110,6 @@ class Currency extends StructuralDBElement
/**
* Returns The exchange rate between this currency and the base currency
* (how many base units the current currency is worth).
- *
- * @return string|null
*/
public function getExchangeRate(): ?string
{
@@ -122,8 +118,10 @@ class Currency extends StructuralDBElement
/**
* Sets the exchange rate of the currency.
+ *
* @param string|null $exchange_rate The new exchange rate of the currency.
- * Set to null, if the exchange rate is unknown.
+ * Set to null, if the exchange rate is unknown.
+ *
* @return Currency
*/
public function setExchangeRate(?string $exchange_rate): self
diff --git a/src/Entity/PriceInformations/Orderdetail.php b/src/Entity/PriceInformations/Orderdetail.php
index c2a5edd7..3ba623b3 100644
--- a/src/Entity/PriceInformations/Orderdetail.php
+++ b/src/Entity/PriceInformations/Orderdetail.php
@@ -157,7 +157,7 @@ class Orderdetail extends DBElement
/**
* Get the supplier part-nr.
*
- * @return string the part-nr.
+ * @return string the part-nr
*/
public function getSupplierPartNr(): string
{
@@ -228,7 +228,6 @@ class Orderdetail extends DBElement
/**
* Removes an pricedetail from this orderdetail.
*
- * @param Pricedetail $pricedetail
* @return Orderdetail
*/
public function removePricedetail(Pricedetail $pricedetail): self
@@ -276,7 +275,6 @@ class Orderdetail extends DBElement
/**
* Sets a new part with which this orderdetail is associated.
*
- * @param Part $part
* @return Orderdetail
*/
public function setPart(Part $part): self
@@ -289,7 +287,6 @@ class Orderdetail extends DBElement
/**
* Sets the new supplier associated with this orderdetail.
*
- * @param Supplier $new_supplier
* @return Orderdetail
*/
public function setSupplier(Supplier $new_supplier): self
@@ -333,7 +330,7 @@ class Orderdetail extends DBElement
* Sets the custom product supplier URL for this order detail.
* Set this to "", if the function getSupplierProductURL should return the automatic generated URL.
*
- * @param $new_url string The new URL for the supplier URL.
+ * @param $new_url string The new URL for the supplier URL
*
* @return Orderdetail
*/
diff --git a/src/Entity/PriceInformations/Pricedetail.php b/src/Entity/PriceInformations/Pricedetail.php
index f01fa20a..328ce2ff 100644
--- a/src/Entity/PriceInformations/Pricedetail.php
+++ b/src/Entity/PriceInformations/Pricedetail.php
@@ -130,7 +130,7 @@ class Pricedetail extends DBElement
/**
* Get the orderdetail to which this pricedetail belongs to this pricedetails.
*
- * @return Orderdetail The orderdetail this price belongs to.
+ * @return Orderdetail the orderdetail this price belongs to
*/
public function getOrderdetail(): Orderdetail
{
@@ -141,7 +141,7 @@ class Pricedetail extends DBElement
* Returns the price associated with this pricedetail.
* It is given in current currency and for the price related quantity.
*
- * @return string The price as string, like returned raw from DB.
+ * @return string the price as string, like returned raw from DB
*/
public function getPrice(): string
{
@@ -215,8 +215,6 @@ class Pricedetail extends DBElement
/**
* Returns the currency associated with this price information.
* Returns null, if no specific currency is selected and the global base currency should be assumed.
- *
- * @return Currency|null
*/
public function getCurrency(): ?Currency
{
@@ -232,7 +230,6 @@ class Pricedetail extends DBElement
/**
* Sets the orderdetail to which this pricedetail belongs to.
*
- * @param Orderdetail $orderdetail
* @return $this
*/
public function setOrderdetail(Orderdetail $orderdetail): self
@@ -246,7 +243,6 @@ class Pricedetail extends DBElement
* Sets the currency associated with the price informations.
* Set to null, to use the global base currency.
*
- * @param Currency|null $currency
* @return Pricedetail
*/
public function setCurrency(?Currency $currency): self
@@ -264,8 +260,6 @@ class Pricedetail extends DBElement
* * This is the price for "price_related_quantity" parts!!
* * Example: if "price_related_quantity" is '10',
* you have to set here the price for 10 parts!
- *
- * @return self
*/
public function setPrice(string $new_price): self
{
@@ -286,8 +280,6 @@ class Pricedetail extends DBElement
* quantity to 100. The single price (20$/100 = 0.2$) will be calculated automatically.
*
* @param float $new_price_related_quantity the price related quantity
- *
- * @return self
*/
public function setPriceRelatedQuantity(float $new_price_related_quantity): self
{
@@ -312,8 +304,6 @@ class Pricedetail extends DBElement
* So the orderdetails would have three Pricedetails for one supplier.)
*
* @param float $new_min_discount_quantity the minimum discount quantity
- *
- * @return self
*/
public function setMinDiscountQuantity(float $new_min_discount_quantity): self
{
diff --git a/src/Entity/UserSystem/Group.php b/src/Entity/UserSystem/Group.php
index 259623ef..879d0ab9 100644
--- a/src/Entity/UserSystem/Group.php
+++ b/src/Entity/UserSystem/Group.php
@@ -78,6 +78,7 @@ class Group extends StructuralDBElement implements HasPermissionsInterface
/**
* Check if the users of this group are enforced to have two factor authentification (2FA) enabled.
+ *
* @return bool
*/
public function isEnforce2FA(): bool
@@ -87,17 +88,18 @@ class Group extends StructuralDBElement implements HasPermissionsInterface
/**
* Sets if the user of this group are enforced to have two factor authentification enabled.
+ *
* @param bool $enforce2FA True, if the users of this group are enforced to have 2FA enabled.
+ *
* @return $this
*/
- public function setEnforce2FA(bool $enforce2FA): Group
+ public function setEnforce2FA(bool $enforce2FA): self
{
$this->enforce2FA = $enforce2FA;
+
return $this;
}
-
-
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.
diff --git a/src/Entity/UserSystem/U2FKey.php b/src/Entity/UserSystem/U2FKey.php
index 9b5c2d0e..dff64e20 100644
--- a/src/Entity/UserSystem/U2FKey.php
+++ b/src/Entity/UserSystem/U2FKey.php
@@ -21,7 +21,6 @@
namespace App\Entity\UserSystem;
-
use App\Entity\Base\TimestampTrait;
use Doctrine\ORM\Mapping as ORM;
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface;
@@ -48,41 +47,46 @@ class U2FKey implements TwoFactorKeyInterface
/**
* @ORM\Column(type="string", length=64)
+ *
* @var string
**/
public $keyHandle;
/**
* @ORM\Column(type="string")
+ *
* @var string
**/
public $publicKey;
/**
* @ORM\Column(type="text")
+ *
* @var string
**/
public $certificate;
/**
* @ORM\Column(type="string")
+ *
* @var int
**/
public $counter;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="u2fKeys")
+ *
* @var User
**/
protected $user;
/**
* @ORM\Column(type="string")
+ *
* @var string
**/
protected $name;
-
public function fromRegistrationData(Registration $data): void
{
$this->keyHandle = $data->keyHandle;
@@ -91,62 +95,61 @@ class U2FKey implements TwoFactorKeyInterface
$this->counter = $data->counter;
}
- /** @inheritDoc */
+ /** {@inheritdoc} */
public function getKeyHandle()
{
return $this->keyHandle;
}
- /** @inheritDoc */
+ /** {@inheritdoc} */
public function setKeyHandle($keyHandle)
{
$this->keyHandle = $keyHandle;
}
- /** @inheritDoc */
+ /** {@inheritdoc} */
public function getPublicKey()
{
return $this->publicKey;
}
- /** @inheritDoc */
+ /** {@inheritdoc} */
public function setPublicKey($publicKey)
{
$this->publicKey = $publicKey;
}
- /** @inheritDoc */
+ /** {@inheritdoc} */
public function getCertificate()
{
return $this->certificate;
}
-
- /** @inheritDoc */
+ /** {@inheritdoc} */
public function setCertificate($certificate)
{
$this->certificate = $certificate;
}
- /** @inheritDoc */
+ /** {@inheritdoc} */
public function getCounter()
{
return $this->counter;
}
- /** @inheritDoc */
+ /** {@inheritdoc} */
public function setCounter($counter)
{
$this->counter = $counter;
}
- /** @inheritDoc */
+ /** {@inheritdoc} */
public function getName()
{
return $this->name;
}
- /** @inheritDoc */
+ /** {@inheritdoc} */
public function setName($name)
{
$this->name = $name;
@@ -154,30 +157,33 @@ class U2FKey implements TwoFactorKeyInterface
/**
* Gets the user, this U2F key belongs to.
+ *
* @return User
*/
- public function getUser() : User
+ public function getUser(): User
{
return $this->user;
}
/**
- * The primary key ID of this key
+ * The primary key ID of this key.
+ *
* @return int
*/
- public function getID() : int
+ public function getID(): int
{
return $this->id;
}
/**
* Sets the user this U2F key belongs to.
- * @param TwoFactorInterface $new_user
+ *
* @return $this
*/
- public function setUser(TwoFactorInterface $new_user) : self
+ public function setUser(TwoFactorInterface $new_user): self
{
$this->user = $new_user;
+
return $this;
}
-}
\ No newline at end of file
+}
diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php
index 84b516bf..196aa4d0 100644
--- a/src/Entity/UserSystem/User.php
+++ b/src/Entity/UserSystem/User.php
@@ -62,6 +62,7 @@ use App\Validator\Constraints\ValidPermission;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
+use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface as U2FTwoFactorInterface;
use R\U2FTwoFactorBundle\Model\U2F\TwoFactorKeyInterface;
use Scheb\TwoFactorBundle\Model\BackupCodeInterface;
use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface;
@@ -70,7 +71,6 @@ use Scheb\TwoFactorBundle\Model\TrustedDeviceInterface;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
-use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface as U2FTwoFactorInterface;
/**
* This entity represents a user, which can log in and have permissions.
@@ -80,8 +80,7 @@ use R\U2FTwoFactorBundle\Model\U2F\TwoFactorInterface as U2FTwoFactorInterface;
* @ORM\Table("`users`")
* @UniqueEntity("name", message="validator.user.username_already_used")
*/
-class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface,
- TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, U2FTwoFactorInterface, PreferredProviderInterface
+class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, U2FTwoFactorInterface, PreferredProviderInterface
{
use MasterAttachmentTrait;
@@ -205,8 +204,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
protected $trustedDeviceCookieVersion = 0;
/** @var Collection
- * @ORM\OneToMany(targetEntity="App\Entity\UserSystem\U2FKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true)
- */
+ * @ORM\OneToMany(targetEntity="App\Entity\UserSystem\U2FKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true)
+ */
protected $u2fKeys;
/**
@@ -319,7 +318,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Sets the password hash for this user.
*
- * @param string $password
* @return User
*/
public function setPassword(string $password): self
@@ -359,7 +357,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Sets the currency the users prefers to see prices in.
*
- * @param Currency|null $currency
* @return User
*/
public function setCurrency(?Currency $currency): self
@@ -422,7 +419,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Set the status, if the user needs a password change.
*
- * @param bool $need_pw_change
* @return User
*/
public function setNeedPwChange(bool $need_pw_change): self
@@ -433,7 +429,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
}
/**
- * Returns the encrypted password reset token
+ * Returns the encrypted password reset token.
+ *
* @return string|null
*/
public function getPwResetToken(): ?string
@@ -442,18 +439,20 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
}
/**
- * Sets the encrypted password reset token
- * @param string|null $pw_reset_token
+ * Sets the encrypted password reset token.
+ *
* @return User
*/
- public function setPwResetToken(?string $pw_reset_token): User
+ public function setPwResetToken(?string $pw_reset_token): self
{
$this->pw_reset_token = $pw_reset_token;
+
return $this;
}
/**
- * Gets the datetime when the password reset token expires
+ * Gets the datetime when the password reset token expires.
+ *
* @return \DateTime
*/
public function getPwResetExpires(): \DateTime
@@ -462,18 +461,17 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
}
/**
- * Sets the datetime when the password reset token expires
- * @param \DateTime $pw_reset_expires
+ * Sets the datetime when the password reset token expires.
+ *
* @return User
*/
- public function setPwResetExpires(\DateTime $pw_reset_expires): User
+ public function setPwResetExpires(\DateTime $pw_reset_expires): self
{
$this->pw_reset_expires = $pw_reset_expires;
+
return $this;
}
-
-
/************************************************
* Getters
************************************************/
@@ -496,8 +494,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
}
/**
- * Change the username of this user
+ * Change the username of this user.
+ *
* @param string $new_name The new username.
+ *
* @return $this
*/
public function setName(string $new_name): NamedDBElement
@@ -512,6 +512,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Get the first name of the user.
+ *
* @return string|null
*/
public function getFirstName(): ?string
@@ -520,7 +521,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
}
/**
- * Change the first name of the user
+ * Change the first name of the user.
+ *
* @param string $first_name The new first name
*
* @return $this
@@ -533,7 +535,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
}
/**
- * Get the last name of the user
+ * Get the last name of the user.
+ *
* @return string|null
*/
public function getLastName(): ?string
@@ -542,7 +545,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
}
/**
- * Change the last name of the user
+ * Change the last name of the user.
+ *
* @param string $last_name The new last name
*
* @return $this
@@ -555,7 +559,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
}
/**
- * Gets the department of this user
+ * Gets the department of this user.
+ *
* @return string
*/
public function getDepartment(): ?string
@@ -564,8 +569,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
}
/**
- * Change the department of the user
+ * Change the department of the user.
+ *
* @param string $department The new department
+ *
* @return User
*/
public function setDepartment(?string $department): self
@@ -577,6 +584,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Get the email of the user.
+ *
* @return string
*/
public function getEmail(): ?string
@@ -585,8 +593,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
}
/**
- * Change the email of the user
+ * Change the email of the user.
+ *
* @param string $email The new email adress
+ *
* @return $this
*/
public function setEmail(?string $email): self
@@ -598,8 +608,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Gets the language the user prefers (as 2 letter ISO code).
+ *
* @return string|null The 2 letter ISO code of the preferred language (e.g. 'en' or 'de').
- * If null is returned, the user has not specified a language and the server wide language should be used.
+ * If null is returned, the user has not specified a language and the server wide language should be used.
*/
public function getLanguage(): ?string
{
@@ -608,20 +619,24 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Change the language the user prefers.
+ *
* @param string|null $language The new language as 2 letter ISO code (e.g. 'en' or 'de').
- * Set to null, to use the system wide language.
+ * Set to null, to use the system wide language.
+ *
* @return User
*/
public function setLanguage(?string $language): self
{
$this->language = $language;
+
return $this;
}
/**
- * Gets the timezone of the user
+ * Gets the timezone of the user.
+ *
* @return string|null The timezone of the user (e.g. 'Europe/Berlin') or null if the user has not specified
- * a timezone (then the global one should be used)
+ * a timezone (then the global one should be used)
*/
public function getTimezone(): ?string
{
@@ -630,7 +645,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Change the timezone of this user.
+ *
* @param string $timezone|null The new timezone (e.g. 'Europe/Berlin') or null to use the system wide one.
+ *
* @return $this
*/
public function setTimezone(?string $timezone): self
@@ -642,6 +659,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Gets the theme the users wants to see. See self::AVAILABLE_THEMES for valid values.
+ *
* @return string|null The name of the theme the user wants to see, or null if the system wide should be used.
*/
public function getTheme(): ?string
@@ -651,8 +669,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Change the theme the user wants to see.
+ *
* @param string|null $theme The name of the theme (See See self::AVAILABLE_THEMES for valid values). Set to null
- * if the system wide theme should be used.
+ * if the system wide theme should be used.
+ *
* @return $this
*/
public function setTheme(?string $theme): self
@@ -664,6 +684,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Gets the group to which this user belongs to.
+ *
* @return Group|null The group of this user. Null if this user does not have a group.
*/
public function getGroup(): ?Group
@@ -673,7 +694,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Sets the group of this user.
+ *
* @param Group|null $group The new group of this user. Set to null if this user should not have a group.
+ *
* @return $this
*/
public function setGroup(?Group $group): self
@@ -685,12 +708,14 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Returns a string representation of this user (the full name).
- * E.g. 'Jane Doe (j.doe) [DISABLED]
+ * E.g. 'Jane Doe (j.doe) [DISABLED].
+ *
* @return string
*/
public function __toString()
{
$tmp = $this->isDisabled() ? ' [DISABLED]' : '';
+
return $this->getFullName(true).$tmp;
}
@@ -706,6 +731,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Return the user name that should be shown in Google Authenticator.
+ *
* @return string
*/
public function getGoogleAuthenticatorUsername(): string
@@ -726,12 +752,13 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Sets the secret used for Google Authenticator. Set to null to disable Google Authenticator.
- * @param string|null $googleAuthenticatorSecret
+ *
* @return $this
*/
public function setGoogleAuthenticatorSecret(?string $googleAuthenticatorSecret): self
{
$this->googleAuthenticatorSecret = $googleAuthenticatorSecret;
+
return $this;
}
@@ -739,11 +766,12 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* Check if the given code is a valid backup code.
*
* @param string $code The code that should be checked.
+ *
* @return bool True if the backup code is valid.
*/
public function isBackupCode(string $code): bool
{
- return in_array($code, $this->backupCodes);
+ return \in_array($code, $this->backupCodes);
}
/**
@@ -754,48 +782,55 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
public function invalidateBackupCode(string $code): void
{
$key = array_search($code, $this->backupCodes);
- if ($key !== false){
+ if (false !== $key) {
unset($this->backupCodes[$key]);
}
}
/**
- * Returns the list of all valid backup codes
+ * Returns the list of all valid backup codes.
+ *
* @return string[] An array with all backup codes
*/
- public function getBackupCodes() : array
+ public function getBackupCodes(): array
{
return $this->backupCodes ?? [];
}
/**
* Set the backup codes for this user. Existing backup codes are overridden.
- * @param string[] $codes An array containing the backup codes
+ *
+ * @param string[] $codes An array containing the backup codes
+ *
* @return $this
+ *
* @throws \Exception If an error with the datetime occurs
*/
- public function setBackupCodes(array $codes) : self
+ public function setBackupCodes(array $codes): self
{
$this->backupCodes = $codes;
- if(empty($codes)) {
+ if (empty($codes)) {
$this->backupCodesGenerationDate = null;
} else {
$this->backupCodesGenerationDate = new \DateTime();
}
+
return $this;
}
/**
* Return the date when the backup codes were generated.
+ *
* @return \DateTime|null
*/
- public function getBackupCodesGenerationDate() : ?\DateTime
+ public function getBackupCodesGenerationDate(): ?\DateTime
{
return $this->backupCodesGenerationDate;
}
/**
* Return version for the trusted device token. Increase version to invalidate all trusted token of the user.
+ *
* @return int The version of trusted device token
*/
public function getTrustedTokenVersion(): int
@@ -807,22 +842,24 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* Invalidate all trusted device tokens at once, by incrementing the token version.
* You have to flush the changes to database afterwards.
*/
- public function invalidateTrustedDeviceTokens() : void
+ public function invalidateTrustedDeviceTokens(): void
{
- $this->trustedDeviceCookieVersion++;
+ ++$this->trustedDeviceCookieVersion;
}
/**
- * Check if U2F is enabled
+ * Check if U2F is enabled.
+ *
* @return bool
*/
public function isU2FAuthEnabled(): bool
{
- return count($this->u2fKeys) > 0;
+ return \count($this->u2fKeys) > 0;
}
/**
- * Get all U2F Keys that are associated with this user
+ * Get all U2F Keys that are associated with this user.
+ *
* @return Collection
*/
public function getU2FKeys(): Collection
@@ -832,7 +869,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Add a U2F key to this user.
- * @param TwoFactorKeyInterface $key
*/
public function addU2FKey(TwoFactorKeyInterface $key): void
{
@@ -841,7 +877,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Remove a U2F key from this user.
- * @param TwoFactorKeyInterface $key
*/
public function removeU2FKey(TwoFactorKeyInterface $key): void
{
@@ -849,12 +884,12 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
}
/**
- * @inheritDoc
+ * {@inheritdoc}
*/
public function getPreferredTwoFactorProvider(): ?string
{
//If U2F is available then prefer it
- if($this->isU2FAuthEnabled()) {
+ if ($this->isU2FAuthEnabled()) {
return 'u2f_two_factor';
}
diff --git a/src/EventSubscriber/MailFromListener.php b/src/EventSubscriber/MailFromListener.php
index dfd54550..7e6a400e 100644
--- a/src/EventSubscriber/MailFromListener.php
+++ b/src/EventSubscriber/MailFromListener.php
@@ -21,7 +21,6 @@
namespace App\EventSubscriber;
-
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Mailer\Event\MessageEvent;
use Symfony\Component\Mime\Address;
@@ -34,7 +33,7 @@ class MailFromListener implements EventSubscriberInterface
public function __construct(string $email, string $name)
{
- $this->email = $email;
+ $this->email = $email;
$this->name = $name;
}
@@ -55,4 +54,4 @@ class MailFromListener implements EventSubscriberInterface
MessageEvent::class => ['onMessage'],
];
}
-}
\ No newline at end of file
+}
diff --git a/src/EventSubscriber/PasswordChangeNeededSubscriber.php b/src/EventSubscriber/PasswordChangeNeededSubscriber.php
index 67198245..a1a76172 100644
--- a/src/EventSubscriber/PasswordChangeNeededSubscriber.php
+++ b/src/EventSubscriber/PasswordChangeNeededSubscriber.php
@@ -21,7 +21,6 @@
namespace App\EventSubscriber;
-
use App\Entity\UserSystem\User;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
@@ -34,18 +33,16 @@ use Symfony\Component\Security\Http\HttpUtils;
* This event subscriber redirects a user to its settings page, when it needs to change its password or is enforced
* to setup a 2FA method (enforcement can be set per group).
* In this cases the user is unable to access sites other than the whitelisted (see ALLOWED_ROUTES).
- * @package App\EventSubscriber
*/
class PasswordChangeNeededSubscriber implements EventSubscriberInterface
{
-
protected $security;
protected $flashBag;
protected $httpUtils;
/**
* @var string[] The routes the user is allowed to access without being redirected.
- * This should be only routes related to login/logout and user settings
+ * This should be only routes related to login/logout and user settings
*/
public const ALLOWED_ROUTES = [
'2fa_login',
@@ -69,17 +66,16 @@ class PasswordChangeNeededSubscriber implements EventSubscriberInterface
* This function is called when the kernel encounters a request.
* It checks if the user must change its password or add an 2FA mehtod and redirect it to the user settings page,
* if needed.
- * @param RequestEvent $event
*/
- public function redirectToSettingsIfNeeded(RequestEvent $event) : void
+ public function redirectToSettingsIfNeeded(RequestEvent $event): void
{
$user = $this->security->getUser();
$request = $event->getRequest();
- if(!$event->isMasterRequest()) {
+ if (!$event->isMasterRequest()) {
return;
}
- if(!$user instanceof User) {
+ if (!$user instanceof User) {
return;
}
@@ -98,35 +94,36 @@ class PasswordChangeNeededSubscriber implements EventSubscriberInterface
/* Dont redirect tree endpoints, as this would cause trouble and creates multiple flash
warnigs for one page reload */
- if(strpos($request->getUri(), '/tree/') !== false) {
+ if (false !== strpos($request->getUri(), '/tree/')) {
return;
}
//Show appropriate message to user about the reason he was redirected
- if($user->isNeedPwChange()) {
+ if ($user->isNeedPwChange()) {
$this->flashBag->add('warning', 'user.pw_change_needed.flash');
}
- if(static::TFARedirectNeeded($user)) {
+ if (static::TFARedirectNeeded($user)) {
$this->flashBag->add('warning', 'user.2fa_needed.flash');
}
$event->setResponse($this->httpUtils->createRedirectResponse($request, static::REDIRECT_TARGET));
-
}
/**
* Check if a redirect because of a missing 2FA method is needed.
* That is the case if the group of the user enforces 2FA, but the user has neither Google Authenticator nor an
* U2F key setup.
- * @param User $user The user for which should be checked if it needs to be redirected.
+ *
+ * @param User $user The user for which should be checked if it needs to be redirected.
+ *
* @return bool True if the user needs to be redirected.
*/
- public static function TFARedirectNeeded(User $user) : bool
+ public static function TFARedirectNeeded(User $user): bool
{
$tfa_enabled = $user->isU2FAuthEnabled() || $user->isGoogleAuthenticatorEnabled();
- if ($user->getGroup() !== null && $user->getGroup()->isEnforce2FA() && !$tfa_enabled) {
+ if (null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && !$tfa_enabled) {
return true;
}
@@ -134,7 +131,7 @@ class PasswordChangeNeededSubscriber implements EventSubscriberInterface
}
/**
- * @inheritDoc
+ * {@inheritdoc}
*/
public static function getSubscribedEvents()
{
@@ -142,4 +139,4 @@ class PasswordChangeNeededSubscriber implements EventSubscriberInterface
KernelEvents::REQUEST => 'redirectToSettingsIfNeeded',
];
}
-}
\ No newline at end of file
+}
diff --git a/src/EventSubscriber/U2FRegistrationSubscriber.php b/src/EventSubscriber/U2FRegistrationSubscriber.php
index 04969fd6..02565844 100644
--- a/src/EventSubscriber/U2FRegistrationSubscriber.php
+++ b/src/EventSubscriber/U2FRegistrationSubscriber.php
@@ -21,7 +21,6 @@
namespace App\EventSubscriber;
-
use App\Entity\UserSystem\U2FKey;
use Doctrine\ORM\EntityManagerInterface;
use R\U2FTwoFactorBundle\Event\RegisterEvent;
@@ -51,9 +50,9 @@ class U2FRegistrationSubscriber implements EventSubscriberInterface
/** @return string[] **/
public static function getSubscribedEvents(): array
{
- return array(
+ return [
'r_u2f_two_factor.register' => 'onRegister',
- );
+ ];
}
public function onRegister(RegisterEvent $event): void
@@ -78,4 +77,4 @@ class U2FRegistrationSubscriber implements EventSubscriberInterface
$response = new RedirectResponse($this->router->generate('user_settings'));
$event->setResponse($response);
}
-}
\ No newline at end of file
+}
diff --git a/src/Form/AdminPages/AttachmentTypeAdminForm.php b/src/Form/AdminPages/AttachmentTypeAdminForm.php
index 612f4481..9a3a1fe4 100644
--- a/src/Form/AdminPages/AttachmentTypeAdminForm.php
+++ b/src/Form/AdminPages/AttachmentTypeAdminForm.php
@@ -28,7 +28,6 @@ use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Security;
-use Symfony\Contracts\Translation\TranslatorInterface;
class AttachmentTypeAdminForm extends BaseEntityAdminForm
{
diff --git a/src/Form/AdminPages/BaseEntityAdminForm.php b/src/Form/AdminPages/BaseEntityAdminForm.php
index 0e62c9dc..60361b5a 100644
--- a/src/Form/AdminPages/BaseEntityAdminForm.php
+++ b/src/Form/AdminPages/BaseEntityAdminForm.php
@@ -38,7 +38,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
-use Symfony\Contracts\Translation\TranslatorInterface;
class BaseEntityAdminForm extends AbstractType
{
@@ -65,7 +64,7 @@ class BaseEntityAdminForm extends AbstractType
$builder
->add('name', TextType::class, ['empty_data' => '', 'label' => 'name.label',
- 'attr' => ['placeholder' =>'part.name.placeholder'],
+ 'attr' => ['placeholder' => 'part.name.placeholder'],
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ])
->add('parent', StructuralEntityType::class, ['class' => \get_class($entity),
diff --git a/src/Form/AdminPages/GroupAdminForm.php b/src/Form/AdminPages/GroupAdminForm.php
index a3b070e8..f2099468 100644
--- a/src/Form/AdminPages/GroupAdminForm.php
+++ b/src/Form/AdminPages/GroupAdminForm.php
@@ -36,7 +36,7 @@ class GroupAdminForm extends BaseEntityAdminForm
'label' => 'group.edit.enforce_2fa',
'help' => 'entity.edit.enforce_2fa.help',
'label_attr' => ['class' => 'checkbox-custom'],
- 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity)
+ 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
]);
$builder->add('permissions', PermissionsType::class, [
diff --git a/src/Form/AdminPages/ImportType.php b/src/Form/AdminPages/ImportType.php
index 3d489f18..790af5ae 100644
--- a/src/Form/AdminPages/ImportType.php
+++ b/src/Form/AdminPages/ImportType.php
@@ -31,7 +31,6 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Security;
-use Symfony\Contracts\Translation\TranslatorInterface;
class ImportType extends AbstractType
{
diff --git a/src/Form/AdminPages/MassCreationForm.php b/src/Form/AdminPages/MassCreationForm.php
index 45e3f484..9cecd3dc 100644
--- a/src/Form/AdminPages/MassCreationForm.php
+++ b/src/Form/AdminPages/MassCreationForm.php
@@ -28,7 +28,6 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Security\Core\Security;
-use Symfony\Contracts\Translation\TranslatorInterface;
class MassCreationForm extends AbstractType
{
diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php
index f06f6374..5922ed4a 100644
--- a/src/Form/AttachmentFormType.php
+++ b/src/Form/AttachmentFormType.php
@@ -38,7 +38,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Validator\Constraints\File;
use Symfony\Component\Validator\Constraints\Url;
-use Symfony\Contracts\Translation\TranslatorInterface;
class AttachmentFormType extends AbstractType
{
diff --git a/src/Form/Part/OrderdetailType.php b/src/Form/Part/OrderdetailType.php
index 6ab7c118..5471e9a2 100644
--- a/src/Form/Part/OrderdetailType.php
+++ b/src/Form/Part/OrderdetailType.php
@@ -36,13 +36,12 @@ use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
-use Symfony\Contracts\Translation\TranslatorInterface;
class OrderdetailType extends AbstractType
{
protected $security;
- public function __construct( Security $security)
+ public function __construct(Security $security)
{
$this->security = $security;
}
diff --git a/src/Form/Part/PartBaseType.php b/src/Form/Part/PartBaseType.php
index 75fb8e6d..2a86c48a 100644
--- a/src/Form/Part/PartBaseType.php
+++ b/src/Form/Part/PartBaseType.php
@@ -46,7 +46,6 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Security;
-use Symfony\Contracts\Translation\TranslatorInterface;
class PartBaseType extends AbstractType
{
diff --git a/src/Form/Part/PartLotType.php b/src/Form/Part/PartLotType.php
index f7776e87..96b21b36 100644
--- a/src/Form/Part/PartLotType.php
+++ b/src/Form/Part/PartLotType.php
@@ -33,7 +33,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
-use Symfony\Contracts\Translation\TranslatorInterface;
class PartLotType extends AbstractType
{
diff --git a/src/Form/Part/PricedetailType.php b/src/Form/Part/PricedetailType.php
index 2d2efd8c..8a65d502 100644
--- a/src/Form/Part/PricedetailType.php
+++ b/src/Form/Part/PricedetailType.php
@@ -53,7 +53,7 @@ class PricedetailType extends AbstractType
]);
$builder->add('currency', CurrencyEntityType::class, [
'required' => false,
- 'label' => false
+ 'label' => false,
]);
}
diff --git a/src/Form/TFAGoogleSettingsType.php b/src/Form/TFAGoogleSettingsType.php
index 495e27c0..4f7e0173 100644
--- a/src/Form/TFAGoogleSettingsType.php
+++ b/src/Form/TFAGoogleSettingsType.php
@@ -21,7 +21,6 @@
namespace App\Form;
-
use App\Entity\UserSystem\User;
use App\Validator\Constraints\ValidGoogleAuthCode;
use Symfony\Component\Form\AbstractType;
@@ -33,11 +32,9 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
-use Symfony\Contracts\Translation\TranslatorInterface;
class TFAGoogleSettingsType extends AbstractType
{
-
protected $translator;
public function __construct()
@@ -46,20 +43,20 @@ class TFAGoogleSettingsType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
- $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) {
+ $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
$form = $event->getForm();
/** @var User $user */
$user = $event->getData();
//Only show setup fields, when google authenticator is not enabled
- if(!$user->isGoogleAuthenticatorEnabled()) {
+ if (!$user->isGoogleAuthenticatorEnabled()) {
$form->add(
'google_confirmation',
TextType::class,
[
'mapped' => false,
'attr' => ['maxlength' => '6', 'minlength' => '6', 'pattern' => '\d*', 'autocomplete' => 'off'],
- 'constraints' => [new ValidGoogleAuthCode()]
+ 'constraints' => [new ValidGoogleAuthCode()],
]
);
@@ -72,12 +69,12 @@ class TFAGoogleSettingsType extends AbstractType
);
$form->add('submit', SubmitType::class, [
- 'label' => 'tfa_google.enable'
+ 'label' => 'tfa_google.enable',
]);
} else {
$form->add('submit', SubmitType::class, [
- 'label' =>'tfa_google.disable',
- 'attr' => ['class' => 'btn-danger']
+ 'label' => 'tfa_google.disable',
+ 'attr' => ['class' => 'btn-danger'],
]);
}
});
@@ -91,4 +88,4 @@ class TFAGoogleSettingsType extends AbstractType
'data_class' => User::class,
]);
}
-}
\ No newline at end of file
+}
diff --git a/src/Form/UserAdminForm.php b/src/Form/UserAdminForm.php
index f8bcafb1..7414cdb1 100644
--- a/src/Form/UserAdminForm.php
+++ b/src/Form/UserAdminForm.php
@@ -44,7 +44,6 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Validator\Constraints\Length;
-use Symfony\Contracts\Translation\TranslatorInterface;
class UserAdminForm extends AbstractType
{
diff --git a/src/Form/UserSettingsType.php b/src/Form/UserSettingsType.php
index 25093923..35583b17 100644
--- a/src/Form/UserSettingsType.php
+++ b/src/Form/UserSettingsType.php
@@ -34,7 +34,6 @@ use Symfony\Component\Form\Extension\Core\Type\TimezoneType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Security;
-use Symfony\Contracts\Translation\TranslatorInterface;
class UserSettingsType extends AbstractType
{
diff --git a/src/Helpers/BBCodeToMarkdownConverter.php b/src/Helpers/BBCodeToMarkdownConverter.php
index 6841e05d..994edaa0 100644
--- a/src/Helpers/BBCodeToMarkdownConverter.php
+++ b/src/Helpers/BBCodeToMarkdownConverter.php
@@ -38,9 +38,9 @@ class BBCodeToMarkdownConverter
* Converts the given BBCode to markdown.
* BBCode tags that does not have a markdown aequivalent are outputed as HTML tags.
*
- * @param $bbcode string The Markdown that should be converted.
+ * @param $bbcode string The Markdown that should be converted
*
- * @return string The markdown version of the text.
+ * @return string the markdown version of the text
*/
public function convert(string $bbcode): string
{
diff --git a/src/Helpers/Trees/StructuralDBElementIterator.php b/src/Helpers/Trees/StructuralDBElementIterator.php
index eeae0b36..a360a7fa 100644
--- a/src/Helpers/Trees/StructuralDBElementIterator.php
+++ b/src/Helpers/Trees/StructuralDBElementIterator.php
@@ -21,10 +21,8 @@
namespace App\Helpers\Trees;
-
use App\Entity\Base\StructuralDBElement;
use Doctrine\Common\Collections\Collection;
-use RecursiveIterator;
class StructuralDBElementIterator extends \ArrayIterator implements \RecursiveIterator
{
@@ -37,22 +35,24 @@ class StructuralDBElementIterator extends \ArrayIterator implements \RecursiveIt
}
/**
- * @inheritDoc
+ * {@inheritdoc}
*/
public function hasChildren()
{
/** @var StructuralDBElement $element */
$element = $this->current();
+
return !empty($element->getSubelements());
}
/**
- * @inheritDoc
+ * {@inheritdoc}
*/
public function getChildren()
{
/** @var StructuralDBElement $element */
$element = $this->current();
- return new StructuralDBElementIterator($element->getSubelements()->toArray());
+
+ return new self($element->getSubelements()->toArray());
}
-}
\ No newline at end of file
+}
diff --git a/src/Helpers/Trees/TreeViewNode.php b/src/Helpers/Trees/TreeViewNode.php
index d11968b8..66a0a7ad 100644
--- a/src/Helpers/Trees/TreeViewNode.php
+++ b/src/Helpers/Trees/TreeViewNode.php
@@ -21,11 +21,6 @@
namespace App\Helpers\Trees;
-use App\Entity\Base\DBElement;
-use App\Entity\Base\NamedDBElement;
-use App\Entity\Base\StructuralDBElement;
-use App\Helpers\Trees\TreeViewNodeState;
-
/**
* This class represents a node for the bootstrap treeview node.
* When you serialize an array of these objects to JSON, you can use the serialized data in data for the treeview.
@@ -63,9 +58,10 @@ class TreeViewNode implements \JsonSerializable
/**
* Return the ID of the entity associated with this node.
* Null if this node is not connected with an entity.
+ *
* @return int|null
*/
- public function getId() : ?int
+ public function getId(): ?int
{
return $this->id;
}
@@ -73,12 +69,13 @@ class TreeViewNode implements \JsonSerializable
/**
* Sets the ID of the entity associated with this node.
* Null if this node is not connected with an entity.
- * @param int|null $id
+ *
* @return $this
*/
public function setId(?int $id): self
{
$this->id = $id;
+
return $this;
}
@@ -208,27 +205,27 @@ class TreeViewNode implements \JsonSerializable
}
/**
- * @inheritDoc
+ * {@inheritdoc}
*/
public function jsonSerialize()
{
$ret = [
- 'text' => $this->text
+ 'text' => $this->text,
];
- if($this->href !== null) {
+ if (null !== $this->href) {
$ret['href'] = $this->href;
}
- if($this->tags !== null) {
+ if (null !== $this->tags) {
$ret['tags'] = $this->tags;
}
- if($this->nodes !== null) {
+ if (null !== $this->nodes) {
$ret['nodes'] = $this->nodes;
}
- if($this->state !== null) {
+ if (null !== $this->state) {
$ret['state'] = $this->state;
}
diff --git a/src/Helpers/Trees/TreeViewNodeIterator.php b/src/Helpers/Trees/TreeViewNodeIterator.php
index e0f34ecb..88a44429 100644
--- a/src/Helpers/Trees/TreeViewNodeIterator.php
+++ b/src/Helpers/Trees/TreeViewNodeIterator.php
@@ -21,11 +21,8 @@
namespace App\Helpers\Trees;
-use App\Helpers\Trees\TreeViewNode;
-
class TreeViewNodeIterator extends \ArrayIterator implements \RecursiveIterator
{
-
/**
* @param $nodes TreeViewNode[]
*/
@@ -35,22 +32,24 @@ class TreeViewNodeIterator extends \ArrayIterator implements \RecursiveIterator
}
/**
- * @inheritDoc
+ * {@inheritdoc}
*/
public function hasChildren()
{
/** @var TreeViewNode $element */
$element = $this->current();
+
return !empty($element->getNodes());
}
/**
- * @inheritDoc
+ * {@inheritdoc}
*/
public function getChildren()
{
/** @var TreeViewNode $element */
$element = $this->current();
- return new TreeViewNodeIterator($element->getNodes());
+
+ return new self($element->getNodes());
}
-}
\ No newline at end of file
+}
diff --git a/src/Helpers/Trees/TreeViewNodeState.php b/src/Helpers/Trees/TreeViewNodeState.php
index 8d3008d2..b4d60709 100644
--- a/src/Helpers/Trees/TreeViewNodeState.php
+++ b/src/Helpers/Trees/TreeViewNodeState.php
@@ -75,20 +75,20 @@ class TreeViewNodeState implements \JsonSerializable
}
/**
- * @inheritDoc
+ * {@inheritdoc}
*/
public function jsonSerialize()
{
$ret = [];
- if ($this->selected !== null) {
+ if (null !== $this->selected) {
$ret['selected'] = $this->selected;
}
- if($this->disabled !== null) {
+ if (null !== $this->disabled) {
$ret['disabled'] = $this->disabled;
}
- if($this->expanded !== null) {
+ if (null !== $this->expanded) {
$ret['expanded'] = $this->expanded;
}
diff --git a/src/Migrations/Version20190913141126.php b/src/Migrations/Version20190913141126.php
index f3f24831..b58f124c 100644
--- a/src/Migrations/Version20190913141126.php
+++ b/src/Migrations/Version20190913141126.php
@@ -56,7 +56,7 @@ final class Version20190913141126 extends AbstractMigration
WHERE id = 2 AND name = "readonly";';
$this->addSql($sql);
-
+
$sql = 'UPDATE `groups`
SET perms_parts_category = 5, perms_parts_minamount = 5, perms_parts_lots = 85, perms_parts_tags= 5,
perms_parts_unit = 5, perms_parts_mass = 5, perms_parts_status = 5, perms_parts_mpn = 5,
diff --git a/src/Migrations/Version20191214153125.php b/src/Migrations/Version20191214153125.php
index 57613660..75b0f73b 100644
--- a/src/Migrations/Version20191214153125.php
+++ b/src/Migrations/Version20191214153125.php
@@ -31,15 +31,15 @@ use Doctrine\Migrations\AbstractMigration;
*/
final class Version20191214153125 extends AbstractMigration
{
- public function getDescription() : string
+ public function getDescription(): string
{
return '';
}
- public function up(Schema $schema) : void
+ public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
+ $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE u2f_keys (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, key_handle VARCHAR(64) NOT NULL, public_key VARCHAR(255) NOT NULL, certificate LONGTEXT NOT NULL, counter VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, INDEX IDX_4F4ADB4BA76ED395 (user_id), UNIQUE INDEX user_unique (user_id, key_handle), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE u2f_keys ADD CONSTRAINT FK_4F4ADB4BA76ED395 FOREIGN KEY (user_id) REFERENCES `users` (id)');
@@ -47,10 +47,10 @@ final class Version20191214153125 extends AbstractMigration
$this->addSql('ALTER TABLE users ADD google_authenticator_secret VARCHAR(255) DEFAULT NULL, ADD backup_codes LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', ADD backup_codes_generation_date DATETIME DEFAULT NULL, ADD trusted_device_cookie_version INT NOT NULL');
}
- public function down(Schema $schema) : void
+ public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
- $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
+ $this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('DROP TABLE u2f_keys');
$this->addSql('ALTER TABLE `groups` DROP enforce_2fa');
diff --git a/src/Repository/NamedDBElementRepository.php b/src/Repository/NamedDBElementRepository.php
index 418e0b98..b8710499 100644
--- a/src/Repository/NamedDBElementRepository.php
+++ b/src/Repository/NamedDBElementRepository.php
@@ -21,20 +21,19 @@
namespace App\Repository;
-
use App\Entity\Base\NamedDBElement;
use App\Helpers\Trees\TreeViewNode;
use Doctrine\ORM\EntityRepository;
-
class NamedDBElementRepository extends EntityRepository
{
/**
* Gets a tree of TreeViewNode elements. The root elements has $parent as parent.
* The treeview is generic, that means the href are null and ID values are set.
+ *
* @return TreeViewNode[]
*/
- public function getGenericNodeTree() : array
+ public function getGenericNodeTree(): array
{
$result = [];
@@ -48,4 +47,4 @@ class NamedDBElementRepository extends EntityRepository
return $result;
}
-}
\ No newline at end of file
+}
diff --git a/src/Repository/StructuralDBElementRepository.php b/src/Repository/StructuralDBElementRepository.php
index 710bb480..c9239edf 100644
--- a/src/Repository/StructuralDBElementRepository.php
+++ b/src/Repository/StructuralDBElementRepository.php
@@ -37,14 +37,15 @@ class StructuralDBElementRepository extends NamedDBElementRepository
return $this->findBy(['parent' => null], ['name' => 'ASC']);
}
-
/**
* Gets a tree of TreeViewNode elements. The root elements has $parent as parent.
* The treeview is generic, that means the href are null and ID values are set.
- * @param StructuralDBElement|null $parent The parent the root elements should have.
+ *
+ * @param StructuralDBElement|null $parent The parent the root elements should have.
+ *
* @return TreeViewNode[]
*/
- public function getGenericNodeTree(?StructuralDBElement $parent = null) : array
+ public function getGenericNodeTree(?StructuralDBElement $parent = null): array
{
$result = [];
@@ -80,7 +81,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository
//$result = iterator_to_array($recursiveIterator);
//We can not use iterator_to_array here or we get only the parent elements
- foreach($recursiveIterator as $item) {
+ foreach ($recursiveIterator as $item) {
$result[] = $item;
}
diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php
index 782ccd13..1f8db216 100644
--- a/src/Repository/UserRepository.php
+++ b/src/Repository/UserRepository.php
@@ -42,9 +42,9 @@ class UserRepository extends NamedDBElementRepository implements PasswordUpgrade
*
* @return User|null
*/
- public function getAnonymousUser() : ?User
+ public function getAnonymousUser(): ?User
{
- if ($this->anonymous_user === null) {
+ if (null === $this->anonymous_user) {
$this->anonymous_user = $this->findOneBy([
'id' => User::ID_ANONYMOUS,
]);
@@ -55,10 +55,12 @@ class UserRepository extends NamedDBElementRepository implements PasswordUpgrade
/**
* Find a user by its name or its email. Useful for login or password reset purposes.
+ *
* @param string $name_or_password The username or the email of the user that should be found
+ *
* @return User|null The user if it is existing, null if no one matched the criteria
*/
- public function findByEmailOrName(string $name_or_password) : ?User
+ public function findByEmailOrName(string $name_or_password): ?User
{
if (empty($name_or_password)) {
return null;
@@ -79,7 +81,7 @@ class UserRepository extends NamedDBElementRepository implements PasswordUpgrade
}
/**
- * @inheritDoc
+ * {@inheritdoc}
*/
public function upgradePassword(UserInterface $user, string $newEncodedPassword): void
{
diff --git a/src/Security/EntityListeners/ElementPermissionListener.php b/src/Security/EntityListeners/ElementPermissionListener.php
index e9ee92ff..d5a9f50d 100644
--- a/src/Security/EntityListeners/ElementPermissionListener.php
+++ b/src/Security/EntityListeners/ElementPermissionListener.php
@@ -80,16 +80,18 @@ class ElementPermissionListener
/**
* Checks if access to the property of the given element is granted.
* This function adds an additional cache layer, where the voters are called only once (to improve performance).
- * @param string $mode What operation should be checked. Must be 'read' or 'edit'
+ *
+ * @param string $mode What operation should be checked. Must be 'read' or 'edit'
* @param ColumnSecurity $annotation The annotation of the property that should be checked
- * @param DBElement $element The element that should for which should be checked
+ * @param DBElement $element The element that should for which should be checked
+ *
* @return bool True if the user is allowed to read that property
*/
- protected function isGranted(string $mode, ColumnSecurity $annotation, DBElement $element) : bool
+ protected function isGranted(string $mode, ColumnSecurity $annotation, DBElement $element): bool
{
- if ($mode === 'read') {
+ if ('read' === $mode) {
$operation = $annotation->getReadOperationName();
- } elseif ($mode === 'edit') {
+ } elseif ('edit' === $mode) {
$operation = $annotation->getEditOperationName();
} else {
throw new \InvalidArgumentException('$mode must be either "read" or "edit"!');
@@ -101,12 +103,11 @@ class ElementPermissionListener
}
//Check if we have already have saved the permission, otherwise save it to cache
- if (!isset($this->perm_cache[$mode][get_class($element)][$operation])) {
- $this->perm_cache[$mode][get_class($element)][$operation] = $this->security->isGranted($operation, $element);
+ if (!isset($this->perm_cache[$mode][\get_class($element)][$operation])) {
+ $this->perm_cache[$mode][\get_class($element)][$operation] = $this->security->isGranted($operation, $element);
}
- return $this->perm_cache[$mode][get_class($element)][$operation];
-
+ return $this->perm_cache[$mode][\get_class($element)][$operation];
}
/**
diff --git a/src/Security/UserChecker.php b/src/Security/UserChecker.php
index a1328875..3894bc1b 100644
--- a/src/Security/UserChecker.php
+++ b/src/Security/UserChecker.php
@@ -26,13 +26,11 @@ use Symfony\Component\Security\Core\Exception\AccountStatusException;
use Symfony\Component\Security\Core\Exception\DisabledException;
use Symfony\Component\Security\Core\User\UserCheckerInterface;
use Symfony\Component\Security\Core\User\UserInterface;
-use Symfony\Contracts\Translation\TranslatorInterface;
class UserChecker implements UserCheckerInterface
{
public function __construct()
{
-
}
/**
diff --git a/src/Security/Voter/AttachmentVoter.php b/src/Security/Voter/AttachmentVoter.php
index b0a2f89f..0a91fb30 100644
--- a/src/Security/Voter/AttachmentVoter.php
+++ b/src/Security/Voter/AttachmentVoter.php
@@ -32,8 +32,6 @@ class AttachmentVoter extends ExtendedVoter
*
* @param $attribute
* @param $subject
- *
- * @return bool
*/
protected function voteOnUser($attribute, $subject, User $user): bool
{
diff --git a/src/Security/Voter/ExtendedVoter.php b/src/Security/Voter/ExtendedVoter.php
index e886a3a3..23ce4cf6 100644
--- a/src/Security/Voter/ExtendedVoter.php
+++ b/src/Security/Voter/ExtendedVoter.php
@@ -72,7 +72,6 @@ abstract class ExtendedVoter extends Voter
*
* @param $attribute
* @param $subject
- * @return bool
*/
abstract protected function voteOnUser($attribute, $subject, User $user): bool;
}
diff --git a/src/Security/Voter/GroupVoter.php b/src/Security/Voter/GroupVoter.php
index 07488940..e96491cc 100644
--- a/src/Security/Voter/GroupVoter.php
+++ b/src/Security/Voter/GroupVoter.php
@@ -32,8 +32,6 @@ class GroupVoter extends ExtendedVoter
*
* @param $attribute
* @param $subject
- *
- * @return bool
*/
protected function voteOnUser($attribute, $subject, User $user): bool
{
diff --git a/src/Security/Voter/PermissionVoter.php b/src/Security/Voter/PermissionVoter.php
index 5ab14cab..3629a000 100644
--- a/src/Security/Voter/PermissionVoter.php
+++ b/src/Security/Voter/PermissionVoter.php
@@ -35,8 +35,6 @@ class PermissionVoter extends ExtendedVoter
*
* @param $attribute
* @param $subject
- *
- * @return bool
*/
protected function voteOnUser($attribute, $subject, User $user): bool
{
diff --git a/src/Security/Voter/StructureVoter.php b/src/Security/Voter/StructureVoter.php
index 34276672..f8927820 100644
--- a/src/Security/Voter/StructureVoter.php
+++ b/src/Security/Voter/StructureVoter.php
@@ -54,9 +54,9 @@ class StructureVoter extends ExtendedVoter
/**
* Maps a instance type to the permission name.
*
- * @param $subject mixed The subject for which the permission name should be generated.
+ * @param $subject mixed The subject for which the permission name should be generated
*
- * @return string|null The name of the permission for the subject's type or null, if the subject is not supported.
+ * @return string|null the name of the permission for the subject's type or null, if the subject is not supported
*/
protected function instanceToPermissionName($subject): ?string
{
@@ -91,8 +91,6 @@ class StructureVoter extends ExtendedVoter
*
* @param $attribute
* @param $subject
- *
- * @return bool
*/
protected function voteOnUser($attribute, $subject, User $user): bool
{
diff --git a/src/Services/AmountFormatter.php b/src/Services/AmountFormatter.php
index a45952d2..60010ae2 100644
--- a/src/Services/AmountFormatter.php
+++ b/src/Services/AmountFormatter.php
@@ -95,7 +95,7 @@ class AmountFormatter
*
* @return string The formatted string
*
- * @throws \InvalidArgumentException Thrown if $value is not numeric.
+ * @throws \InvalidArgumentException thrown if $value is not numeric
*/
public function format($value, ?MeasurementUnit $unit = null, array $options = [])
{
diff --git a/src/Services/Attachments/AttachmentManager.php b/src/Services/Attachments/AttachmentManager.php
index 52037864..332ce773 100644
--- a/src/Services/Attachments/AttachmentManager.php
+++ b/src/Services/Attachments/AttachmentManager.php
@@ -61,8 +61,6 @@ class AttachmentManager
* or is not existing.
*
* @param Attachment $attachment The attachment for which the filepath should be determined
- *
- * @return string|null
*/
public function toAbsoluteFilePath(Attachment $attachment): ?string
{
@@ -96,7 +94,7 @@ class AttachmentManager
*
* @param Attachment $attachment The attachment for which the existence should be checked
*
- * @return bool True if the file is existing.
+ * @return bool true if the file is existing
*/
public function isFileExisting(Attachment $attachment): bool
{
@@ -111,9 +109,7 @@ class AttachmentManager
* Returns the filesize of the attachments in bytes.
* For external attachments or not existing attachments, null is returned.
*
- * @param Attachment $attachment The filesize for which the filesize should be calculated.
- *
- * @return int|null
+ * @param Attachment $attachment the filesize for which the filesize should be calculated
*/
public function getFileSize(Attachment $attachment): ?int
{
diff --git a/src/Services/Attachments/AttachmentPathResolver.php b/src/Services/Attachments/AttachmentPathResolver.php
index 0882a6e1..5ba6ad34 100644
--- a/src/Services/Attachments/AttachmentPathResolver.php
+++ b/src/Services/Attachments/AttachmentPathResolver.php
@@ -44,11 +44,11 @@ class AttachmentPathResolver
/**
* AttachmentPathResolver constructor.
*
- * @param string $project_dir The kernel that should be used to resolve the project dir.
- * @param string $media_path The path where uploaded attachments should be stored.
+ * @param string $project_dir the kernel that should be used to resolve the project dir
+ * @param string $media_path the path where uploaded attachments should be stored
* @param string|null $footprints_path The path where builtin attachments are stored.
* Set to null if this ressource should be disabled.
- * @param string|null $models_path Set to null if this ressource should be disabled.
+ * @param string|null $models_path set to null if this ressource should be disabled
*/
public function __construct(string $project_dir, string $media_path, string $secure_path, ?string $footprints_path, ?string $models_path)
{
@@ -83,8 +83,6 @@ class AttachmentPathResolver
* @internal
*
* @param string|null $param_path The parameter value that should be converted to a absolute path
- *
- * @return string|null
*/
public function parameterToAbsolutePath(?string $param_path): ?string
{
@@ -120,8 +118,6 @@ class AttachmentPathResolver
* Create an array usable for preg_replace out of an array of placeholders or pathes.
* Slashes and other chars become escaped.
* For example: '%TEST%' becomes '/^%TEST%/'.
- *
- * @return array
*/
protected function arrayToRegexArray(array $array): array
{
@@ -139,7 +135,7 @@ class AttachmentPathResolver
* Converts an relative placeholder filepath (with %MEDIA% or older %BASE%) to an absolute filepath on disk.
* The directory separator is always /. Relative pathes are not realy possible (.. is striped).
*
- * @param string $placeholder_path The filepath with placeholder for which the real path should be determined.
+ * @param string $placeholder_path the filepath with placeholder for which the real path should be determined
*
* @return string|null The absolute real path of the file, or null if the placeholder path is invalid
*/
@@ -175,7 +171,7 @@ class AttachmentPathResolver
/**
* Converts an real absolute filepath to a placeholder version.
*
- * @param string $real_path The absolute path, for which the placeholder version should be generated.
+ * @param string $real_path the absolute path, for which the placeholder version should be generated
* @param bool $old_version By default the %MEDIA% placeholder is used, which is directly replaced with the
* media directory. If set to true, the old version with %BASE% will be used, which is the project directory.
*
@@ -213,7 +209,7 @@ class AttachmentPathResolver
/**
* The path where uploaded attachments is stored.
*
- * @return string The absolute path to the media folder.
+ * @return string the absolute path to the media folder
*/
public function getMediaPath(): string
{
@@ -224,7 +220,7 @@ class AttachmentPathResolver
* The path where secured attachments are stored. Must not be located in public/ folder, so it can only be accessed
* via the attachment controller.
*
- * @return string The absolute path to the secure path.
+ * @return string the absolute path to the secure path
*/
public function getSecurePath(): string
{
diff --git a/src/Services/Attachments/AttachmentReverseSearch.php b/src/Services/Attachments/AttachmentReverseSearch.php
index 9ca18f15..f5262550 100644
--- a/src/Services/Attachments/AttachmentReverseSearch.php
+++ b/src/Services/Attachments/AttachmentReverseSearch.php
@@ -51,7 +51,7 @@ class AttachmentReverseSearch
*
* @param \SplFileInfo $file The file for which is searched
*
- * @return Attachment[] An list of attachments that use the given file.
+ * @return Attachment[] an list of attachments that use the given file
*/
public function findAttachmentsByFile(\SplFileInfo $file): array
{
@@ -69,7 +69,7 @@ class AttachmentReverseSearch
* Deletes the given file if it is not used by more than $threshold attachments.
*
* @param \SplFileInfo $file The file that should be removed
- * @param int $threshold The threshold used, to determine if a file should be deleted or not.
+ * @param int $threshold the threshold used, to determine if a file should be deleted or not
*
* @return bool True, if the file was delete. False if not.
*/
diff --git a/src/Services/Attachments/AttachmentSubmitHandler.php b/src/Services/Attachments/AttachmentSubmitHandler.php
index b26c0919..5f58ec50 100644
--- a/src/Services/Attachments/AttachmentSubmitHandler.php
+++ b/src/Services/Attachments/AttachmentSubmitHandler.php
@@ -89,7 +89,7 @@ class AttachmentSubmitHandler
* @param Attachment $attachment The attachment that should be used for generating an attachment
* @param string $extension The extension that the new file should have (must only contain chars allowed in pathes)
*
- * @return string The new filename.
+ * @return string the new filename
*/
public function generateAttachmentFilename(Attachment $attachment, string $extension): string
{
@@ -114,7 +114,7 @@ class AttachmentSubmitHandler
* @param Attachment $attachment The attachment that should be used for
* @param bool $secure_upload True if the file path should be located in a safe location
*
- * @return string The absolute path for the attachment folder.
+ * @return string the absolute path for the attachment folder
*/
public function generateAttachmentPath(Attachment $attachment, bool $secure_upload = false): string
{
@@ -143,7 +143,7 @@ class AttachmentSubmitHandler
* Handle the submit of an attachment form.
* This function will move the uploaded file or download the URL file to server, if needed.
*
- * @param Attachment $attachment The attachment that should be used for handling.
+ * @param Attachment $attachment the attachment that should be used for handling
* @param UploadedFile|null $file If given, that file will be moved to the right location
* @param array $options The options to use with the upload. Here you can specify that an URL should be downloaded,
* or an file should be moved to a secure location.
@@ -181,8 +181,8 @@ class AttachmentSubmitHandler
/**
* Move the given attachment to secure location (or back to public folder) if needed.
*
- * @param Attachment $attachment The attachment for which the file should be moved.
- * @param bool $secure_location This value determines, if the attachment is moved to the secure or public folder.
+ * @param Attachment $attachment the attachment for which the file should be moved
+ * @param bool $secure_location this value determines, if the attachment is moved to the secure or public folder
*
* @return Attachment The attachment with the updated filepath
*/
diff --git a/src/Services/Attachments/AttachmentURLGenerator.php b/src/Services/Attachments/AttachmentURLGenerator.php
index bfbaeb1f..d2f43f68 100644
--- a/src/Services/Attachments/AttachmentURLGenerator.php
+++ b/src/Services/Attachments/AttachmentURLGenerator.php
@@ -53,7 +53,7 @@ class AttachmentURLGenerator
* Converts the absolute file path to a version relative to the public folder, that can be passed to asset
* Asset Component functions.
*
- * @param string $absolute_path The absolute path that should be converted.
+ * @param string $absolute_path the absolute path that should be converted
* @param string|null $public_path The public path to which the relative pathes should be created.
* The path must NOT have a trailing slash!
* If this is set to null, the global public/ folder is used.
@@ -78,8 +78,6 @@ class AttachmentURLGenerator
/**
* Returns a URL under which the attachment file can be viewed.
- *
- * @return string
*/
public function getViewURL(Attachment $attachment): string
{
@@ -101,8 +99,6 @@ class AttachmentURLGenerator
/**
* Returns a URL to an thumbnail of the attachment file.
- *
- * @return string
*/
public function getThumbnailURL(Attachment $attachment, string $filter_name = 'thumbnail_sm'): string
{
@@ -137,8 +133,6 @@ class AttachmentURLGenerator
/**
* Returns a download link to the file associated with the attachment.
- *
- * @return string
*/
public function getDownloadURL(Attachment $attachment): string
{
diff --git a/src/Services/Attachments/BuiltinAttachmentsFinder.php b/src/Services/Attachments/BuiltinAttachmentsFinder.php
index 929ce858..ec818b45 100644
--- a/src/Services/Attachments/BuiltinAttachmentsFinder.php
+++ b/src/Services/Attachments/BuiltinAttachmentsFinder.php
@@ -55,7 +55,7 @@ class BuiltinAttachmentsFinder
* The array is a list of the relative filenames using the %PLACEHOLDERS%.
* The list contains the files from all configured valid ressoureces.
*
- * @return array The list of the ressources, or an empty array if an error happened.
+ * @return array the list of the ressources, or an empty array if an error happened
*/
public function getListOfRessources(): array
{
@@ -92,9 +92,9 @@ class BuiltinAttachmentsFinder
/**
* Find all ressources which are matching the given keyword and the specified options.
*
- * @param string $keyword The keyword you want to search for.
+ * @param string $keyword the keyword you want to search for
* @param array $options Here you can specify some options (see configureOptions for list of options)
- * @param array|null $base_list The list from which should be used as base for filtering.
+ * @param array|null $base_list the list from which should be used as base for filtering
*
* @return array The list of the results matching the specified keyword and options
*/
diff --git a/src/Services/Attachments/FileTypeFilterTools.php b/src/Services/Attachments/FileTypeFilterTools.php
index e0b90df3..de257410 100644
--- a/src/Services/Attachments/FileTypeFilterTools.php
+++ b/src/Services/Attachments/FileTypeFilterTools.php
@@ -53,9 +53,9 @@ class FileTypeFilterTools
/**
* Check if a filetype filter string is valid.
*
- * @param string $filter The filter string that should be validated.
+ * @param string $filter the filter string that should be validated
*
- * @return bool Returns true, if the string is valid.
+ * @return bool returns true, if the string is valid
*/
public function validateFilterString(string $filter): bool
{
@@ -84,7 +84,7 @@ class FileTypeFilterTools
* Normalize a filter string. All extensions are converted to lowercase, too much whitespaces are removed.
* The filter string is not validated.
*
- * @param string $filter The filter string that should be normalized.
+ * @param string $filter the filter string that should be normalized
*
* @return string The normalized filter string
*/
@@ -131,7 +131,7 @@ class FileTypeFilterTools
/**
* Get a list of all file extensions that matches the given filter string.
*
- * @param string $filter A valid filetype filter string.
+ * @param string $filter a valid filetype filter string
*
* @return string[] An array of allowed extensions ['txt', 'csv', 'gif']
*/
@@ -166,10 +166,10 @@ class FileTypeFilterTools
/**
* Check if the given extension matches the filter.
*
- * @param string $filter The filter which should be used for checking.
- * @param string $extension The extension that should be checked.
+ * @param string $filter the filter which should be used for checking
+ * @param string $extension the extension that should be checked
*
- * @return bool Returns true, if the extension is allowed with the given filter.
+ * @return bool returns true, if the extension is allowed with the given filter
*/
public function isExtensionAllowed(string $filter, string $extension): bool
{
diff --git a/src/Services/Attachments/PartPreviewGenerator.php b/src/Services/Attachments/PartPreviewGenerator.php
index 286d467d..c15644bf 100644
--- a/src/Services/Attachments/PartPreviewGenerator.php
+++ b/src/Services/Attachments/PartPreviewGenerator.php
@@ -38,7 +38,7 @@ class PartPreviewGenerator
* The priority is: Part MasterAttachment -> Footprint MasterAttachment -> Category MasterAttachment
* -> Storelocation Attachment -> MeasurementUnit Attachment -> ManufacturerAttachment.
*
- * @param Part $part The part for which the attachments should be determined.
+ * @param Part $part the part for which the attachments should be determined
*
* @return Attachment[]
*/
@@ -97,8 +97,6 @@ class PartPreviewGenerator
* The returned attachment is guaranteed to be existing and be a picture.
*
* @param Part $part The part for which the attachment should be determined
- *
- * @return Attachment|null
*/
public function getTablePreviewAttachment(Part $part): ?Attachment
{
@@ -123,9 +121,9 @@ class PartPreviewGenerator
/**
* Checks if a attachment is exising and a valid picture.
*
- * @param Attachment|null $attachment The attachment that should be checked.
+ * @param Attachment|null $attachment the attachment that should be checked
*
- * @return bool True if the attachment is valid.
+ * @return bool true if the attachment is valid
*/
protected function isAttachmentValidPicture(?Attachment $attachment): bool
{
diff --git a/src/Services/CustomEnvVarProcessor.php b/src/Services/CustomEnvVarProcessor.php
index bb6df8da..01742c8f 100644
--- a/src/Services/CustomEnvVarProcessor.php
+++ b/src/Services/CustomEnvVarProcessor.php
@@ -21,22 +21,21 @@
namespace App\Services;
-
use Symfony\Component\DependencyInjection\EnvVarProcessorInterface;
use Symfony\Component\DependencyInjection\Exception\EnvNotFoundException;
class CustomEnvVarProcessor implements EnvVarProcessorInterface
{
-
/**
- * @inheritDoc
+ * {@inheritdoc}
*/
public function getEnv($prefix, $name, \Closure $getEnv)
{
if ('validMailDSN' === $prefix) {
try {
$env = $getEnv($name);
- return !empty($env) && $env !== 'null://null';
+
+ return !empty($env) && 'null://null' !== $env;
} catch (EnvNotFoundException $exception) {
return false;
}
@@ -44,7 +43,7 @@ class CustomEnvVarProcessor implements EnvVarProcessorInterface
}
/**
- * @inheritDoc
+ * {@inheritdoc}
*/
public static function getProvidedTypes()
{
@@ -52,4 +51,4 @@ class CustomEnvVarProcessor implements EnvVarProcessorInterface
'validMailDSN' => 'bool',
];
}
-}
\ No newline at end of file
+}
diff --git a/src/Services/ElementTypeNameGenerator.php b/src/Services/ElementTypeNameGenerator.php
index 275554d3..556aadfd 100644
--- a/src/Services/ElementTypeNameGenerator.php
+++ b/src/Services/ElementTypeNameGenerator.php
@@ -80,9 +80,9 @@ class ElementTypeNameGenerator
*
* @param DBElement $entity The element for which the label should be generated
*
- * @return string The locatlized label for the entity type.
+ * @return string the locatlized label for the entity type
*
- * @throws EntityNotSupportedException When the passed entity is not supported.
+ * @throws EntityNotSupportedException when the passed entity is not supported
*/
public function getLocalizedTypeLabel(DBElement $entity): string
{
@@ -107,11 +107,12 @@ class ElementTypeNameGenerator
* For example this could be something like: "Part: BC547".
* It uses getLocalizedLabel to determine the type.
*
- * @param NamedDBElement $entity The entity for which the string should be generated.
+ * @param NamedDBElement $entity the entity for which the string should be generated
* @param bool $use_html If set to true, a html string is returned, where the type is set italic
*
* @return string The localized string
- * @throws EntityNotSupportedException When the passed entity is not supported.
+ *
+ * @throws EntityNotSupportedException when the passed entity is not supported
*/
public function getTypeNameCombination(NamedDBElement $entity, bool $use_html = false): string
{
diff --git a/src/Services/EntityExporter.php b/src/Services/EntityExporter.php
index 56ea0e91..a1ffebb0 100644
--- a/src/Services/EntityExporter.php
+++ b/src/Services/EntityExporter.php
@@ -43,9 +43,9 @@ class EntityExporter
* Exports an Entity or an array of entities to multiple file formats.
*
* @param $entity NamedDBElement|NamedDBElement[] The element/elements[] that should be exported
- * @param Request $request The request that should be used for option resolving.
+ * @param Request $request the request that should be used for option resolving
*
- * @return Response The generated response containing the exported data.
+ * @return Response the generated response containing the exported data
*
* @throws \ReflectionException
*/
diff --git a/src/Services/EntityImporter.php b/src/Services/EntityImporter.php
index 0f056cb7..908f0a66 100644
--- a/src/Services/EntityImporter.php
+++ b/src/Services/EntityImporter.php
@@ -21,7 +21,6 @@
namespace App\Services;
-use App\Entity\Base\DBElement;
use App\Entity\Base\StructuralDBElement;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\File\File;
@@ -59,10 +58,10 @@ class EntityImporter
*
* @param string $lines The list of names seperated by \n
* @param string $class_name The name of the class for which the entities should be created
- * @param StructuralDBElement|null $parent The element which will be used as parent element for new elements.
- * @param array $errors An associative array containing all validation errors.
+ * @param StructuralDBElement|null $parent the element which will be used as parent element for new elements
+ * @param array $errors an associative array containing all validation errors
*
- * @return StructuralDBElement[] An array containing all valid imported entities (with the type $class_name)
+ * @return StructuralDBElement[] An array containing all valid imported entities (with the type $class_name)
*/
public function massCreation(string $lines, string $class_name, ?StructuralDBElement $parent = null, array &$errors = []): array
{
@@ -72,7 +71,7 @@ class EntityImporter
if (!is_a($class_name, StructuralDBElement::class, true)) {
throw new \InvalidArgumentException('$class_name must be a StructuralDBElement type!');
}
- if ($parent !== null && !is_a($parent, $class_name)) {
+ if (null !== $parent && !is_a($parent, $class_name)) {
throw new \InvalidArgumentException('$parent must have the same type as specified in $class_name!');
}
@@ -81,7 +80,7 @@ class EntityImporter
foreach ($names as $name) {
$name = trim($name);
- if ($name === '') {
+ if ('' === $name) {
//Skip empty lines (StrucuralDBElements must have a name)
continue;
}
@@ -108,9 +107,9 @@ class EntityImporter
* This methods deserializes the given file and saves it database.
* The imported elements will be checked (validated) before written to database.
*
- * @param File $file The file that should be used for importing.
- * @param string $class_name The class name of the enitity that should be imported.
- * @param array $options Options for the import process.
+ * @param File $file the file that should be used for importing
+ * @param string $class_name the class name of the enitity that should be imported
+ * @param array $options options for the import process
*
* @return array An associative array containing an ConstraintViolationList and the entity name as key are returned,
* if an error happened during validation. When everything was successfull, the array should be empty.
@@ -156,11 +155,11 @@ class EntityImporter
*
* The imported elements will NOT be validated. If you want to use the result array, you have to validate it by yourself.
*
- * @param File $file The file that should be used for importing.
- * @param string $class_name The class name of the enitity that should be imported.
- * @param array $options Options for the import process.
+ * @param File $file the file that should be used for importing
+ * @param string $class_name the class name of the enitity that should be imported
+ * @param array $options options for the import process
*
- * @return array An array containing the deserialized elements.
+ * @return array an array containing the deserialized elements
*/
public function fileToEntityArray(File $file, string $class_name, array $options = []): array
{
@@ -198,8 +197,8 @@ class EntityImporter
/**
* This functions corrects the parent setting based on the children value of the parent.
*
- * @param iterable $entities The list of entities that should be fixed.
- * @param null $parent The parent, to which the entity should be set.
+ * @param iterable $entities the list of entities that should be fixed
+ * @param null $parent the parent, to which the entity should be set
*/
protected function correctParentEntites(iterable $entities, $parent = null)
{
diff --git a/src/Services/EntityURLGenerator.php b/src/Services/EntityURLGenerator.php
index ddc1299c..e6e27381 100644
--- a/src/Services/EntityURLGenerator.php
+++ b/src/Services/EntityURLGenerator.php
@@ -63,7 +63,7 @@ class EntityURLGenerator
* Throws an exception if the entity class is not known to the map.
*
* @param array $map The map that should be used for determing the controller
- * @param $entity mixed The entity for which the controller name should be determined.
+ * @param $entity mixed The entity for which the controller name should be determined
*
* @return string The name of the controller fitting the entity class
*
@@ -93,13 +93,13 @@ class EntityURLGenerator
* For the given types, the [type]URL() functions are called (e.g. infoURL()).
* Not all entity class and $type combinations are supported.
*
- * @param $entity mixed The element for which the page should be generated.
+ * @param $entity mixed The element for which the page should be generated
* @param string $type The page type. Currently supported: 'info', 'edit', 'create', 'clone', 'list'/'list_parts'
*
- * @return string The link to the desired page.
+ * @return string the link to the desired page
*
- * @throws EntityNotSupportedException Thrown if the entity is not supported for the given type.
- * @throws \InvalidArgumentException Thrown if the givent type is not existing.
+ * @throws EntityNotSupportedException thrown if the entity is not supported for the given type
+ * @throws \InvalidArgumentException thrown if the givent type is not existing
*/
public function getURL($entity, string $type)
{
@@ -157,7 +157,7 @@ class EntityURLGenerator
/**
* Generates an URL to a page, where info about this entity can be viewed.
*
- * @param $entity mixed The entity for which the info should be generated.
+ * @param $entity mixed The entity for which the info should be generated
*
* @return string The URL to the info page
*
@@ -188,9 +188,9 @@ class EntityURLGenerator
/**
* Generates an URL to a page, where this entity can be edited.
*
- * @param $entity mixed The entity for which the edit link should be generated.
+ * @param $entity mixed The entity for which the edit link should be generated
*
- * @return string The URL to the edit page.
+ * @return string the URL to the edit page
*
* @throws EntityNotSupportedException If the method is not supported for the given Entity
*/
@@ -217,9 +217,9 @@ class EntityURLGenerator
/**
* Generates an URL to a page, where a entity of this type can be created.
*
- * @param $entity mixed The entity for which the link should be generated.
+ * @param $entity mixed The entity for which the link should be generated
*
- * @return string The URL to the page.
+ * @return string the URL to the page
*
* @throws EntityNotSupportedException If the method is not supported for the given Entity
*/
@@ -247,9 +247,9 @@ class EntityURLGenerator
* Generates an URL to a page, where a new entity can be created, that has the same informations as the
* given entity (element cloning).
*
- * @param $entity mixed The entity for which the link should be generated.
+ * @param $entity mixed The entity for which the link should be generated
*
- * @return string The URL to the page.
+ * @return string the URL to the page
*
* @throws EntityNotSupportedException If the method is not supported for the given Entity
*/
@@ -265,9 +265,9 @@ class EntityURLGenerator
/**
* Generates an URL to a page, where all parts are listed, which are contained in the given element.
*
- * @param $entity mixed The entity for which the link should be generated.
+ * @param $entity mixed The entity for which the link should be generated
*
- * @return string The URL to the page.
+ * @return string the URL to the page
*
* @throws EntityNotSupportedException If the method is not supported for the given Entity
*/
diff --git a/src/Services/FAIconGenerator.php b/src/Services/FAIconGenerator.php
index 820e117d..e5363a1a 100644
--- a/src/Services/FAIconGenerator.php
+++ b/src/Services/FAIconGenerator.php
@@ -21,7 +21,6 @@
namespace App\Services;
-
use App\Entity\Attachments\Attachment;
class FAIconGenerator
@@ -42,19 +41,21 @@ class FAIconGenerator
/**
* Gets the Font awesome icon class for a file with the specified extension.
- * For example 'pdf' gives you 'fa-file-pdf'
+ * For example 'pdf' gives you 'fa-file-pdf'.
+ *
* @param string $extension The file extension (without dot). Must be ASCII chars only!
+ *
* @return string The fontawesome class with leading 'fa-'
*/
- public function fileExtensionToFAType(string $extension) : string
+ public function fileExtensionToFAType(string $extension): string
{
- if ($extension === '') {
+ if ('' === $extension) {
throw new \InvalidArgumentException('You must specify an extension!');
}
//Normalize file extension
$extension = strtolower($extension);
foreach (self::EXT_MAPPING as $fa => $exts) {
- if (in_array($extension, $exts, true)) {
+ if (\in_array($extension, $exts, true)) {
return $fa;
}
}
@@ -65,13 +66,15 @@ class FAIconGenerator
/**
* Returns HTML code to show the given fontawesome icon.
- * E.g.
+ * E.g. .
+ *
* @param string $icon_class The icon which should be shown (e.g. fa-file-text)
- * @param string $style The style of the icon 'fas'
- * @param string $options Any other css class attributes like size, etc.
+ * @param string $style The style of the icon 'fas'
+ * @param string $options Any other css class attributes like size, etc.
+ *
* @return string The final html
*/
- public function generateIconHTML(string $icon_class, string $style = 'fas', string $options = '') : string
+ public function generateIconHTML(string $icon_class, string $style = 'fas', string $options = ''): string
{
//XSS protection
$icon_class = htmlspecialchars($icon_class);
@@ -85,4 +88,4 @@ class FAIconGenerator
$options
);
}
-}
\ No newline at end of file
+}
diff --git a/src/Services/MarkdownParser.php b/src/Services/MarkdownParser.php
index ec05621e..104a0710 100644
--- a/src/Services/MarkdownParser.php
+++ b/src/Services/MarkdownParser.php
@@ -39,10 +39,10 @@ class MarkdownParser
* Mark the markdown for rendering.
* The rendering of markdown is done on client side.
*
- * @param string $markdown The markdown text that should be parsed to html.
+ * @param string $markdown the markdown text that should be parsed to html
* @param bool $inline_mode Only allow inline markdown codes like (*bold* or **italic**), not something like tables
*
- * @return string The markdown in a version that can be parsed on client side.
+ * @return string the markdown in a version that can be parsed on client side
*/
public function markForRendering(string $markdown, bool $inline_mode = false): string
{
diff --git a/src/Services/MoneyFormatter.php b/src/Services/MoneyFormatter.php
index 62f5040d..8cb53a73 100644
--- a/src/Services/MoneyFormatter.php
+++ b/src/Services/MoneyFormatter.php
@@ -38,10 +38,10 @@ class MoneyFormatter
/**
* Format the the given value in the given currency.
*
- * @param string|float $value The value that should be formatted.
+ * @param string|float $value the value that should be formatted
* @param Currency|null $currency The currency that should be used for formatting. If null the global one is used
- * @param int $decimals The number of decimals that should be shown.
- * @param bool $show_all_digits If set to true, all digits are shown, even if they are null.
+ * @param int $decimals the number of decimals that should be shown
+ * @param bool $show_all_digits if set to true, all digits are shown, even if they are null
*
* @return string
*/
diff --git a/src/Services/PasswordResetManager.php b/src/Services/PasswordResetManager.php
index d573b3d9..bc643224 100644
--- a/src/Services/PasswordResetManager.php
+++ b/src/Services/PasswordResetManager.php
@@ -21,7 +21,6 @@
namespace App\Services;
-
use App\Entity\UserSystem\User;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
@@ -46,20 +45,20 @@ class PasswordResetManager
{
$this->em = $em;
$this->mailer = $mailer;
- /** @var PasswordEncoderInterface passwordEncoder */
+ /* @var PasswordEncoderInterface passwordEncoder */
$this->passwordEncoder = $encoderFactory->getEncoder(User::class);
$this->translator = $translator;
$this->userPasswordEncoder = $userPasswordEncoder;
}
- public function request(string $name_or_email) : void
+ public function request(string $name_or_email): void
{
$repo = $this->em->getRepository(User::class);
//Try to find a user by the given string
$user = $repo->findByEmailOrName($name_or_email);
//Do nothing if no user was found
- if ($user === null) {
+ if (null === $user) {
return;
}
@@ -76,11 +75,11 @@ class PasswordResetManager
$mail = new TemplatedEmail();
$mail->to($address);
$mail->subject($this->translator->trans('pw_reset.email.subject'));
- $mail->htmlTemplate("mail/pw_reset.html.twig");
+ $mail->htmlTemplate('mail/pw_reset.html.twig');
$mail->context([
'expiration_date' => $expiration_date,
'token' => $unencrypted_token,
- 'user' => $user
+ 'user' => $user,
]);
//Send email
@@ -93,13 +92,15 @@ class PasswordResetManager
/**
* Sets the new password of the user with the given name, if the token is valid.
- * @param string $user The name of the user, which password should be reset
- * @param string $token The token that should be used to reset the password
+ *
+ * @param string $user The name of the user, which password should be reset
+ * @param string $token The token that should be used to reset the password
* @param string $new_password The new password that should be applied to user
+ *
* @return bool Returns true, if the new password was applied. False, if either the username is unknown or the
- * token is invalid or expired.
+ * token is invalid or expired.
*/
- public function setNewPassword(string $user, string $token, string $new_password) : bool
+ public function setNewPassword(string $user, string $token, string $new_password): bool
{
//Try to find the user
$repo = $this->em->getRepository(User::class);
@@ -107,7 +108,7 @@ class PasswordResetManager
$user = $repo->findOneBy(['name' => $user]);
//If no user matching the name, show an error message
- if ($user === null) {
+ if (null === $user) {
return false;
}
@@ -130,6 +131,7 @@ class PasswordResetManager
//Save to DB
$this->em->flush();
+
return true;
}
-}
\ No newline at end of file
+}
diff --git a/src/Services/PermissionResolver.php b/src/Services/PermissionResolver.php
index e047d630..1d757023 100644
--- a/src/Services/PermissionResolver.php
+++ b/src/Services/PermissionResolver.php
@@ -160,9 +160,9 @@ class PermissionResolver
/**
* Sets the new value for the operation.
*
- * @param HasPermissionsInterface $user The user or group for which the value should be changed.
- * @param string $permission The name of the permission that should be changed.
- * @param string $operation The name of the operation that should be changed.
+ * @param HasPermissionsInterface $user the user or group for which the value should be changed
+ * @param string $permission the name of the permission that should be changed
+ * @param string $operation the name of the operation that should be changed
* @param bool|null $new_val The new value for the permission. true = ALLOW, false = DISALLOW, null = INHERIT
*/
public function setPermission(HasPermissionsInterface $user, string $permission, string $operation, ?bool $new_val): void
diff --git a/src/Services/PricedetailHelper.php b/src/Services/PricedetailHelper.php
index c617c400..30361294 100644
--- a/src/Services/PricedetailHelper.php
+++ b/src/Services/PricedetailHelper.php
@@ -41,8 +41,6 @@ class PricedetailHelper
/**
* Determines the highest amount, for which you get additional discount.
* This function determines the highest min_discount_quantity for the given part.
- *
- * @return float|null
*/
public function getMaxDiscountAmount(Part $part): ?float
{
@@ -87,7 +85,7 @@ class PricedetailHelper
/**
* Determines the minimum amount of the part that can be ordered.
*
- * @param Part $part The part for which the minimum order amount should be determined.
+ * @param Part $part the part for which the minimum order amount should be determined
*
* @return float
*/
@@ -123,7 +121,7 @@ class PricedetailHelper
/**
* Calculates the average price of a part, when ordering the amount $amount.
*
- * @param Part $part The part for which the average price should be calculated.
+ * @param Part $part the part for which the average price should be calculated
* @param float $amount The order amount for which the average price should be calculated.
* If set to null, the mininmum order amount for the part is used.
* @param Currency|null $currency The currency in which the average price should be calculated
diff --git a/src/Services/SIFormatter.php b/src/Services/SIFormatter.php
index 7322c6dc..b78efdcc 100644
--- a/src/Services/SIFormatter.php
+++ b/src/Services/SIFormatter.php
@@ -30,7 +30,7 @@ class SIFormatter
* Returns the magnitude of a value (the count of decimal place of the highest decimal place).
* For example, for 100 (=10^2) this function returns 2. For -2500 (=-2.5*10^3) this function returns 3.
*
- * @param float $value The value of which the magnitude should be determined.
+ * @param float $value the value of which the magnitude should be determined
*
* @return int The magnitude of the value
*/
@@ -42,7 +42,7 @@ class SIFormatter
/**
* Returns the best SI prefix (and its corresponding divisor) for the given magnitude.
*
- * @param int $magnitude The magnitude for which the prefix should be determined.
+ * @param int $magnitude the magnitude for which the prefix should be determined
*
* @return array A array, containing the divisor in first element, and the prefix symbol in second. For example, [1000, "k"].
*/
@@ -66,9 +66,6 @@ class SIFormatter
return [10 ** (3 * $nearest), $symbol];
}
- /**
- * @return array
- */
public function convertValue(float $value): array
{
//Choose the prefix to use
@@ -88,9 +85,7 @@ class SIFormatter
*
* @param float $value The value that should be converted
* @param string $unit The unit that should be appended after the prefix
- * @param int $decimals The number of decimals (after decimal dot) that should be outputed.
- *
- * @return string
+ * @param int $decimals the number of decimals (after decimal dot) that should be outputed
*/
public function format(float $value, string $unit = '', int $decimals = 2): string
{
diff --git a/src/Services/StructuralElementRecursionHelper.php b/src/Services/StructuralElementRecursionHelper.php
index 209b7cd9..c55c3d5d 100644
--- a/src/Services/StructuralElementRecursionHelper.php
+++ b/src/Services/StructuralElementRecursionHelper.php
@@ -72,7 +72,7 @@ class StructuralElementRecursionHelper
/**
* Deletes the $element and all its subelements recursivly.
*
- * @param StructuralDBElement $element The element which should be deleted.
+ * @param StructuralDBElement $element the element which should be deleted
* @param bool $flush When set to true the changes will also be flushed to DB. Set to false if you want to flush
* later.
*/
diff --git a/src/Services/TFA/BackupCodeGenerator.php b/src/Services/TFA/BackupCodeGenerator.php
index c4009223..19debe40 100644
--- a/src/Services/TFA/BackupCodeGenerator.php
+++ b/src/Services/TFA/BackupCodeGenerator.php
@@ -22,8 +22,7 @@
namespace App\Services\TFA;
/**
- * This class generates random backup codes for two factor authentication
- * @package App\Services\TFA
+ * This class generates random backup codes for two factor authentication.
*/
class BackupCodeGenerator
{
@@ -32,8 +31,9 @@ class BackupCodeGenerator
/**
* BackupCodeGenerator constructor.
- * @param int $code_length How many characters a single code should have.
- * @param int $code_count How many codes are generated for a whole backup set.
+ *
+ * @param int $code_length How many characters a single code should have.
+ * @param int $code_count How many codes are generated for a whole backup set.
*/
public function __construct(int $code_length, int $code_count)
{
@@ -50,28 +50,31 @@ class BackupCodeGenerator
/**
* Generates a single backup code.
- * It is a random hexadecimal value with the digit count configured in constructor
+ * It is a random hexadecimal value with the digit count configured in constructor.
+ *
* @return string The generated backup code (e.g. 1f3870be2)
+ *
* @throws \Exception If no entropy source is available.
*/
- public function generateSingleCode() : string
+ public function generateSingleCode(): string
{
$bytes = random_bytes(32);
+
return substr(md5($bytes), 0, $this->code_length);
}
-
/**
- * Returns a full backup code set. The code count can be configured in the constructor
+ * Returns a full backup code set. The code count can be configured in the constructor.
+ *
* @return string[] An array containing different backup codes.
*/
- public function generateCodeSet() : array
+ public function generateCodeSet(): array
{
$array = [];
- for($n=0; $n<$this->code_count; $n++) {
+ for ($n = 0; $n < $this->code_count; ++$n) {
$array[] = $this->generateSingleCode();
}
return $array;
}
-}
\ No newline at end of file
+}
diff --git a/src/Services/TFA/BackupCodeManager.php b/src/Services/TFA/BackupCodeManager.php
index 7bdc0e9e..9a66d570 100644
--- a/src/Services/TFA/BackupCodeManager.php
+++ b/src/Services/TFA/BackupCodeManager.php
@@ -21,12 +21,10 @@
namespace App\Services\TFA;
-
use App\Entity\UserSystem\User;
/**
- * This services offers methods to manage backup codes for two factor authentication
- * @package App\Services\TFA
+ * This services offers methods to manage backup codes for two factor authentication.
*/
class BackupCodeManager
{
@@ -39,23 +37,21 @@ class BackupCodeManager
/**
* Enable backup codes for the given user, by generating a set of backup codes.
- * If the backup codes were already enabled before, they a
- * @param User $user
+ * If the backup codes were already enabled before, they a.
*/
public function enableBackupCodes(User $user)
{
- if(empty($user->getBackupCodes())) {
- $this->regenerateBackupCodes($user);
+ if (empty($user->getBackupCodes())) {
+ $this->regenerateBackupCodes($user);
}
}
/**
* Disable (remove) the backup codes when no other 2 factor authentication methods are enabled.
- * @param User $user
*/
public function disableBackupCodesIfUnused(User $user)
{
- if($user->isGoogleAuthenticatorEnabled()) {
+ if ($user->isGoogleAuthenticatorEnabled()) {
return;
}
@@ -65,11 +61,12 @@ class BackupCodeManager
/**
* Generates a new set of backup codes for the user. If no backup codes were available before, new ones are
* generated.
- * @param User $user The user for which the backup codes should be regenerated
+ *
+ * @param User $user The user for which the backup codes should be regenerated
*/
public function regenerateBackupCodes(User $user)
{
$codes = $this->backupCodeGenerator->generateCodeSet();
$user->setBackupCodes($codes);
}
-}
\ No newline at end of file
+}
diff --git a/src/Services/TagFinder.php b/src/Services/TagFinder.php
index 1b0b1615..65947ddf 100644
--- a/src/Services/TagFinder.php
+++ b/src/Services/TagFinder.php
@@ -52,7 +52,7 @@ class TagFinder
* @param string $keyword The keyword the tag must begin with
* @param array $options Some options specifying the search behavior. See configureOptions for possible options.
*
- * @return string[] An array containing the tags that match the given keyword.
+ * @return string[] an array containing the tags that match the given keyword
*/
public function searchTags(string $keyword, array $options = [])
{
diff --git a/src/Services/Trees/NodesListBuilder.php b/src/Services/Trees/NodesListBuilder.php
index 1a28c950..4c20e30a 100644
--- a/src/Services/Trees/NodesListBuilder.php
+++ b/src/Services/Trees/NodesListBuilder.php
@@ -21,17 +21,12 @@
namespace App\Services\Trees;
-use App\Entity\Base\DBElement;
-use App\Entity\Base\NamedDBElement;
use App\Entity\Base\StructuralDBElement;
-use App\Helpers\Trees\TreeViewNode;
use App\Repository\StructuralDBElementRepository;
-use App\Services\EntityURLGenerator;
use App\Services\UserCacheKeyGenerator;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Contracts\Cache\ItemInterface;
use Symfony\Contracts\Cache\TagAwareCacheInterface;
-use Symfony\Contracts\Translation\TranslatorInterface;
/**
* This service gives you a flat list containing all structured entities in the order of the structure.
@@ -42,7 +37,7 @@ class NodesListBuilder
protected $cache;
protected $keyGenerator;
- public function __construct( EntityManagerInterface $em, TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator)
+ public function __construct(EntityManagerInterface $em, TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator)
{
$this->em = $em;
$this->keyGenerator = $keyGenerator;
diff --git a/src/Services/Trees/TreeViewGenerator.php b/src/Services/Trees/TreeViewGenerator.php
index b6aaa300..264f5677 100644
--- a/src/Services/Trees/TreeViewGenerator.php
+++ b/src/Services/Trees/TreeViewGenerator.php
@@ -21,12 +21,11 @@
namespace App\Services\Trees;
-
use App\Entity\Base\DBElement;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\StructuralDBElement;
-use App\Helpers\Trees\TreeViewNodeIterator;
use App\Helpers\Trees\TreeViewNode;
+use App\Helpers\Trees\TreeViewNodeIterator;
use App\Repository\StructuralDBElementRepository;
use App\Services\EntityURLGenerator;
use App\Services\UserCacheKeyGenerator;
@@ -37,7 +36,6 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class TreeViewGenerator
{
-
protected $urlGenerator;
protected $em;
protected $cache;
@@ -56,14 +54,16 @@ class TreeViewGenerator
/**
* Gets a TreeView list for the entities of the given class.
- * @param string $class The class for which the treeView should be generated
- * @param StructuralDBElement|null $parent The root nodes in the tree should have this element as parent (use null, if you want to get all entities)
- * @param string $href_type The link type that will be generated for the hyperlink section of each node (see EntityURLGenerator for possible values).
- * Set to empty string, to disable href field.
- * @param DBElement|null $selectedElement The element that should be selected. If set to null, no element will be selected.
+ *
+ * @param string $class The class for which the treeView should be generated
+ * @param StructuralDBElement|null $parent The root nodes in the tree should have this element as parent (use null, if you want to get all entities)
+ * @param string $href_type The link type that will be generated for the hyperlink section of each node (see EntityURLGenerator for possible values).
+ * Set to empty string, to disable href field.
+ * @param DBElement|null $selectedElement The element that should be selected. If set to null, no element will be selected.
+ *
* @return TreeViewNode[] An array of TreeViewNode[] elements of the root elements.
*/
- public function getTreeView(string $class, ?StructuralDBElement $parent = null, string $href_type = 'list_parts', DBElement $selectedElement = null) : array
+ public function getTreeView(string $class, ?StructuralDBElement $parent = null, string $href_type = 'list_parts', DBElement $selectedElement = null): array
{
$head = [];
@@ -89,8 +89,8 @@ class TreeViewGenerator
$recursiveIterator = new \RecursiveIteratorIterator($treeIterator, \RecursiveIteratorIterator::SELF_FIRST);
foreach ($recursiveIterator as $item) {
/** @var $item TreeViewNode */
- if ($selectedElement !== null && $item->getId() === $selectedElement->getID()) {
- $item->setSelected(true);
+ if (null !== $selectedElement && $item->getId() === $selectedElement->getID()) {
+ $item->setSelected(true);
}
if (!empty($item->getNodes())) {
@@ -111,16 +111,17 @@ class TreeViewGenerator
* Gets a tree of TreeViewNode elements. The root elements has $parent as parent.
* The treeview is generic, that means the href are null and ID values are set.
*
- * @param string $class The class for which the tree should be generated
- * @param StructuralDBElement|null $parent The parent the root elements should have.
+ * @param string $class The class for which the tree should be generated
+ * @param StructuralDBElement|null $parent The parent the root elements should have.
+ *
* @return TreeViewNode[]
*/
- public function getGenericTree(string $class, ?StructuralDBElement $parent = null) : array
+ public function getGenericTree(string $class, ?StructuralDBElement $parent = null): array
{
- if(!is_a($class, NamedDBElement::class, true)) {
+ if (!is_a($class, NamedDBElement::class, true)) {
throw new \InvalidArgumentException('$class must be a class string that implements StructuralDBElement or NamedDBElement!');
}
- if($parent !== null && !is_a($parent, $class)) {
+ if (null !== $parent && !is_a($parent, $class)) {
throw new \InvalidArgumentException('$parent must be of the type $class!');
}
@@ -128,8 +129,8 @@ class TreeViewGenerator
$repo = $this->em->getRepository($class);
//If we just want a part of a tree, dont cache it
- if ($parent !== null) {
- return $repo->getGenericNodeTree($parent);
+ if (null !== $parent) {
+ return $repo->getGenericNodeTree($parent);
}
$secure_class_name = str_replace('\\', '_', $class);
@@ -138,9 +139,10 @@ class TreeViewGenerator
$ret = $this->cache->get($key, function (ItemInterface $item) use ($repo, $parent, $secure_class_name) {
// Invalidate when groups, a element with the class or the user changes
$item->tag(['groups', 'tree_treeview', $this->keyGenerator->generateKey(), $secure_class_name]);
+
return $repo->getGenericNodeTree($parent);
});
return $ret;
}
-}
\ No newline at end of file
+}
diff --git a/src/Services/UserCacheKeyGenerator.php b/src/Services/UserCacheKeyGenerator.php
index 7f7fa4e4..27455f8d 100644
--- a/src/Services/UserCacheKeyGenerator.php
+++ b/src/Services/UserCacheKeyGenerator.php
@@ -41,8 +41,6 @@ class UserCacheKeyGenerator
*
* @param User|null $user The user for which the key should be generated. When set to null, the currently logged in
* user is used.
- *
- * @return string
*/
public function generateKey(User $user = null): string
{
diff --git a/src/Twig/AppExtension.php b/src/Twig/AppExtension.php
index 17208872..319cf670 100644
--- a/src/Twig/AppExtension.php
+++ b/src/Twig/AppExtension.php
@@ -31,7 +31,6 @@ use App\Services\FAIconGenerator;
use App\Services\MarkdownParser;
use App\Services\MoneyFormatter;
use App\Services\SIFormatter;
-use App\Services\Trees\NodesListBuilder;
use App\Services\Trees\TreeViewGenerator;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
diff --git a/src/Validator/Constraints/ValidGoogleAuthCode.php b/src/Validator/Constraints/ValidGoogleAuthCode.php
index 457d378c..895c6726 100644
--- a/src/Validator/Constraints/ValidGoogleAuthCode.php
+++ b/src/Validator/Constraints/ValidGoogleAuthCode.php
@@ -21,10 +21,8 @@
namespace App\Validator\Constraints;
-
use Symfony\Component\Validator\Constraint;
class ValidGoogleAuthCode extends Constraint
{
-
-}
\ No newline at end of file
+}
diff --git a/src/Validator/Constraints/ValidGoogleAuthCodeValidator.php b/src/Validator/Constraints/ValidGoogleAuthCodeValidator.php
index 043a131f..6cf362a6 100644
--- a/src/Validator/Constraints/ValidGoogleAuthCodeValidator.php
+++ b/src/Validator/Constraints/ValidGoogleAuthCodeValidator.php
@@ -21,10 +21,8 @@
namespace App\Validator\Constraints;
-
use App\Entity\UserSystem\User;
use Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticator;
-use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
@@ -33,7 +31,6 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException;
class ValidGoogleAuthCodeValidator extends ConstraintValidator
{
-
protected $googleAuthenticator;
public function __construct(GoogleAuthenticator $googleAuthenticator)
@@ -42,7 +39,7 @@ class ValidGoogleAuthCodeValidator extends ConstraintValidator
}
/**
- * @inheritDoc
+ * {@inheritdoc}
*/
public function validate($value, Constraint $constraint)
{
@@ -58,26 +55,25 @@ class ValidGoogleAuthCodeValidator extends ConstraintValidator
throw new UnexpectedValueException($value, 'string');
}
- if(!ctype_digit($value)) {
+ if (!ctype_digit($value)) {
$this->context->addViolation('validator.google_code.only_digits_allowed');
}
//Number must have 6 digits
- if(strlen($value) !== 6) {
+ if (6 !== \strlen($value)) {
$this->context->addViolation('validator.google_code.wrong_digit_count');
}
//Try to retrieve the user we want to check
- if($this->context->getObject() instanceof FormInterface &&
+ if ($this->context->getObject() instanceof FormInterface &&
$this->context->getObject()->getParent() instanceof FormInterface
&& $this->context->getObject()->getParent()->getData() instanceof User) {
$user = $this->context->getObject()->getParent()->getData();
//Check if the given code is valid
- if(!$this->googleAuthenticator->checkCode($user, $value)) {
+ if (!$this->googleAuthenticator->checkCode($user, $value)) {
$this->context->addViolation('validator.google_code.wrong_code');
}
-
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/ApplicationAvailabilityFunctionalTest.php b/tests/ApplicationAvailabilityFunctionalTest.php
index ff9abb2b..4133db22 100644
--- a/tests/ApplicationAvailabilityFunctionalTest.php
+++ b/tests/ApplicationAvailabilityFunctionalTest.php
@@ -21,12 +21,11 @@
namespace App\Tests;
-
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
- * This test just ensures that different pages are available (do not throw an exception)
- * @package App\Tests
+ * This test just ensures that different pages are available (do not throw an exception).
+ *
* @group DB
* @group slow
*/
@@ -35,10 +34,10 @@ class ApplicationAvailabilityFunctionalTest extends WebTestCase
/**
* @dataProvider urlProvider
*/
- public function testPageIsSuccessful(string $url) : void
+ public function testPageIsSuccessful(string $url): void
{
//We have localized routes
- $url = '/en' . $url;
+ $url = '/en'.$url;
//Try to access pages with admin, because he should be able to view every page!
$client = static::createClient([], [
@@ -48,10 +47,9 @@ class ApplicationAvailabilityFunctionalTest extends WebTestCase
$client->request('GET', $url);
- $this->assertTrue($client->getResponse()->isSuccessful(), 'Request not successful. Status code is ' . $client->getResponse()->getStatusCode());
+ $this->assertTrue($client->getResponse()->isSuccessful(), 'Request not successful. Status code is '.$client->getResponse()->getStatusCode());
}
-
public function urlProvider()
{
//Homepage
@@ -92,4 +90,4 @@ class ApplicationAvailabilityFunctionalTest extends WebTestCase
yield ['/typeahead/builtInResources/search/DIP8'];
yield ['/typeahead/tags/search/test'];
}
-}
\ No newline at end of file
+}
diff --git a/tests/Controller/RedirectControllerTest.php b/tests/Controller/RedirectControllerTest.php
index ac77d8e3..da024a64 100644
--- a/tests/Controller/RedirectControllerTest.php
+++ b/tests/Controller/RedirectControllerTest.php
@@ -35,7 +35,7 @@ class RedirectControllerTest extends WebTestCase
protected $userRepo;
protected $client;
- public function setUp() : void
+ public function setUp(): void
{
$this->client = static::createClient([], [
'PHP_AUTH_USER' => 'user',
@@ -114,8 +114,6 @@ class RedirectControllerTest extends WebTestCase
$user->setLanguage($user_locale);
$this->em->flush();
-
-
$this->client->followRedirects(false);
$this->client->request('GET', $input_path);
$this->assertEquals($redirect_path, $this->client->getResponse()->headers->get('Location'));
diff --git a/tests/Entity/StructuralDBElementTest.php b/tests/Entity/StructuralDBElementTest.php
index cd4cb5bf..bc431627 100644
--- a/tests/Entity/StructuralDBElementTest.php
+++ b/tests/Entity/StructuralDBElementTest.php
@@ -39,7 +39,7 @@ class StructuralDBElementTest extends TestCase
protected $child1_1;
protected $child1_2;
- public function setUp() : void
+ public function setUp(): void
{
parent::setUp(); // TODO: Change the autogenerated stub
diff --git a/tests/Entity/UserSystem/PermissionsEmbedTest.php b/tests/Entity/UserSystem/PermissionsEmbedTest.php
index db62308a..ef7c7be7 100644
--- a/tests/Entity/UserSystem/PermissionsEmbedTest.php
+++ b/tests/Entity/UserSystem/PermissionsEmbedTest.php
@@ -27,7 +27,6 @@ use PHPUnit\Framework\TestCase;
class PermissionsEmbedTest extends TestCase
{
-
public function testGetPermissionValue()
{
$embed = new PermissionsEmbed();
diff --git a/tests/Entity/UserSystem/UserTest.php b/tests/Entity/UserSystem/UserTest.php
index 6290aad2..6a4a43ff 100644
--- a/tests/Entity/UserSystem/UserTest.php
+++ b/tests/Entity/UserSystem/UserTest.php
@@ -38,12 +38,12 @@ class UserTest extends TestCase
$this->assertEquals('John Doe (username)', $user->getFullName(true));
}
- public function googleAuthenticatorEnabledDataProvider() : array
+ public function googleAuthenticatorEnabledDataProvider(): array
{
return [
[null, false],
['', false],
- ['SSSk38498', true]
+ ['SSSk38498', true],
];
}
@@ -54,7 +54,7 @@ class UserTest extends TestCase
{
$user = new User();
$user->setGoogleAuthenticatorSecret($secret);
- $this->assertSame($expected ,$user->isGoogleAuthenticatorEnabled());
+ $this->assertSame($expected, $user->isGoogleAuthenticatorEnabled());
}
/**
@@ -63,7 +63,7 @@ class UserTest extends TestCase
public function testSetBackupCodes()
{
$user = new User();
- $codes = ["test", "invalid", "test"];
+ $codes = ['test', 'invalid', 'test'];
$user->setBackupCodes($codes);
// Backup Codes generation date must be changed!
$this->assertEqualsWithDelta(new \DateTime(), $user->getBackupCodesGenerationDate(), 0.1);
diff --git a/tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php b/tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php
index 49a63946..f152f617 100644
--- a/tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php
+++ b/tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php
@@ -29,7 +29,6 @@ use PHPUnit\Framework\TestCase;
class PasswordChangeNeededSubscriberTest extends TestCase
{
-
public function testTFARedirectNeeded()
{
$user = new User();
@@ -55,6 +54,5 @@ class PasswordChangeNeededSubscriberTest extends TestCase
$user->setGoogleAuthenticatorSecret(null);
$user->addU2FKey(new U2FKey());
$this->assertFalse(PasswordChangeNeededSubscriber::TFARedirectNeeded($user));
-
}
}
diff --git a/tests/Helpers/BBCodeToMarkdownConverterTest.php b/tests/Helpers/BBCodeToMarkdownConverterTest.php
index 0becdb9d..500ce97c 100644
--- a/tests/Helpers/BBCodeToMarkdownConverterTest.php
+++ b/tests/Helpers/BBCodeToMarkdownConverterTest.php
@@ -28,7 +28,7 @@ class BBCodeToMarkdownConverterTest extends TestCase
{
protected $converter;
- public function setUp() : void
+ public function setUp(): void
{
$this->converter = new BBCodeToMarkdownConverter();
}
diff --git a/tests/Helpers/TreeViewNodeTest.php b/tests/Helpers/TreeViewNodeTest.php
index eadb952c..e0115878 100644
--- a/tests/Helpers/TreeViewNodeTest.php
+++ b/tests/Helpers/TreeViewNodeTest.php
@@ -35,7 +35,7 @@ class TreeViewNodeTest extends TestCase
*/
protected $node2;
- public function setUp() : void
+ public function setUp(): void
{
$sub_nodes = [];
$sub_nodes[] = new TreeViewNode('Subnode 1');
diff --git a/tests/Repository/NamedDBElementRepositoryTest.php b/tests/Repository/NamedDBElementRepositoryTest.php
index 59020109..66414b4d 100644
--- a/tests/Repository/NamedDBElementRepositoryTest.php
+++ b/tests/Repository/NamedDBElementRepositoryTest.php
@@ -21,12 +21,9 @@
namespace App\Tests\Repository;
-use App\Entity\Attachments\AttachmentType;
use App\Entity\UserSystem\User;
use App\Helpers\Trees\TreeViewNode;
-use App\Repository\NamedDBElementRepository;
use App\Repository\StructuralDBElementRepository;
-use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
@@ -34,15 +31,14 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
class NamedDBElementRepositoryTest extends WebTestCase
{
-
private $entityManager;
/** @var StructuralDBElementRepository */
private $repo;
/**
- * {@inheritDoc}
+ * {@inheritdoc}
*/
- protected function setUp() : void
+ protected function setUp(): void
{
$kernel = self::bootKernel();
diff --git a/tests/Repository/StructuralDBElementRepositoryTest.php b/tests/Repository/StructuralDBElementRepositoryTest.php
index 51d09453..f568ee65 100644
--- a/tests/Repository/StructuralDBElementRepositoryTest.php
+++ b/tests/Repository/StructuralDBElementRepositoryTest.php
@@ -24,7 +24,6 @@ namespace App\Tests\Repository;
use App\Entity\Attachments\AttachmentType;
use App\Helpers\Trees\TreeViewNode;
use App\Repository\StructuralDBElementRepository;
-use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
@@ -32,15 +31,14 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
class StructuralDBElementRepositoryTest extends WebTestCase
{
-
private $entityManager;
/** @var StructuralDBElementRepository */
private $repo;
/**
- * {@inheritDoc}
+ * {@inheritdoc}
*/
- protected function setUp() : void
+ protected function setUp(): void
{
$kernel = self::bootKernel();
@@ -51,7 +49,7 @@ class StructuralDBElementRepositoryTest extends WebTestCase
$this->repo = $this->entityManager->getRepository(AttachmentType::class);
}
- public function testFindRootNodes() : void
+ public function testFindRootNodes(): void
{
$root_nodes = $this->repo->findRootNodes();
$this->assertCount(3, $root_nodes);
@@ -63,7 +61,7 @@ class StructuralDBElementRepositoryTest extends WebTestCase
$this->assertEquals('Node 3', $root_nodes[2]->getName());
}
- public function testGetGenericTree() : void
+ public function testGetGenericTree(): void
{
$tree = $this->repo->getGenericNodeTree();
$this->assertIsArray($tree);
@@ -86,13 +84,12 @@ class StructuralDBElementRepositoryTest extends WebTestCase
$this->assertEquals(1, $tree[0]->getId());
$this->assertEquals(2, $tree[1]->getId());
$this->assertEquals(7, $tree[0]->getNodes()[0]->getNodes()[0]->getId());
-
}
/**
- * Test $repo->toNodesList() for null as parameter
+ * Test $repo->toNodesList() for null as parameter.
*/
- public function testToNodesListRoot() : void
+ public function testToNodesListRoot(): void
{
//List all root nodes and their children
$nodes = $this->repo->toNodesList();
@@ -108,7 +105,7 @@ class StructuralDBElementRepositoryTest extends WebTestCase
$this->assertEquals('Node 3', $nodes[6]->getName());
}
- public function testToNodesListElement() : void
+ public function testToNodesListElement(): void
{
//List all nodes that are children to Node 1
$node1 = $this->repo->find(1);
diff --git a/tests/Security/Annotations/ColumnSecurityTest.php b/tests/Security/Annotations/ColumnSecurityTest.php
index b867853f..51d7959d 100644
--- a/tests/Security/Annotations/ColumnSecurityTest.php
+++ b/tests/Security/Annotations/ColumnSecurityTest.php
@@ -21,7 +21,6 @@
namespace App\Tests\Security\Annotations;
-
use App\Entity\Attachments\AttachmentType;
use App\Security\Annotations\ColumnSecurity;
use PHPUnit\Framework\TestCase;
@@ -48,7 +47,7 @@ class ColumnSecurityTest extends TestCase
$this->assertEquals('prefix.overwritten', $annotation->getEditOperationName());
}
- public function placeholderScalarDataProvider() : array
+ public function placeholderScalarDataProvider(): array
{
return [
['string', '???'],
@@ -64,7 +63,7 @@ class ColumnSecurityTest extends TestCase
/**
* @dataProvider placeholderScalarDataProvider
- * @param string $type
+ *
* @param $expected_value
*/
public function testGetPlaceholderScalar(string $type, $expected_value)
@@ -84,7 +83,7 @@ class ColumnSecurityTest extends TestCase
$this->assertCount(1, $annotation->getPlaceholder());
//If a placeholder is specified we allow every type
- $annotation->type = "type2";
+ $annotation->type = 'type2';
$annotation->placeholder = 'invalid';
$this->assertEquals('invalid', $annotation->getPlaceholder());
}
@@ -104,4 +103,4 @@ class ColumnSecurityTest extends TestCase
$this->assertInstanceOf(AttachmentType::class, $placeholder);
$this->assertEquals('test', $placeholder->getName());
}
-}
\ No newline at end of file
+}
diff --git a/tests/Security/UserCheckerTest.php b/tests/Security/UserCheckerTest.php
index 8ab27574..edb17f74 100644
--- a/tests/Security/UserCheckerTest.php
+++ b/tests/Security/UserCheckerTest.php
@@ -21,7 +21,6 @@
namespace App\Tests\Security;
-
use App\Entity\UserSystem\User;
use App\Security\UserChecker;
use PHPUnit\Framework\TestCase;
@@ -31,7 +30,7 @@ class UserCheckerTest extends TestCase
{
protected $service;
- public function setUp() : void
+ public function setUp(): void
{
$this->service = new UserChecker();
}
@@ -49,4 +48,4 @@ class UserCheckerTest extends TestCase
$this->expectException(DisabledException::class);
$this->service->checkPostAuth($user);
}
-}
\ No newline at end of file
+}
diff --git a/tests/Services/AmountFormatterTest.php b/tests/Services/AmountFormatterTest.php
index 676f617b..c1aa6826 100644
--- a/tests/Services/AmountFormatterTest.php
+++ b/tests/Services/AmountFormatterTest.php
@@ -32,7 +32,7 @@ class AmountFormatterTest extends WebTestCase
*/
protected $service;
- public function setUp() : void
+ public function setUp(): void
{
parent::setUp(); // TODO: Change the autogenerated stub
diff --git a/tests/Services/Attachments/AttachmentPathResolverTest.php b/tests/Services/Attachments/AttachmentPathResolverTest.php
index 164e02a6..19093550 100644
--- a/tests/Services/Attachments/AttachmentPathResolverTest.php
+++ b/tests/Services/Attachments/AttachmentPathResolverTest.php
@@ -48,7 +48,7 @@ class AttachmentPathResolverTest extends WebTestCase
self::$footprint_path = self::$projectDir.'/public/img/footprints';
}
- public static function setUpBeforeClass() : void
+ public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
diff --git a/tests/Services/Attachments/AttachmentURLGeneratorTest.php b/tests/Services/Attachments/AttachmentURLGeneratorTest.php
index 47d5ffe1..cf094c72 100644
--- a/tests/Services/Attachments/AttachmentURLGeneratorTest.php
+++ b/tests/Services/Attachments/AttachmentURLGeneratorTest.php
@@ -30,7 +30,7 @@ class AttachmentURLGeneratorTest extends WebTestCase
protected static $service;
- public static function setUpBeforeClass() : void
+ public static function setUpBeforeClass(): void
{
//Get an service instance.
self::bootKernel();
diff --git a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php
index 6f74830d..43329df7 100644
--- a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php
+++ b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php
@@ -34,7 +34,7 @@ class BuiltinAttachmentsFinderTest extends WebTestCase
'%FOOTPRINTS_3D%/test.jpg', '%FOOTPRINTS_3D%/hallo.txt',
];
- public static function setUpBeforeClass() : void
+ public static function setUpBeforeClass(): void
{
//Get an service instance.
self::bootKernel();
diff --git a/tests/Services/Attachments/FileTypeFilterToolsTest.php b/tests/Services/Attachments/FileTypeFilterToolsTest.php
index d93354ab..b4d940f4 100644
--- a/tests/Services/Attachments/FileTypeFilterToolsTest.php
+++ b/tests/Services/Attachments/FileTypeFilterToolsTest.php
@@ -28,7 +28,7 @@ class FileTypeFilterToolsTest extends WebTestCase
{
protected static $service;
- public static function setUpBeforeClass() : void
+ public static function setUpBeforeClass(): void
{
self::bootKernel();
self::$service = self::$container->get(FileTypeFilterTools::class);
diff --git a/tests/Services/ElementTypeNameGeneratorTest.php b/tests/Services/ElementTypeNameGeneratorTest.php
index 4a90e964..1fdf4aff 100644
--- a/tests/Services/ElementTypeNameGeneratorTest.php
+++ b/tests/Services/ElementTypeNameGeneratorTest.php
@@ -21,7 +21,6 @@
namespace App\Tests\Services;
-
use App\Entity\Attachments\PartAttachment;
use App\Entity\Base\DBElement;
use App\Entity\Base\NamedDBElement;
@@ -30,7 +29,6 @@ use App\Entity\Parts\Part;
use App\Exceptions\EntityNotSupportedException;
use App\Services\AmountFormatter;
use App\Services\ElementTypeNameGenerator;
-use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class ElementTypeNameGeneratorTest extends WebTestCase
@@ -40,7 +38,7 @@ class ElementTypeNameGeneratorTest extends WebTestCase
*/
protected $service;
- public function setUp() : void
+ public function setUp(): void
{
parent::setUp();
@@ -60,7 +58,7 @@ class ElementTypeNameGeneratorTest extends WebTestCase
//Test exception for unknpwn type
$this->expectException(EntityNotSupportedException::class);
- $this->service->getLocalizedTypeLabel(new class extends DBElement {
+ $this->service->getLocalizedTypeLabel(new class() extends DBElement {
public function getIDString(): string
{
return 'Stub';
@@ -79,11 +77,11 @@ class ElementTypeNameGeneratorTest extends WebTestCase
//Test exception
$this->expectException(EntityNotSupportedException::class);
- $this->service->getTypeNameCombination(new class extends NamedDBElement {
+ $this->service->getTypeNameCombination(new class() extends NamedDBElement {
public function getIDString(): string
{
return 'Stub';
}
});
}
-}
\ No newline at end of file
+}
diff --git a/tests/Services/EntityImporterTest.php b/tests/Services/EntityImporterTest.php
index 4bdf4063..76d16284 100644
--- a/tests/Services/EntityImporterTest.php
+++ b/tests/Services/EntityImporterTest.php
@@ -21,10 +21,8 @@
namespace App\Tests\Services;
-
use App\Entity\Attachments\AttachmentType;
use App\Services\AmountFormatter;
-use App\Services\ElementTypeNameGenerator;
use App\Services\EntityImporter;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -38,7 +36,7 @@ class EntityImporterTest extends WebTestCase
*/
protected $service;
- public function setUp() : void
+ public function setUp(): void
{
parent::setUp();
@@ -84,4 +82,4 @@ class EntityImporterTest extends WebTestCase
$this->assertCount(2, $errors);
$this->assertEquals('Node 1', $errors[0]['entity']->getName());
}
-}
\ No newline at end of file
+}
diff --git a/tests/Services/FAIconGeneratorTest.php b/tests/Services/FAIconGeneratorTest.php
index ceef26df..0d1498b3 100644
--- a/tests/Services/FAIconGeneratorTest.php
+++ b/tests/Services/FAIconGeneratorTest.php
@@ -21,7 +21,6 @@
namespace App\Tests\Services;
-
use App\Services\FAIconGenerator;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -32,7 +31,7 @@ class FAIconGeneratorTest extends WebTestCase
*/
protected $service;
- public function setUp() : void
+ public function setUp(): void
{
parent::setUp(); // TODO: Change the autogenerated stub
@@ -41,7 +40,7 @@ class FAIconGeneratorTest extends WebTestCase
$this->service = self::$container->get(FAIconGenerator::class);
}
- public function fileExtensionDataProvider() : array
+ public function fileExtensionDataProvider(): array
{
return [
['pdf', 'fa-file-pdf'],
@@ -69,4 +68,4 @@ class FAIconGeneratorTest extends WebTestCase
$this->assertEquals('', $this->service->generateIconHTML('fa-file', 'far'));
$this->assertEquals('', $this->service->generateIconHTML('fa-file', 'far', 'fa-2x'));
}
-}
\ No newline at end of file
+}
diff --git a/tests/Services/PermissionResolverTest.php b/tests/Services/PermissionResolverTest.php
index d31022ec..055e054c 100644
--- a/tests/Services/PermissionResolverTest.php
+++ b/tests/Services/PermissionResolverTest.php
@@ -38,7 +38,7 @@ class PermissionResolverTest extends WebTestCase
protected $user_withoutGroup;
protected $group;
- public function setUp() : void
+ public function setUp(): void
{
parent::setUp(); // TODO: Change the autogenerated stub
diff --git a/tests/Services/PricedetailHelperTest.php b/tests/Services/PricedetailHelperTest.php
index c726e6ee..7fc40074 100644
--- a/tests/Services/PricedetailHelperTest.php
+++ b/tests/Services/PricedetailHelperTest.php
@@ -35,7 +35,7 @@ class PricedetailHelperTest extends WebTestCase
*/
protected $service;
- public function setUp() : void
+ public function setUp(): void
{
parent::setUp();
//Get an service instance.
diff --git a/tests/Services/SIFormatterTest.php b/tests/Services/SIFormatterTest.php
index d1798f9b..f75611af 100644
--- a/tests/Services/SIFormatterTest.php
+++ b/tests/Services/SIFormatterTest.php
@@ -31,7 +31,7 @@ class SIFormatterTest extends WebTestCase
*/
protected $service;
- public function setUp() : void
+ public function setUp(): void
{
//Get an service instance.
self::bootKernel();
diff --git a/tests/Services/TFA/BackupCodeGeneratorTest.php b/tests/Services/TFA/BackupCodeGeneratorTest.php
index cfaf2176..753b49d8 100644
--- a/tests/Services/TFA/BackupCodeGeneratorTest.php
+++ b/tests/Services/TFA/BackupCodeGeneratorTest.php
@@ -27,7 +27,7 @@ use PHPUnit\Framework\TestCase;
class BackupCodeGeneratorTest extends TestCase
{
/**
- * Test if an exception is thrown if you are using a too high code length
+ * Test if an exception is thrown if you are using a too high code length.
*/
public function testLengthUpperLimit()
{
@@ -36,7 +36,7 @@ class BackupCodeGeneratorTest extends TestCase
}
/**
- * Test if an exception is thrown if you are using a too high code length
+ * Test if an exception is thrown if you are using a too high code length.
*/
public function testLengthLowerLimit()
{
@@ -44,7 +44,6 @@ class BackupCodeGeneratorTest extends TestCase
new BackupCodeGenerator(4, 10);
}
-
public function codeLengthDataProvider()
{
return [[6], [8], [10], [16]];
diff --git a/tests/Services/TFA/BackupCodeManagerTest.php b/tests/Services/TFA/BackupCodeManagerTest.php
index fefe6488..5bef0aa8 100644
--- a/tests/Services/TFA/BackupCodeManagerTest.php
+++ b/tests/Services/TFA/BackupCodeManagerTest.php
@@ -21,7 +21,6 @@
namespace App\Tests\Services\TFA;
-use App\Entity\UserSystem\U2FKey;
use App\Entity\UserSystem\User;
use App\Services\TFA\BackupCodeManager;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -29,7 +28,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class BackupCodeManagerTest extends WebTestCase
{
/**
- * @var BackupCodeManager $service
+ * @var BackupCodeManager
*/
protected $service;
diff --git a/tests/Services/Trees/NodesListBuilderTest.php b/tests/Services/Trees/NodesListBuilderTest.php
index daaf7358..7266fe1a 100644
--- a/tests/Services/Trees/NodesListBuilderTest.php
+++ b/tests/Services/Trees/NodesListBuilderTest.php
@@ -28,13 +28,11 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @Group DB
- * @package App\Tests\Services\Trees
*/
class NodesListBuilderTest extends WebTestCase
{
-
/**
- * @var NodesListBuilder $service
+ * @var NodesListBuilder
*/
protected $service;
protected $em;
@@ -47,9 +45,9 @@ class NodesListBuilderTest extends WebTestCase
}
/**
- * Test $repo->toNodesList() for null as parameter
+ * Test $repo->toNodesList() for null as parameter.
*/
- public function testTypeToNodesListtRoot() : void
+ public function testTypeToNodesListtRoot(): void
{
//List all root nodes and their children
$nodes = $this->service->typeToNodesList(AttachmentType::class);
@@ -65,7 +63,7 @@ class NodesListBuilderTest extends WebTestCase
$this->assertEquals('Node 3', $nodes[6]->getName());
}
- public function testTypeToNodesListElement() : void
+ public function testTypeToNodesListElement(): void
{
//List all nodes that are children to Node 1
$node1 = $this->em->find(AttachmentType::class, 1);
diff --git a/tests/Services/Trees/TreeViewGeneratorTest.php b/tests/Services/Trees/TreeViewGeneratorTest.php
index 6bf666bf..43e57eaf 100644
--- a/tests/Services/Trees/TreeViewGeneratorTest.php
+++ b/tests/Services/Trees/TreeViewGeneratorTest.php
@@ -24,10 +24,8 @@ namespace App\Tests\Services\Trees;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Parts\Category;
use App\Helpers\Trees\TreeViewNode;
-use App\Services\AmountFormatter;
use App\Services\Trees\TreeViewGenerator;
use Doctrine\ORM\EntityManagerInterface;
-use PHPUnit\Framework\TestCase;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
@@ -41,7 +39,7 @@ class TreeViewGeneratorTest extends WebTestCase
protected $service;
protected $em;
- public function setUp() : void
+ public function setUp(): void
{
parent::setUp(); // TODO: Change the autogenerated stub