From 9f15b3f9ffc0854b90e88ae0b88c32cc4b34cf04 Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Fri, 16 Aug 2019 08:47:08 +0200 Subject: [PATCH 01/13] Added live template files/ template files also added includes for template variables XML,PHP * Removed old templates that were overrides of original files. * Added a variable include for things like company/vendor * Added default headers for XML files of M2 * Added live templates for: ** ACL ** DB Schema ** DI ** Module ** phtml (work in progress) ** Registration ** System --- files/fileTemplates/M2 Acl XML.xml | 18 ++ files/fileTemplates/M2 Class - Block.php | 13 ++ files/fileTemplates/M2 Class - Helper.php | 13 ++ files/fileTemplates/M2 Class - Observer.php | 13 ++ files/fileTemplates/M2 Class - ViewModel.php | 13 ++ files/fileTemplates/M2 Class.php | 12 ++ files/fileTemplates/M2 Config XML.xml | 7 + files/fileTemplates/M2 DI.xml | 5 + files/fileTemplates/M2 Db schema XML.xml | 5 + .../M2 Extension Attributes XML.xml | 5 + files/fileTemplates/M2 Layout XML.xml | 7 + files/fileTemplates/M2 Module XML.xml | 5 + files/fileTemplates/M2 Registration.php | 11 ++ files/fileTemplates/M2 Sales XML.xml | 9 + files/fileTemplates/M2 System XML.xml | 7 + files/fileTemplates/M2 System include XML.xml | 5 + files/fileTemplates/code/PHP Constructor.php | 6 - .../code/PHP Fluent Setter Method.php | 11 -- .../fileTemplates/code/PHP Getter Method.php | 12 -- .../code/PHP Implemented Method Body.php | 0 .../code/PHP Overridden Method Body.php | 1 - .../fileTemplates/code/PHP Setter Method.php | 13 -- .../code/PHPUnit Test Method.php | 30 ---- .../includes/M2 PHP File Header.php | 5 + files/fileTemplates/includes/M2 Settings.php | 2 + .../includes/M2 XML File Header.xml | 7 + .../includes/PHP Class Doc Comment.php | 3 - .../includes/PHP Field Doc Comment.php | 1 - .../includes/PHP File Header.php | 4 - .../includes/PHP Function Doc Comment.php | 5 - .../includes/PHP Interface Doc Comment.php | 3 - .../includes/PHP Trait Doc Comment.php | 3 - .../fileTemplates/internal/JavaScript File.js | 1 - files/fileTemplates/internal/PHP Class.php | 11 -- files/fileTemplates/internal/PHP File.php | 2 - .../fileTemplates/internal/PHP Interface.php | 11 -- files/fileTemplates/internal/PHP Trait.php | 11 -- .../fileTemplates/internal/PHPUnit 6 Test.php | 1 - files/fileTemplates/internal/PHPUnit Test.php | 16 -- templates/M2-acl.xml | 12 ++ templates/M2-db_schema.xml | 77 +++++++++ templates/M2-di.xml | 25 +++ templates/M2-module.xml | 16 ++ templates/M2-phtml.xml | 21 +++ templates/M2-registration.xml | 10 ++ templates/M2-system.xml | 158 ++++++++++++++++++ 46 files changed, 481 insertions(+), 145 deletions(-) create mode 100644 files/fileTemplates/M2 Acl XML.xml create mode 100644 files/fileTemplates/M2 Class - Block.php create mode 100644 files/fileTemplates/M2 Class - Helper.php create mode 100644 files/fileTemplates/M2 Class - Observer.php create mode 100644 files/fileTemplates/M2 Class - ViewModel.php create mode 100644 files/fileTemplates/M2 Class.php create mode 100644 files/fileTemplates/M2 Config XML.xml create mode 100644 files/fileTemplates/M2 DI.xml create mode 100644 files/fileTemplates/M2 Db schema XML.xml create mode 100644 files/fileTemplates/M2 Extension Attributes XML.xml create mode 100644 files/fileTemplates/M2 Layout XML.xml create mode 100644 files/fileTemplates/M2 Module XML.xml create mode 100644 files/fileTemplates/M2 Registration.php create mode 100644 files/fileTemplates/M2 Sales XML.xml create mode 100644 files/fileTemplates/M2 System XML.xml create mode 100644 files/fileTemplates/M2 System include XML.xml delete mode 100644 files/fileTemplates/code/PHP Constructor.php delete mode 100644 files/fileTemplates/code/PHP Fluent Setter Method.php delete mode 100644 files/fileTemplates/code/PHP Getter Method.php delete mode 100644 files/fileTemplates/code/PHP Implemented Method Body.php delete mode 100644 files/fileTemplates/code/PHP Overridden Method Body.php delete mode 100644 files/fileTemplates/code/PHP Setter Method.php delete mode 100644 files/fileTemplates/code/PHPUnit Test Method.php create mode 100644 files/fileTemplates/includes/M2 PHP File Header.php create mode 100644 files/fileTemplates/includes/M2 Settings.php create mode 100644 files/fileTemplates/includes/M2 XML File Header.xml delete mode 100644 files/fileTemplates/includes/PHP Class Doc Comment.php delete mode 100644 files/fileTemplates/includes/PHP Field Doc Comment.php delete mode 100644 files/fileTemplates/includes/PHP File Header.php delete mode 100644 files/fileTemplates/includes/PHP Function Doc Comment.php delete mode 100644 files/fileTemplates/includes/PHP Interface Doc Comment.php delete mode 100644 files/fileTemplates/includes/PHP Trait Doc Comment.php delete mode 100644 files/fileTemplates/internal/JavaScript File.js delete mode 100644 files/fileTemplates/internal/PHP Class.php delete mode 100644 files/fileTemplates/internal/PHP File.php delete mode 100644 files/fileTemplates/internal/PHP Interface.php delete mode 100644 files/fileTemplates/internal/PHP Trait.php delete mode 120000 files/fileTemplates/internal/PHPUnit 6 Test.php delete mode 100644 files/fileTemplates/internal/PHPUnit Test.php create mode 100644 templates/M2-acl.xml create mode 100644 templates/M2-db_schema.xml create mode 100644 templates/M2-di.xml create mode 100644 templates/M2-module.xml create mode 100644 templates/M2-phtml.xml create mode 100644 templates/M2-registration.xml create mode 100644 templates/M2-system.xml diff --git a/files/fileTemplates/M2 Acl XML.xml b/files/fileTemplates/M2 Acl XML.xml new file mode 100644 index 0000000..2806468 --- /dev/null +++ b/files/fileTemplates/M2 Acl XML.xml @@ -0,0 +1,18 @@ + +#parse("M2 XML File Header") + + + + + + + + + + #[[$END$]]# + + + + + + \ No newline at end of file diff --git a/files/fileTemplates/M2 Class - Block.php b/files/fileTemplates/M2 Class - Block.php new file mode 100644 index 0000000..5ab5d7b --- /dev/null +++ b/files/fileTemplates/M2 Class - Block.php @@ -0,0 +1,13 @@ + +#parse("M2 XML File Header") + + + #[[$END$]]# + + \ No newline at end of file diff --git a/files/fileTemplates/M2 DI.xml b/files/fileTemplates/M2 DI.xml new file mode 100644 index 0000000..54449c7 --- /dev/null +++ b/files/fileTemplates/M2 DI.xml @@ -0,0 +1,5 @@ + +#parse("M2 XML File Header") + + #[[$END$]]# + \ No newline at end of file diff --git a/files/fileTemplates/M2 Db schema XML.xml b/files/fileTemplates/M2 Db schema XML.xml new file mode 100644 index 0000000..395a89a --- /dev/null +++ b/files/fileTemplates/M2 Db schema XML.xml @@ -0,0 +1,5 @@ + +#parse("M2 XML File Header") + + #[[$END$]]# + \ No newline at end of file diff --git a/files/fileTemplates/M2 Extension Attributes XML.xml b/files/fileTemplates/M2 Extension Attributes XML.xml new file mode 100644 index 0000000..dd8c652 --- /dev/null +++ b/files/fileTemplates/M2 Extension Attributes XML.xml @@ -0,0 +1,5 @@ + +#parse("M2 XML File Header") + + #[[$END$]]# + \ No newline at end of file diff --git a/files/fileTemplates/M2 Layout XML.xml b/files/fileTemplates/M2 Layout XML.xml new file mode 100644 index 0000000..dbc885e --- /dev/null +++ b/files/fileTemplates/M2 Layout XML.xml @@ -0,0 +1,7 @@ + +#parse("M2 XML File Header") + + + #[[$END$]]# + + \ No newline at end of file diff --git a/files/fileTemplates/M2 Module XML.xml b/files/fileTemplates/M2 Module XML.xml new file mode 100644 index 0000000..b9a2edd --- /dev/null +++ b/files/fileTemplates/M2 Module XML.xml @@ -0,0 +1,5 @@ + +#parse("M2 XML File Header") + + m2module#[[$END$]]# + \ No newline at end of file diff --git a/files/fileTemplates/M2 Registration.php b/files/fileTemplates/M2 Registration.php new file mode 100644 index 0000000..5e9fd45 --- /dev/null +++ b/files/fileTemplates/M2 Registration.php @@ -0,0 +1,11 @@ + +#parse("M2 XML File Header") + +
+ + #[[$END$]]# + +
+
\ No newline at end of file diff --git a/files/fileTemplates/M2 System XML.xml b/files/fileTemplates/M2 System XML.xml new file mode 100644 index 0000000..3aa28eb --- /dev/null +++ b/files/fileTemplates/M2 System XML.xml @@ -0,0 +1,7 @@ + +#parse("M2 XML File Header") + + + #[[$END$]]# + + \ No newline at end of file diff --git a/files/fileTemplates/M2 System include XML.xml b/files/fileTemplates/M2 System include XML.xml new file mode 100644 index 0000000..51e1972 --- /dev/null +++ b/files/fileTemplates/M2 System include XML.xml @@ -0,0 +1,5 @@ + +#parse("M2 XML File Header") + + #[[$END$]]# + \ No newline at end of file diff --git a/files/fileTemplates/code/PHP Constructor.php b/files/fileTemplates/code/PHP Constructor.php deleted file mode 100644 index 737a7dd..0000000 --- a/files/fileTemplates/code/PHP Constructor.php +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Constructor. -${PARAM_DOC} -${THROWS_DOC} -*/ -public function __construct(${PARAM_LIST}) {${BODY}} \ No newline at end of file diff --git a/files/fileTemplates/code/PHP Fluent Setter Method.php b/files/fileTemplates/code/PHP Fluent Setter Method.php deleted file mode 100644 index 5442bfb..0000000 --- a/files/fileTemplates/code/PHP Fluent Setter Method.php +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @param ${TYPE_HINT} $${PARAM_NAME} - * - * @return ${CLASS_NAME} - */ -public function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #else#end$${PARAM_NAME})#if(${RETURN_TYPE}): ${CLASS_NAME}#else#end -{ - $this->${FIELD_NAME} = $${PARAM_NAME}; - return $this; -} - diff --git a/files/fileTemplates/code/PHP Getter Method.php b/files/fileTemplates/code/PHP Getter Method.php deleted file mode 100644 index cd67405..0000000 --- a/files/fileTemplates/code/PHP Getter Method.php +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @return ${TYPE_HINT} - */ -public ${STATIC} function ${GET_OR_IS}${NAME}()#if(${RETURN_TYPE}): ${RETURN_TYPE}#else#end -{ -#if (${STATIC} == "static") - return self::$${FIELD_NAME}; -#else - return $this->${FIELD_NAME}; -#end -} - diff --git a/files/fileTemplates/code/PHP Implemented Method Body.php b/files/fileTemplates/code/PHP Implemented Method Body.php deleted file mode 100644 index e69de29..0000000 diff --git a/files/fileTemplates/code/PHP Overridden Method Body.php b/files/fileTemplates/code/PHP Overridden Method Body.php deleted file mode 100644 index 4720126..0000000 --- a/files/fileTemplates/code/PHP Overridden Method Body.php +++ /dev/null @@ -1 +0,0 @@ -${RETURN} parent::${NAME}(${PARAM_LIST}); \ No newline at end of file diff --git a/files/fileTemplates/code/PHP Setter Method.php b/files/fileTemplates/code/PHP Setter Method.php deleted file mode 100644 index b878f45..0000000 --- a/files/fileTemplates/code/PHP Setter Method.php +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @param ${TYPE_HINT} $${PARAM_NAME} - * - * @return void - */ -public ${STATIC} function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #else#end$${PARAM_NAME}): void -{ -#if (${STATIC} == "static") - self::$${FIELD_NAME} = $${PARAM_NAME}; -#else - $this->${FIELD_NAME} = $${PARAM_NAME}; -#end -} diff --git a/files/fileTemplates/code/PHPUnit Test Method.php b/files/fileTemplates/code/PHPUnit Test Method.php deleted file mode 100644 index b3bd044..0000000 --- a/files/fileTemplates/code/PHPUnit Test Method.php +++ /dev/null @@ -1,30 +0,0 @@ -#if (${NAME} == "__construct") - #set ($METHOD_NAME = "Constructor") -#elseif (${NAME} == "__destruct") - #set ($METHOD_NAME = "Destructor") -#elseif (${NAME} == "__toString") - #set ($METHOD_NAME = "toString") -#elseif (${NAME} == "__clone") - #set ($METHOD_NAME = "Clone") -#elseif (${NAME} == "__invoke") - #set ($METHOD_NAME = "Invoke") -#else - #set ($METHOD_NAME = ${CAPITALIZED_NAME}) -#end -/** - * @return void - * - * @covers ::${NAME} - */ -public function test$METHOD_NAME(): void -{ -#if (${NAME} == "__construct") - $this->assertInstanceOf( - ${TESTED_NAME}::class, - new ${TESTED_NAME}() - ); -#else - $subject = new ${TESTED_NAME}(); - $subject->${NAME}(); -#end -} diff --git a/files/fileTemplates/includes/M2 PHP File Header.php b/files/fileTemplates/includes/M2 PHP File Header.php new file mode 100644 index 0000000..88fefda --- /dev/null +++ b/files/fileTemplates/includes/M2 PHP File Header.php @@ -0,0 +1,5 @@ +#parse("M2 Settings") +/** + * Copyright © $Company, Inc. All rights reserved. + * See COPYING.txt for license details. + */ diff --git a/files/fileTemplates/includes/M2 Settings.php b/files/fileTemplates/includes/M2 Settings.php new file mode 100644 index 0000000..de75eb3 --- /dev/null +++ b/files/fileTemplates/includes/M2 Settings.php @@ -0,0 +1,2 @@ +#set( $Company = "MediaCT" ) +#set( $Vendor = "MediaCT" ) \ No newline at end of file diff --git a/files/fileTemplates/includes/M2 XML File Header.xml b/files/fileTemplates/includes/M2 XML File Header.xml new file mode 100644 index 0000000..fc47a95 --- /dev/null +++ b/files/fileTemplates/includes/M2 XML File Header.xml @@ -0,0 +1,7 @@ +#parse("M2 Settings") + diff --git a/files/fileTemplates/includes/PHP Class Doc Comment.php b/files/fileTemplates/includes/PHP Class Doc Comment.php deleted file mode 100644 index e1c3537..0000000 --- a/files/fileTemplates/includes/PHP Class Doc Comment.php +++ /dev/null @@ -1,3 +0,0 @@ -/** - * - */ diff --git a/files/fileTemplates/includes/PHP Field Doc Comment.php b/files/fileTemplates/includes/PHP Field Doc Comment.php deleted file mode 100644 index 2590c73..0000000 --- a/files/fileTemplates/includes/PHP Field Doc Comment.php +++ /dev/null @@ -1 +0,0 @@ -/** ${TYPE_TAG} ${TYPE_HINT} */ diff --git a/files/fileTemplates/includes/PHP File Header.php b/files/fileTemplates/includes/PHP File Header.php deleted file mode 100644 index 3aaa69e..0000000 --- a/files/fileTemplates/includes/PHP File Header.php +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Copyright MediaCT. All rights reserved. - * https://www.mediact.nl - */ \ No newline at end of file diff --git a/files/fileTemplates/includes/PHP Function Doc Comment.php b/files/fileTemplates/includes/PHP Function Doc Comment.php deleted file mode 100644 index ad4ef63..0000000 --- a/files/fileTemplates/includes/PHP Function Doc Comment.php +++ /dev/null @@ -1,5 +0,0 @@ -/** -${PARAM_DOC} -* @return ${TYPE_HINT} -${THROWS_DOC} -*/ diff --git a/files/fileTemplates/includes/PHP Interface Doc Comment.php b/files/fileTemplates/includes/PHP Interface Doc Comment.php deleted file mode 100644 index e1c3537..0000000 --- a/files/fileTemplates/includes/PHP Interface Doc Comment.php +++ /dev/null @@ -1,3 +0,0 @@ -/** - * - */ diff --git a/files/fileTemplates/includes/PHP Trait Doc Comment.php b/files/fileTemplates/includes/PHP Trait Doc Comment.php deleted file mode 100644 index e1c3537..0000000 --- a/files/fileTemplates/includes/PHP Trait Doc Comment.php +++ /dev/null @@ -1,3 +0,0 @@ -/** - * - */ diff --git a/files/fileTemplates/internal/JavaScript File.js b/files/fileTemplates/internal/JavaScript File.js deleted file mode 100644 index 18b6bc2..0000000 --- a/files/fileTemplates/internal/JavaScript File.js +++ /dev/null @@ -1 +0,0 @@ -#parse("PHP File Header") diff --git a/files/fileTemplates/internal/PHP Class.php b/files/fileTemplates/internal/PHP Class.php deleted file mode 100644 index 219be0f..0000000 --- a/files/fileTemplates/internal/PHP Class.php +++ /dev/null @@ -1,11 +0,0 @@ - + + \ No newline at end of file diff --git a/templates/M2-db_schema.xml b/templates/M2-db_schema.xml new file mode 100644 index 0000000..a3538fe --- /dev/null +++ b/templates/M2-db_schema.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/templates/M2-di.xml b/templates/M2-di.xml new file mode 100644 index 0000000..41eed39 --- /dev/null +++ b/templates/M2-di.xml @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file diff --git a/templates/M2-module.xml b/templates/M2-module.xml new file mode 100644 index 0000000..6e92302 --- /dev/null +++ b/templates/M2-module.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/templates/M2-phtml.xml b/templates/M2-phtml.xml new file mode 100644 index 0000000..9e00b24 --- /dev/null +++ b/templates/M2-phtml.xml @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/templates/M2-registration.xml b/templates/M2-registration.xml new file mode 100644 index 0000000..c6264b0 --- /dev/null +++ b/templates/M2-registration.xml @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/templates/M2-system.xml b/templates/M2-system.xml new file mode 100644 index 0000000..71f8e42 --- /dev/null +++ b/templates/M2-system.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + \ No newline at end of file From 6a43ce0c4fa9ec4c234a161d6a976839910ca663 Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Fri, 16 Aug 2019 11:32:55 +0200 Subject: [PATCH 02/13] Added enters at the end of all files --- files/fileTemplates/M2 Acl XML.xml | 2 +- files/fileTemplates/M2 Class - Helper.php | 2 +- files/fileTemplates/M2 Class - Observer.php | 2 +- files/fileTemplates/M2 Class - ViewModel.php | 2 +- files/fileTemplates/M2 Class.php | 1 - files/fileTemplates/M2 Config XML.xml | 2 +- files/fileTemplates/M2 DI.xml | 2 +- files/fileTemplates/M2 Db schema XML.xml | 2 +- files/fileTemplates/M2 Extension Attributes XML.xml | 2 +- files/fileTemplates/M2 Layout XML.xml | 2 +- files/fileTemplates/M2 Module XML.xml | 2 +- files/fileTemplates/M2 Registration.php | 2 +- files/fileTemplates/M2 Sales XML.xml | 2 +- files/fileTemplates/M2 System XML.xml | 2 +- files/fileTemplates/M2 System include XML.xml | 2 +- files/fileTemplates/includes/M2 Settings.php | 2 +- files/fileTemplates/includes/M2 XML File Header.xml | 2 +- 17 files changed, 16 insertions(+), 17 deletions(-) diff --git a/files/fileTemplates/M2 Acl XML.xml b/files/fileTemplates/M2 Acl XML.xml index 2806468..93c38bf 100644 --- a/files/fileTemplates/M2 Acl XML.xml +++ b/files/fileTemplates/M2 Acl XML.xml @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/files/fileTemplates/M2 Class - Helper.php b/files/fileTemplates/M2 Class - Helper.php index c74e7a3..531c9f9 100644 --- a/files/fileTemplates/M2 Class - Helper.php +++ b/files/fileTemplates/M2 Class - Helper.php @@ -10,4 +10,4 @@ class ${NAME} extends AbstractHelper { #[[$END$]]# -} \ No newline at end of file +} diff --git a/files/fileTemplates/M2 Class - Observer.php b/files/fileTemplates/M2 Class - Observer.php index 67a3b45..23ff2d8 100644 --- a/files/fileTemplates/M2 Class - Observer.php +++ b/files/fileTemplates/M2 Class - Observer.php @@ -10,4 +10,4 @@ class ${NAME} implements ObserverInterface { #[[$END$]]# -} \ No newline at end of file +} diff --git a/files/fileTemplates/M2 Class - ViewModel.php b/files/fileTemplates/M2 Class - ViewModel.php index 6b8e01e..379f7de 100644 --- a/files/fileTemplates/M2 Class - ViewModel.php +++ b/files/fileTemplates/M2 Class - ViewModel.php @@ -10,4 +10,4 @@ class ${NAME} implements ArgumentInterface { #[[$END$]]# -} \ No newline at end of file +} diff --git a/files/fileTemplates/M2 Class.php b/files/fileTemplates/M2 Class.php index 9073e37..af833df 100644 --- a/files/fileTemplates/M2 Class.php +++ b/files/fileTemplates/M2 Class.php @@ -9,4 +9,3 @@ class ${NAME} { #[[$END$]]# } - diff --git a/files/fileTemplates/M2 Config XML.xml b/files/fileTemplates/M2 Config XML.xml index 813921d..b8a526f 100644 --- a/files/fileTemplates/M2 Config XML.xml +++ b/files/fileTemplates/M2 Config XML.xml @@ -4,4 +4,4 @@ #[[$END$]]# - \ No newline at end of file + diff --git a/files/fileTemplates/M2 DI.xml b/files/fileTemplates/M2 DI.xml index 54449c7..566d6eb 100644 --- a/files/fileTemplates/M2 DI.xml +++ b/files/fileTemplates/M2 DI.xml @@ -2,4 +2,4 @@ #parse("M2 XML File Header") #[[$END$]]# - \ No newline at end of file + diff --git a/files/fileTemplates/M2 Db schema XML.xml b/files/fileTemplates/M2 Db schema XML.xml index 395a89a..06a7370 100644 --- a/files/fileTemplates/M2 Db schema XML.xml +++ b/files/fileTemplates/M2 Db schema XML.xml @@ -2,4 +2,4 @@ #parse("M2 XML File Header") #[[$END$]]# - \ No newline at end of file + diff --git a/files/fileTemplates/M2 Extension Attributes XML.xml b/files/fileTemplates/M2 Extension Attributes XML.xml index dd8c652..27fa3a5 100644 --- a/files/fileTemplates/M2 Extension Attributes XML.xml +++ b/files/fileTemplates/M2 Extension Attributes XML.xml @@ -2,4 +2,4 @@ #parse("M2 XML File Header") #[[$END$]]# - \ No newline at end of file + diff --git a/files/fileTemplates/M2 Layout XML.xml b/files/fileTemplates/M2 Layout XML.xml index dbc885e..636cbbe 100644 --- a/files/fileTemplates/M2 Layout XML.xml +++ b/files/fileTemplates/M2 Layout XML.xml @@ -4,4 +4,4 @@ #[[$END$]]# - \ No newline at end of file + diff --git a/files/fileTemplates/M2 Module XML.xml b/files/fileTemplates/M2 Module XML.xml index b9a2edd..1811699 100644 --- a/files/fileTemplates/M2 Module XML.xml +++ b/files/fileTemplates/M2 Module XML.xml @@ -2,4 +2,4 @@ #parse("M2 XML File Header") m2module#[[$END$]]# - \ No newline at end of file + diff --git a/files/fileTemplates/M2 Registration.php b/files/fileTemplates/M2 Registration.php index 5e9fd45..98bc9a7 100644 --- a/files/fileTemplates/M2 Registration.php +++ b/files/fileTemplates/M2 Registration.php @@ -8,4 +8,4 @@ '${Vendor}_${Namespace}', __DIR__ ); -#[[$END$]]# \ No newline at end of file +#[[$END$]]# diff --git a/files/fileTemplates/M2 Sales XML.xml b/files/fileTemplates/M2 Sales XML.xml index 34a52f7..82e4b58 100644 --- a/files/fileTemplates/M2 Sales XML.xml +++ b/files/fileTemplates/M2 Sales XML.xml @@ -6,4 +6,4 @@ #[[$END$]]# - \ No newline at end of file + diff --git a/files/fileTemplates/M2 System XML.xml b/files/fileTemplates/M2 System XML.xml index 3aa28eb..5f6ed26 100644 --- a/files/fileTemplates/M2 System XML.xml +++ b/files/fileTemplates/M2 System XML.xml @@ -4,4 +4,4 @@ #[[$END$]]# - \ No newline at end of file + diff --git a/files/fileTemplates/M2 System include XML.xml b/files/fileTemplates/M2 System include XML.xml index 51e1972..fd04cd2 100644 --- a/files/fileTemplates/M2 System include XML.xml +++ b/files/fileTemplates/M2 System include XML.xml @@ -2,4 +2,4 @@ #parse("M2 XML File Header") #[[$END$]]# - \ No newline at end of file + diff --git a/files/fileTemplates/includes/M2 Settings.php b/files/fileTemplates/includes/M2 Settings.php index de75eb3..a7e6760 100644 --- a/files/fileTemplates/includes/M2 Settings.php +++ b/files/fileTemplates/includes/M2 Settings.php @@ -1,2 +1,2 @@ #set( $Company = "MediaCT" ) -#set( $Vendor = "MediaCT" ) \ No newline at end of file +#set( $Vendor = "MediaCT" ) diff --git a/files/fileTemplates/includes/M2 XML File Header.xml b/files/fileTemplates/includes/M2 XML File Header.xml index fc47a95..78559c2 100644 --- a/files/fileTemplates/includes/M2 XML File Header.xml +++ b/files/fileTemplates/includes/M2 XML File Header.xml @@ -4,4 +4,4 @@ * Copyright © $Company, Inc. All rights reserved. * See COPYING.txt for license details. */ ---> +--> \ No newline at end of file From 03fd0dab58f6c25161279ef158fc4e3324a70334 Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Fri, 16 Aug 2019 11:57:49 +0200 Subject: [PATCH 03/13] Changed version of php from 7.0 -> 7.2 and updated the README to tell other people what has been added. --- README.md | 32 ++++++++++++++++++++++++++++++++ composer.json | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ddf5bf0..b64fc49 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,35 @@ composer require mediact/coding-standard-phpstorm ## Configuration Use PHPStorm's `file > settings > language > PHP` menu to point to the installed binaries for PHPMD and PHPCS. +## Live Templates +You now get live templates that can be be found in `file > settings > Editor -> Live Templates` . +These can be enabled and disabled for if you want to use them or not. +At this moment there have been live templates created for: +* ACL +* DB Schema +* DI +* Module +* Phtml (WIP) +* Registration +* System + +## Templates +You now get live templates that can be be found in `file > settings > Editor -> File and Code Templates` . +These can be enabled and disabled for if you want to use them or not. +At this moment there have been templates created for: +* ACL +* Class +* Class - Block +* Class - Helper +* Class - Observer +* Class - ViewModel +* Config +* DB Schema +* DI +* Extension Attributes +* Layout +* Module +* Registration +* Sales +* System +* System Include \ No newline at end of file diff --git a/composer.json b/composer.json index c6d95a2..e098c89 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "php": "^5.4.0 || ^7.0", + "php": "^7.2", "composer-plugin-api": "^1.0" }, "require-dev": { From 9f4199c508c2f5dd8b178c398277c88711553a98 Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Fri, 16 Aug 2019 14:50:31 +0200 Subject: [PATCH 04/13] Changed the map of the live templates and added a commandos.md that shows all commandos that can be used. --- COMMANDS.md | 121 +++++++++++++++++++++ README.md | 6 +- files/templates/M2-acl.xml | 12 +++ files/templates/M2-db_schema.xml | 77 ++++++++++++++ files/templates/M2-di.xml | 25 +++++ files/templates/M2-module.xml | 16 +++ files/templates/M2-phtml.xml | 21 ++++ files/templates/M2-registration.xml | 10 ++ files/templates/M2-system.xml | 158 ++++++++++++++++++++++++++++ 9 files changed, 445 insertions(+), 1 deletion(-) create mode 100644 COMMANDS.md create mode 100644 files/templates/M2-acl.xml create mode 100644 files/templates/M2-db_schema.xml create mode 100644 files/templates/M2-di.xml create mode 100644 files/templates/M2-module.xml create mode 100644 files/templates/M2-phtml.xml create mode 100644 files/templates/M2-registration.xml create mode 100644 files/templates/M2-system.xml diff --git a/COMMANDS.md b/COMMANDS.md new file mode 100644 index 0000000..388136f --- /dev/null +++ b/COMMANDS.md @@ -0,0 +1,121 @@ +# coding-standard-phpstorm + +These commando's can be used in xml, php and phtml files. + +## M2 XML +All xml templates make use of the includes "M2 XML File Header.xml". +All xml files also have appropriated xsd paths. + +Available templates: +* M2 db schema xml: +* M2 di xml: +* M2 extension attributes xml: +* M2 layout xml: +* M2 module xml: + +## M2 PHP Classes +All php files are PHP 7.1 or higher. These files have strict_types=1 on top of the templates and +make use of includes "M2 PHP File Header.php". + +Make use of `new > file > PHP Class` and select a different template all PHP templates start with M2. +If the one mentioned below is not present go to `file > settings > Editor -> File and Code Templates` and enable the template you're searching for. +This way Namespaces and vendor will be automatically filled in. + +Available templates: +* **M2 class**: Default M2 php class. +* **M2 class - Block**: PHP class that extends Template class. +* **M2 class - Helper**: PHP class that extends AbstractHelper +* **M2 class - Observer**: PHP class that implements ObserverInterface +* **M2 class - ViewModel**: PHP class that implements ArgumentInterface + +## M2 ACL +Available templates: +* **M2 Acl XML**: Create an acl template that already has path to backend menu and backend config (system.xml) + +Available commands: +* **m2aclresource** -> Create a resource tag, available params + * Vendor: vendor name + * namespace: name of module + * resourceId: acl id + * title: acl title + * order: sort order + +## M2 Config +Available templates: +* **M2 Config XML**: Create an config with default structure. + +Available commands: +* None + +## M2 DB Schema +Available templates: +* **M2 Db schema XML**: Create an db schema with default structure. + +Available commands: +* **m2dbtable**: Create an table. +* **m2dbcolumnvarchar**: Create an column as a varchar. +* **m2dbcolumnint**: Create an column as a int. +* **m2dbcolumndecimal**: Create an column decimal. +* **m2dbforeign**: Create an foreign key index. +* **m2dbcolumncreate**: Create an create created_at column. +* **m2dbindex**: Create an index. +* **m2dbcolumnupdate**: Create an updated_at column. + +## M2 DI +Available templates: +* **M2 DI**: Create an DI file. + +Available commands: +* **m2diplugin**: Create an plugin tyoe. +* **m2divirtual**: Create an virtual type +* **m2dipreference**: Create an preference(rewrite) + +## M2 Extension Attribute +Available templates: +* **M2 Extension Attributes XML**: Create an extension attribute file with default structure. + +## M2 Layout +Available templates: +* **M2 Layout XML**: Create an layout XML with default structure + +## M2 Module +Available templates: +* **M2 Module XML**: Create an module XML file that has default structure + +Available commands: +* **m2mod**: Create an module tag +* **m2modsequence**: Create an sequence tag + +## M2 Registration +Available templates: +* **M2 Module XML**: Create an registration file with the method to register a m2 module + +Available commands: +* **m2reg**: Create registration file + +## M2 Sales +Available templates: +* **M2 Sales XML**: Create an sales xml file for registrating new totals. + +Available commands: +* None + +## M2 System / System Include +Available templates: +* **M2 System XML**: Create an system.xml with default structure. +* **M2 System Include XML**: Create an system include that can be included in a system.xml with default structure. + +Available commands: +* **m2syssection**: Create an section tag. +* **m2sysinclude**: Create an include tag. +* **m2sysgroup**: Create an group tag. +* **m2sysfieldcmspage**: Create a dropdown field with all cms pages. +* **m2sysfieldyesno**: Create a dropdown with yes and no. +* **m2sysfieldpagelayout**: Create a dropdown with all page layouts. +* **m2sysfieldenabledisable**: Create a dropdown with enable/disable. +* **m2sysfieldpassword**: Create an obscure password field. +* **m2sysfieldtext**: Create a text field. +* **m2sysfieldtextarea**: Create a textarea field. +* **m2sysfieldpricetype**: Create a dropdown with all price types. +* **m2sysfieldproducttax**: Create a dropdown with all product taxes. +* **m2sysfieldcountry**: Create a dropdown with all countries. diff --git a/README.md b/README.md index b64fc49..bf5cdf9 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ At this moment there have been live templates created for: * Registration * System +Check out [this link](COMMANDSother_file.md) to see more info + ## Templates You now get live templates that can be be found in `file > settings > Editor -> File and Code Templates` . These can be enabled and disabled for if you want to use them or not. @@ -43,4 +45,6 @@ At this moment there have been templates created for: * Registration * Sales * System -* System Include \ No newline at end of file +* System Include + +Check out [this link](COMMANDSother_file.md) to see all commando's that can be used. \ No newline at end of file diff --git a/files/templates/M2-acl.xml b/files/templates/M2-acl.xml new file mode 100644 index 0000000..4dffd7c --- /dev/null +++ b/files/templates/M2-acl.xml @@ -0,0 +1,12 @@ + + + \ No newline at end of file diff --git a/files/templates/M2-db_schema.xml b/files/templates/M2-db_schema.xml new file mode 100644 index 0000000..a3538fe --- /dev/null +++ b/files/templates/M2-db_schema.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/files/templates/M2-di.xml b/files/templates/M2-di.xml new file mode 100644 index 0000000..41eed39 --- /dev/null +++ b/files/templates/M2-di.xml @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file diff --git a/files/templates/M2-module.xml b/files/templates/M2-module.xml new file mode 100644 index 0000000..6e92302 --- /dev/null +++ b/files/templates/M2-module.xml @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/files/templates/M2-phtml.xml b/files/templates/M2-phtml.xml new file mode 100644 index 0000000..9e00b24 --- /dev/null +++ b/files/templates/M2-phtml.xml @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/files/templates/M2-registration.xml b/files/templates/M2-registration.xml new file mode 100644 index 0000000..c6264b0 --- /dev/null +++ b/files/templates/M2-registration.xml @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/files/templates/M2-system.xml b/files/templates/M2-system.xml new file mode 100644 index 0000000..71f8e42 --- /dev/null +++ b/files/templates/M2-system.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + \ No newline at end of file From 330beb6fdbe559ee5f51ab72a90528ab60d20df4 Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Fri, 16 Aug 2019 14:51:12 +0200 Subject: [PATCH 05/13] Wrong link --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bf5cdf9..6fa8c0d 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ At this moment there have been live templates created for: * Registration * System -Check out [this link](COMMANDSother_file.md) to see more info +Check out [this link](COMMANDS.md) to see more info ## Templates You now get live templates that can be be found in `file > settings > Editor -> File and Code Templates` . @@ -47,4 +47,4 @@ At this moment there have been templates created for: * System * System Include -Check out [this link](COMMANDSother_file.md) to see all commando's that can be used. \ No newline at end of file +Check out [this link](COMMANDS.md) to see all commando's that can be used. \ No newline at end of file From d935370c7ce14984c8ace143d69fb991594dc3ca Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Fri, 16 Aug 2019 15:09:14 +0200 Subject: [PATCH 06/13] Changed php version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e098c89..2468753 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.1", "composer-plugin-api": "^1.0" }, "require-dev": { From 9f1c5b5457d10447f58ab7fb1382799967b34e80 Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Fri, 16 Aug 2019 15:23:12 +0200 Subject: [PATCH 07/13] ignore < error --- phpstan.neon | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index b7071dc..a3e29fe 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,4 @@ parameters: excludes_analyse: - - %rootDir%/../../../files/* + ignoreErrors: + - '# Start tag expected, '<' not found #i' \ No newline at end of file From 07b115d697f9ceec3cde60d1acfaf1cc7ffe0d6a Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Fri, 16 Aug 2019 15:29:28 +0200 Subject: [PATCH 08/13] it was an xmllint problem... --- phpstan.neon | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index a3e29fe..b7071dc 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,4 +1,3 @@ parameters: excludes_analyse: - ignoreErrors: - - '# Start tag expected, '<' not found #i' \ No newline at end of file + - %rootDir%/../../../files/* From 08d426431fe154b95582c4daa3ca3d80e039c6fe Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Thu, 22 Aug 2019 12:02:06 +0200 Subject: [PATCH 09/13] Added version to composer of testing suite and version otherwise it can't be used by the testing suite --- composer.json | 14 ++++++++------ grumphp.yml | 4 ++++ phpmd.xml | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 grumphp.yml diff --git a/composer.json b/composer.json index 2468753..0b65e78 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ }, "require-dev": { "composer/composer": "^1.3", - "mediact/testing-suite": "@stable", + "mediact/testing-suite": "1.20.0", "kint-php/kint": "@stable", "mikey179/vfsstream": "^1.6" }, @@ -30,11 +30,9 @@ } }, "extra": { - "class": "Mediact\\CodingStandard\\PhpStorm\\Plugin", - "grumphp": { - "config-default-path": "vendor/mediact/testing-suite/config/default/grumphp.yml" - } + "class": "Mediact\\CodingStandard\\PhpStorm\\Plugin" }, + "version": "1.7.0", "archive": { "exclude": [ "/bitbucket-pipelines.yml", @@ -43,7 +41,11 @@ "/phpunit.xml", "/phpmd.xml", "/phpstan.neon", - "/phpcs.xml" + "/phpcs.xml", + "/grumphp.yml" ] + }, + "config": { + "sort-packages": true } } diff --git a/grumphp.yml b/grumphp.yml new file mode 100644 index 0000000..01919cf --- /dev/null +++ b/grumphp.yml @@ -0,0 +1,4 @@ +imports: + - resource: 'vendor/mediact/testing-suite/config/default/grumphp.yml' + + diff --git a/phpmd.xml b/phpmd.xml index 47ada12..1c31db5 100644 --- a/phpmd.xml +++ b/phpmd.xml @@ -5,6 +5,6 @@ xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"> PHPMD - + files/fileTemplates/*.php From c28c0e8475ff34012063ecd126aa751e5933aa5c Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Thu, 22 Aug 2019 15:43:21 +0200 Subject: [PATCH 10/13] Changed composer & grumphp. * Changed php version that you can use from 5.4 to 7.1. * Added version tag because testing-suite requires a stable version even when committing. * Composer check is not strict anymore about versions. * Added files to the ignore pattern. --- composer.json | 6 +++--- grumphp.yml | 9 ++++++++- tests/FilesystemTest.php | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 0b65e78..1cf1940 100644 --- a/composer.json +++ b/composer.json @@ -9,14 +9,15 @@ "email": "contact@mediact.nl" } ], + "version": "1.7.0", "require": { - "php": "^7.1", + "php": "^5.4 || ^7.1", "composer-plugin-api": "^1.0" }, "require-dev": { "composer/composer": "^1.3", - "mediact/testing-suite": "1.20.0", "kint-php/kint": "@stable", + "mediact/testing-suite": "^1.20", "mikey179/vfsstream": "^1.6" }, "autoload": { @@ -32,7 +33,6 @@ "extra": { "class": "Mediact\\CodingStandard\\PhpStorm\\Plugin" }, - "version": "1.7.0", "archive": { "exclude": [ "/bitbucket-pipelines.yml", diff --git a/grumphp.yml b/grumphp.yml index 01919cf..3f25693 100644 --- a/grumphp.yml +++ b/grumphp.yml @@ -1,4 +1,11 @@ imports: - resource: 'vendor/mediact/testing-suite/config/default/grumphp.yml' - +parameters: + composer.strict: false + xmllint.ignore_patterns: + # Uses an incomplete definition, which conflicts when + # is defined. + - /^phpcs.xml$/ + - /^phpmd.xml$/ + - /files/ diff --git a/tests/FilesystemTest.php b/tests/FilesystemTest.php index 39aa5ad..71518aa 100644 --- a/tests/FilesystemTest.php +++ b/tests/FilesystemTest.php @@ -24,7 +24,7 @@ class FilesystemTest extends TestCase /** * @return void */ - public function setUp() + public function setUp(): void { $this->vfs = vfsStream::setup(sha1(__FILE__)); } From 72b7cf94bdae0bf8bc4639acbbcd0df792f6ce05 Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Thu, 22 Aug 2019 16:06:05 +0200 Subject: [PATCH 11/13] Changed version to support php 7.1 --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 1cf1940..fee4286 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "composer-plugin-api": "^1.0" }, "require-dev": { + "phpunit/phpunit": "^7.5", "composer/composer": "^1.3", "kint-php/kint": "@stable", "mediact/testing-suite": "^1.20", From 8b6fa6de71d7f820177d5d82c3a6a1169b731549 Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Thu, 22 Aug 2019 16:10:19 +0200 Subject: [PATCH 12/13] Added a stricter ignore pattern --- grumphp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grumphp.yml b/grumphp.yml index 3f25693..e4e04b7 100644 --- a/grumphp.yml +++ b/grumphp.yml @@ -8,4 +8,4 @@ parameters: # is defined. - /^phpcs.xml$/ - /^phpmd.xml$/ - - /files/ + - /^files/ From 94704a19691d8702647779d1e19530968a5c3ec8 Mon Sep 17 00:00:00 2001 From: Leon Helmus Date: Thu, 22 Aug 2019 16:18:50 +0200 Subject: [PATCH 13/13] Added THE strict ignore pattern --- grumphp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grumphp.yml b/grumphp.yml index e4e04b7..4cd3fa3 100644 --- a/grumphp.yml +++ b/grumphp.yml @@ -8,4 +8,4 @@ parameters: # is defined. - /^phpcs.xml$/ - /^phpmd.xml$/ - - /^files/ + - '#^files/.*\.xml$#'