From fb4796f35eb8cfe75a43ea25daa231491747c645 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 7 May 2021 20:44:46 +0100 Subject: [PATCH] Added PhpStorm code style and file templates --- .gitignore | 4 +- .idea/codeStyles/Project.xml | 71 +++++++++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 ++ .idea/fileTemplates/code/PHP Constructor.php | 8 +++ .../code/PHP Fluent Setter Method.php | 6 ++ .../fileTemplates/code/PHP Getter Method.php | 3 + .../fileTemplates/code/PHP Setter Method.php | 2 + .../includes/PHP Class Doc Comment.php | 0 .../includes/PHP File Header.php | 21 ++++++ .../includes/PHP Function Doc Comment.php | 5 ++ .../includes/PHP Interface Doc Comment.php | 0 .../includes/PHP Property Doc Comment.php | 1 + .../includes/PHP Trait Doc Comment.php | 0 .idea/fileTemplates/internal/PHP Class.php | 10 +++ .idea/fileTemplates/internal/PHP File.php | 4 ++ .../fileTemplates/internal/PHP Interface.php | 10 +++ .idea/fileTemplates/internal/PHP Trait.php | 10 +++ 17 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/fileTemplates/code/PHP Constructor.php create mode 100644 .idea/fileTemplates/code/PHP Fluent Setter Method.php create mode 100644 .idea/fileTemplates/code/PHP Getter Method.php create mode 100644 .idea/fileTemplates/code/PHP Setter Method.php create mode 100644 .idea/fileTemplates/includes/PHP Class Doc Comment.php create mode 100644 .idea/fileTemplates/includes/PHP File Header.php create mode 100644 .idea/fileTemplates/includes/PHP Function Doc Comment.php create mode 100644 .idea/fileTemplates/includes/PHP Interface Doc Comment.php create mode 100644 .idea/fileTemplates/includes/PHP Property Doc Comment.php create mode 100644 .idea/fileTemplates/includes/PHP Trait Doc Comment.php create mode 100644 .idea/fileTemplates/internal/PHP Class.php create mode 100644 .idea/fileTemplates/internal/PHP File.php create mode 100644 .idea/fileTemplates/internal/PHP Interface.php create mode 100644 .idea/fileTemplates/internal/PHP Trait.php diff --git a/.gitignore b/.gitignore index 2819313a1..001c585af 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,9 @@ server.lock /phpstan.neon # Common IDEs -.idea/ +.idea/* +!.idea/codeStyles/ +!.idea/fileTemplates/ nbproject/* # Windows image file caches diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 000000000..1df291e8e --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,71 @@ + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 000000000..79ee123c2 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/fileTemplates/code/PHP Constructor.php b/.idea/fileTemplates/code/PHP Constructor.php new file mode 100644 index 000000000..0f6384d97 --- /dev/null +++ b/.idea/fileTemplates/code/PHP Constructor.php @@ -0,0 +1,8 @@ +#if(${THROWS_DOC} != "") +/** +${THROWS_DOC} +*/ +#end +public function __construct(${PARAM_LIST}) { +${BODY} +} \ No newline at end of file diff --git a/.idea/fileTemplates/code/PHP Fluent Setter Method.php b/.idea/fileTemplates/code/PHP Fluent Setter Method.php new file mode 100644 index 000000000..a46d30504 --- /dev/null +++ b/.idea/fileTemplates/code/PHP Fluent Setter Method.php @@ -0,0 +1,6 @@ +/** @return $this */ +public function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #else#end$${PARAM_NAME})#if(${RETURN_TYPE}): self#else#end +{ + $this->${FIELD_NAME} = $${PARAM_NAME}; + return $this; +} diff --git a/.idea/fileTemplates/code/PHP Getter Method.php b/.idea/fileTemplates/code/PHP Getter Method.php new file mode 100644 index 000000000..419359027 --- /dev/null +++ b/.idea/fileTemplates/code/PHP Getter Method.php @@ -0,0 +1,3 @@ +#if(${TYPE_HINT} != ${RETURN_TYPE} && ${TYPE_HINT} != "")/** @return ${TYPE_HINT} */#end +public ${STATIC} function ${GET_OR_IS}${NAME}()#if(${RETURN_TYPE}): ${RETURN_TYPE}#else#end +{ return #if(${STATIC} == "static")self::$${FIELD_NAME};#else$this->${FIELD_NAME};#end } diff --git a/.idea/fileTemplates/code/PHP Setter Method.php b/.idea/fileTemplates/code/PHP Setter Method.php new file mode 100644 index 000000000..2ded807f6 --- /dev/null +++ b/.idea/fileTemplates/code/PHP Setter Method.php @@ -0,0 +1,2 @@ +public ${STATIC} function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #end$${PARAM_NAME})#if (${VOID_RETURN_TYPE}):void #end +{#if (${STATIC} == "static") self::$${FIELD_NAME} = $${PARAM_NAME}; #else $this->${FIELD_NAME} = $${PARAM_NAME}; #end} diff --git a/.idea/fileTemplates/includes/PHP Class Doc Comment.php b/.idea/fileTemplates/includes/PHP Class Doc Comment.php new file mode 100644 index 000000000..e69de29bb diff --git a/.idea/fileTemplates/includes/PHP File Header.php b/.idea/fileTemplates/includes/PHP File Header.php new file mode 100644 index 000000000..cbd387027 --- /dev/null +++ b/.idea/fileTemplates/includes/PHP File Header.php @@ -0,0 +1,21 @@ + +/* + * + * ____ _ _ __ __ _ __ __ ____ + * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ + * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | + * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ + * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * @author PocketMine Team + * @link http://www.pocketmine.net/ + * + * +*/ + +declare(strict_types=1); \ No newline at end of file diff --git a/.idea/fileTemplates/includes/PHP Function Doc Comment.php b/.idea/fileTemplates/includes/PHP Function Doc Comment.php new file mode 100644 index 000000000..8b9938245 --- /dev/null +++ b/.idea/fileTemplates/includes/PHP Function Doc Comment.php @@ -0,0 +1,5 @@ +#if (${THROWS_DOC} != "") +/** +${THROWS_DOC} +*/ +#end \ No newline at end of file diff --git a/.idea/fileTemplates/includes/PHP Interface Doc Comment.php b/.idea/fileTemplates/includes/PHP Interface Doc Comment.php new file mode 100644 index 000000000..e69de29bb diff --git a/.idea/fileTemplates/includes/PHP Property Doc Comment.php b/.idea/fileTemplates/includes/PHP Property Doc Comment.php new file mode 100644 index 000000000..594879628 --- /dev/null +++ b/.idea/fileTemplates/includes/PHP Property Doc Comment.php @@ -0,0 +1 @@ +/** @var ${TYPE_HINT} */ diff --git a/.idea/fileTemplates/includes/PHP Trait Doc Comment.php b/.idea/fileTemplates/includes/PHP Trait Doc Comment.php new file mode 100644 index 000000000..e69de29bb diff --git a/.idea/fileTemplates/internal/PHP Class.php b/.idea/fileTemplates/internal/PHP Class.php new file mode 100644 index 000000000..dc7d13b6b --- /dev/null +++ b/.idea/fileTemplates/internal/PHP Class.php @@ -0,0 +1,10 @@ +