Magento Coding Standard (PHPCS) report for yireo/magento2-googletagmanager2 =========================================================================== Package version: 3.10.8 | Magento: 2.4.9 | Tested: 2026-10-09 3 errors, 57 warnings in 35 files ViewModel/DataLayer.php 54:11 warning Expected 1 space after CATCH keyword; 0 found (Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword) 78:11 warning Expected 1 space after CATCH keyword; 0 found (Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword) 88:31 warning array_merge(...) is used in a loop and is a resources greedy construction. (Magento2.Performance.ForeachArrayMerge.ForeachArrayMerge) 122:11 warning Expected 1 space after CATCH keyword; 0 found (Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword) DataLayer/TagParser.php 59:13 warning The use of function is_null() is discouraged; use strict comparison "=== null"() instead (Magento2.Functions.DiscouragedFunction.DiscouragedWithAlternative) DataLayer/Event/AddShippingInfo.php 84:11 warning Empty CATCH statement detected (Magento2.CodeAnalysis.EmptyBlock.DetectedCatch) 85:11 warning Empty CATCH statement detected (Magento2.CodeAnalysis.EmptyBlock.DetectedCatch) 90:11 warning Empty CATCH statement detected (Magento2.CodeAnalysis.EmptyBlock.DetectedCatch) DataLayer/Event/Purchase.php 105:9 warning Expected "if (...) {\n"; found "if (...){\n" (PEAR.ControlStructures.ControlSignature.Found) 105:33 warning Expected 1 space after closing parenthesis; found 0 (Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis) DataLayer/Mapper/ProductDataMapper.php 82:11 warning Empty CATCH statement detected (Magento2.CodeAnalysis.EmptyBlock.DetectedCatch) DataLayer/Mapper/CartItemDataMapper.php 24:1 warning Code must not contain multiple empty lines in a row; found 2 empty lines. (Magento2.Whitespace.MultipleEmptyLines.MultipleEmptyLines) DataLayer/Mapper/OrderItemDataMapper.php 25:1 warning Code must not contain multiple empty lines in a row; found 2 empty lines. (Magento2.Whitespace.MultipleEmptyLines.MultipleEmptyLines) DataLayer/Tag/Page/VirtualPage.php 24:20 warning The use of function parse_url() is discouraged (Magento2.Functions.DiscouragedFunction.Discouraged) DataLayer/Tag/EnhancedConversions.php 61:1 warning Code must not contain multiple empty lines in a row; found 2 empty lines. (Magento2.Whitespace.MultipleEmptyLines.MultipleEmptyLines) DataLayer/Tag/Version.php 25:37 warning The use of function file_get_contents() is discouraged (Magento2.Functions.DiscouragedFunction.Discouraged) Plugin/TriggerAddPaymentInfoDataLayerEvent.php 49:8 warning $subject parameter is not in order (Magento2.Annotation.MethodArguments.ParamOrder) 50:8 warning $orderId parameter is not in order (Magento2.Annotation.MethodArguments.ParamOrder) Plugin/AddDataToCustomerSection.php 64:1 warning Code must not contain multiple empty lines in a row; found 2 empty lines. (Magento2.Whitespace.MultipleEmptyLines.MultipleEmptyLines) 99:11 warning Empty CATCH statement detected (Magento2.CodeAnalysis.EmptyBlock.DetectedCatch) view/frontend/templates/iframe.phtml 23:1 warning Line indented incorrectly; expected at least 4 spaces, found 0 (Generic.WhiteSpace.ScopeIndent.Incorrect) view/frontend/templates/script.phtml 36:19 warning Expected 1 space after FOREACH keyword; 0 found (Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword) Config/XmlConfig/SchemaLocator.php 43:1 warning Multi-line function call not indented correctly; expected 12 spaces but found 16 (PSR2.Methods.FunctionCallSignature.Indent) 44:1 warning Multi-line function call not indented correctly; expected 8 spaces but found 16 (PSR2.Methods.FunctionCallSignature.Indent) 44:42 warning Closing parenthesis of a multi-line function call must be on a line by itself (PSR2.Methods.FunctionCallSignature.CloseBracketLine) Config/Config.php 278:8 warning null is not a valid PHP type (Magento2.Annotation.MethodArguments.NotValidType) 291:8 warning null is not a valid PHP type (Magento2.Annotation.MethodArguments.NotValidType) Config/Frontend/Funding.php 15:1 warning Expected 1 blank line at end of file; 2 found (PSR2.Files.EndFileNewline.TooMany) Config/Source/ViewCartOccurancesOptions.php 9:5 warning Visibility must be declared on all constants if your project supports PHP 7.1 or later (PSR12.Properties.ConstantVisibility.NotFound) 10:5 warning Visibility must be declared on all constants if your project supports PHP 7.1 or later (PSR12.Properties.ConstantVisibility.NotFound) Config/Source/ProductAttributes.php 12:5 warning Visibility must be declared on all constants if your project supports PHP 7.1 or later (PSR12.Properties.ConstantVisibility.NotFound) Util/Attribute/GetAttributeValue.php 97:31 warning The use of function call_user_func() is discouraged (Magento2.Functions.DiscouragedFunction.Discouraged) Util/PriceFormatter.php 8:4 warning Tag @package MUST NOT be used. (Magento2.Commenting.ClassAndInterfacePHPDocFormatting.ForbiddenTags) 10:1 warning Class description must contain meaningful information beyond what its name provides or be removed. (Magento2.Commenting.ClassAndInterfacePHPDocFormatting.InvalidDescription) Util/GetCategoryPath.php 14:5 warning Visibility must be declared on all constants if your project supports PHP 7.1 or later (PSR12.Properties.ConstantVisibility.NotFound) Util/CategoryProvider.php 160:15 warning Empty CATCH statement detected (Magento2.CodeAnalysis.EmptyBlock.DetectedCatch) Test/Unit/Config/ConfigTest.php 156:70 warning Expected 1 space after FUNCTION keyword; 0 found (Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction) Test/Integration/DataLayer/Event/PurchaseTest.php 40:30 warning Line exceeds 120 characters; contains 159 characters (Generic.Files.LineLength.TooLong) Test/Integration/DataLayer/Mapper/ProductDataMapperTest.php 69:30 warning Line exceeds 120 characters; contains 123 characters (Generic.Files.LineLength.TooLong) Test/Integration/DataLayer/Mapper/ItemCategoriesTest.php 59:32 error Class QuoteFactory needs to be requested in constructor, otherwise compiler will not be able to find and generate this class (Magento2.PHP.AutogeneratedClassNotInConstructor.AutogeneratedClassNotInConstructor) 76:36 error Class OrderItemInterfaceFactory needs to be requested in constructor, otherwise compiler will not be able to find and generate this class (Magento2.PHP.AutogeneratedClassNotInConstructor.AutogeneratedClassNotInConstructor) Test/Integration/_files/gtm_category_tree.php 23:50 warning Multi-line function declarations must define one parameter per line (Squiz.Functions.MultiLineFunctionDeclaration.OneParamPerLine) 23:69 warning Multi-line function declarations must define one parameter per line (Squiz.Functions.MultiLineFunctionDeclaration.OneParamPerLine) 23:92 warning Multi-line function declarations must define one parameter per line (Squiz.Functions.MultiLineFunctionDeclaration.OneParamPerLine) 68:48 warning Multi-line function declarations must define one parameter per line (Squiz.Functions.MultiLineFunctionDeclaration.OneParamPerLine) 68:62 warning Multi-line function declarations must define one parameter per line (Squiz.Functions.MultiLineFunctionDeclaration.OneParamPerLine) Test/Integration/Observer/TriggerLogoutDataLayerEventTest.php 46:1 warning Expected 1 newline at end of file; 0 found (PSR2.Files.EndFileNewline.NoneFound) Test/Integration/Observer/TriggerLoginDataLayerEventTest.php 46:1 warning Expected 1 newline at end of file; 0 found (PSR2.Files.EndFileNewline.NoneFound) Test/Integration/Observer/TriggerPurchaseDataLayerEventTest.php 36:1 warning Expected 1 newline at end of file; 0 found (PSR2.Files.EndFileNewline.NoneFound) 36:1 warning The closing brace for the class must go on the next line after the body (PSR2.Classes.ClassDeclaration.CloseBraceAfterBody) Test/Integration/PageTestCase.php 117:1 warning Code must not contain multiple empty lines in a row; found 2 empty lines. (Magento2.Whitespace.MultipleEmptyLines.MultipleEmptyLines) 119:1 warning The closing brace for the class must go on the next line after the body (PSR2.Classes.ClassDeclaration.CloseBraceAfterBody) Test/Integration/Util/ProductDataMapperTest.php 46:55 error Class ProductInterfaceFactory needs to be requested in constructor, otherwise compiler will not be able to find and generate this class (Magento2.PHP.AutogeneratedClassNotInConstructor.AutogeneratedClassNotInConstructor) Test/Integration/Util/CategoryProviderTest.php 186:121 warning Line exceeds 120 characters; contains 121 characters (Generic.Files.LineLength.TooLong) 192:30 warning Line exceeds 120 characters; contains 136 characters (Generic.Files.LineLength.TooLong) 195:122 warning Line exceeds 120 characters; contains 122 characters (Generic.Files.LineLength.TooLong) 221:30 warning Line exceeds 120 characters; contains 125 characters (Generic.Files.LineLength.TooLong) 240:123 warning Line exceeds 120 characters; contains 123 characters (Generic.Files.LineLength.TooLong) 352:124 warning Line exceeds 120 characters; contains 124 characters (Generic.Files.LineLength.TooLong) Test/Integration/Block/DataLayerTest.php 64:141 warning Line exceeds 120 characters; contains 141 characters (Generic.Files.LineLength.TooLong)