From cd0610d8dd13d9a394e031390167a80bba6ae5a4 Mon Sep 17 00:00:00 2001 From: rbairwell Date: Sat, 16 Mar 2019 00:52:36 +0000 Subject: [PATCH] Massive lot of code style fixes and improved code quality auditing to cover us going forwards. --- .editorconfig | 16 +- .gitignore | 34 ++- .idea/PublicWhipV2.iml | 121 +++++++++ .idea/codeStyles/Project.xml | 30 +++ .idea/codeStyles/codeStyleConfig.xml | 5 + .idea/composerJson.xml | 10 + .idea/fileTemplates/code/PHP Constructor.php | 6 + .../includes/PHP Class Doc Comment.php | 3 + .../includes/PHP Interface Doc Comment.php | 3 + .../includes/PHP Trait Doc Comment.php | 3 + .idea/fileTemplates/internal/PHP Class.php | 9 + .idea/fileTemplates/internal/PHP File.php | 2 + .../fileTemplates/internal/PHP Interface.php | 8 + .idea/fileTemplates/internal/PHP Trait.php | 9 + .../fileTemplates/internal/PHPUnit 6 Test.php | 16 ++ .idea/fileTemplates/internal/PHPUnit Test.php | 15 ++ .../inspectionProfiles/Project_Default.xml | 6 +- .idea/misc.xml | 6 + .idea/modules.xml | 8 + .idea/php-docker-settings.xml | 24 ++ .idea/php-test-framework.xml | 14 + .idea/php.xml | 243 +++++++++++++++++ .idea/vcs.xml | 6 + README.md | 8 +- cache/.gitkeep | 0 composer.json | 15 +- composer.lock | 128 ++++++--- config/develop.php | 2 +- docs/CONTRIBUTING.md | 9 +- docs/ChangeLog.md | 71 +++++ docs/Milestones.md | 75 +----- docs/Production.md | 19 ++ docs/QuickStart.md | 11 +- grumphp.yml | 11 +- logs/.gitkeep | 0 phpStormCodeStyle.xml | 23 -- phpcs.xml | 248 +++++++++++++++++- phpmd.xml | 19 +- qa/.gitkeep | 0 src/Config.php | 150 +++++++++-- src/Entities/AbstractEntity.php | 148 ----------- src/Entities/DivisionEntity.php | 62 ++--- src/Entities/README.md | 2 +- src/Exceptions/AbstractException.php | 1 - .../Entities/AbstractEntityException.php | 18 -- ...EntityPassedUnrecognisedFieldException.php | 16 -- .../Factories/AbstractFactoryException.php | 17 ++ .../Factories/BadDateTimeException.php | 14 + ...actoryPassedUnrecognisedFieldException.php | 15 ++ .../EntityFieldWrongTypeException.php | 5 +- .../EntityMissingRequiredFieldException.php | 5 +- .../MissingConfigurationException.php | 14 + .../Providers/AbstractProviderException.php | 1 - src/Exceptions/Providers/WikiFailedRegExp.php | 1 - .../Services/AbstractServicesException.php | 1 - .../Services/BadDatabaseReturnException.php | 2 +- src/Factories/DateTimeFactory.php | 61 +++++ src/Factories/DateTimeFactoryInterface.php | 32 +++ src/Factories/EntityFactory.php | 244 +++++++++++++++++ src/Factories/EntityFactoryInterface.php | 32 +++ src/Factories/README.md | 1 + src/Providers/CallableResolverProvider.php | 41 +++ .../CallableResolverProviderInterface.php | 29 ++ src/Providers/ControllerInvokerProvider.php | 71 +++++ src/Providers/DatabaseProvider.php | 94 +++++-- src/Providers/DatabaseProviderInterface.php | 96 +++++-- src/Providers/DebuggerProvider.php | 74 ++++-- src/Providers/DebuggerProviderInterface.php | 62 +++-- src/Providers/DebuggerTwigExtension.php | 19 +- src/Providers/MailerProvider.php | 77 +++--- src/Providers/MailerProviderInterface.php | 42 +-- src/Providers/README.md | 8 +- src/Providers/TemplateProvider.php | 43 +++ src/Providers/TemplateProviderInterface.php | 32 +++ src/Providers/WikiParserProvider.php | 149 ++++++----- src/Providers/WikiParserProviderInterface.php | 42 ++- src/Services/DivisionService.php | 144 +++++----- src/Services/DivisionServiceInterface.php | 18 +- src/Services/README.md | 2 +- src/Web.php | 158 ++++------- src/Web/Controllers/DebugBarController.php | 40 +-- src/Web/Controllers/DivisionController.php | 58 ++-- src/Web/Controllers/DocsController.php | 51 ++-- src/Web/Controllers/IndexController.php | 16 +- src/Web/Controllers/PingController.php | 16 +- src/Web/ErrorHandlers/ErrorHandler.php | 159 +++++++++-- src/Web/ErrorHandlers/NotFoundHandler.php | 85 +++++- src/Web/ErrorHandlers/PhpErrorHandler.php | 13 +- src/Web/Routing.php | 127 +++++++++ .../DivisionController/Division.twig | 10 +- .../DivisionController/template.twig | 11 +- src/Web/Templates/DocsController/main.twig | 14 +- .../IndexController/indexAction.twig | 2 +- src/Web/Templates/template.twig | 5 +- tests/bootstrap.php | 1 + 95 files changed, 2920 insertions(+), 967 deletions(-) create mode 100644 .idea/PublicWhipV2.iml create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/composerJson.xml create mode 100644 .idea/fileTemplates/code/PHP Constructor.php create mode 100644 .idea/fileTemplates/includes/PHP Class Doc Comment.php create mode 100644 .idea/fileTemplates/includes/PHP Interface 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 create mode 100644 .idea/fileTemplates/internal/PHPUnit 6 Test.php create mode 100644 .idea/fileTemplates/internal/PHPUnit Test.php rename phpStormInspections.xml => .idea/inspectionProfiles/Project_Default.xml (97%) create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/php-docker-settings.xml create mode 100644 .idea/php-test-framework.xml create mode 100644 .idea/php.xml create mode 100644 .idea/vcs.xml delete mode 100644 cache/.gitkeep create mode 100644 docs/ChangeLog.md create mode 100644 docs/Production.md delete mode 100644 logs/.gitkeep delete mode 100644 phpStormCodeStyle.xml delete mode 100644 qa/.gitkeep delete mode 100644 src/Entities/AbstractEntity.php delete mode 100644 src/Exceptions/Entities/AbstractEntityException.php delete mode 100644 src/Exceptions/Entities/EntityPassedUnrecognisedFieldException.php create mode 100644 src/Exceptions/Factories/AbstractFactoryException.php create mode 100644 src/Exceptions/Factories/BadDateTimeException.php create mode 100644 src/Exceptions/Factories/EntityFactoryPassedUnrecognisedFieldException.php rename src/Exceptions/{Entities => Factories}/EntityFieldWrongTypeException.php (52%) rename src/Exceptions/{Entities => Factories}/EntityMissingRequiredFieldException.php (69%) create mode 100644 src/Exceptions/MissingConfigurationException.php create mode 100644 src/Factories/DateTimeFactory.php create mode 100644 src/Factories/DateTimeFactoryInterface.php create mode 100644 src/Factories/EntityFactory.php create mode 100644 src/Factories/EntityFactoryInterface.php create mode 100644 src/Factories/README.md create mode 100644 src/Providers/CallableResolverProvider.php create mode 100644 src/Providers/CallableResolverProviderInterface.php create mode 100644 src/Providers/ControllerInvokerProvider.php create mode 100644 src/Providers/TemplateProvider.php create mode 100644 src/Providers/TemplateProviderInterface.php create mode 100644 src/Web/Routing.php diff --git a/.editorconfig b/.editorconfig index 317595c..2c61dbd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,20 +4,12 @@ end_of_line=lf insert_final_newline=false indent_style=space indent_size=4 +trim_trailing_whitespace = true -[{.babelrc,.stylelintrc,jest.config,.eslintrc,*.json,*.jsb3,*.jsb2,*.bowerrc}] -indent_style=space -indent_size=2 - -[{*.cql,*.ddl,*.sql}] -indent_style=space -indent_size=2 +[*.md] +trim_trailing_whitespace = false -[{*.yaml,*.yml}] -indent_style=space +[{.babelrc,.stylelintrc,jest.config,.eslintrc,*.json,*.jsb3,*.jsb2,*.bowerrc,*.yaml,*.yml,*.sql,composer.lock}] indent_size=2 -[{composer.lock,composer.json}] -indent_style=space -indent_size=2 diff --git a/.gitignore b/.gitignore index 60e7474..b6f4392 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,34 @@ -.idea -.php_cs.cache +# We allow .idea to enable shared development on Jetbrains IDEs +# but exclude the following user-specific stuff +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf +# ... generated files +.idea/**/contentModel.xml +# .. sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml +.idea/httpRequests + +# We don't want the logs folder populated as the contents are local only. logs/* -!logs/.gitkeep !logs/README.md +# We don't want the cache folder populated as the contents are local only. cache/* -!cache/.gitkeep !cache/README.md -vendor/* +# We don't want the qa folder populated as the results change too often. qa/* -!qa/.gitkeep !qa/README.md +# We don't want the following cache files stored as they are local only. .phpunit.result.cache -!.gitkeep \ No newline at end of file +.php_cs.cache +# We don't want vendor to accidentally make it into the repo. +vendor/* \ No newline at end of file diff --git a/.idea/PublicWhipV2.iml b/.idea/PublicWhipV2.iml new file mode 100644 index 0000000..8068e71 --- /dev/null +++ b/.idea/PublicWhipV2.iml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..d6fc450 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,30 @@ + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/composerJson.xml b/.idea/composerJson.xml new file mode 100644 index 0000000..1b07430 --- /dev/null +++ b/.idea/composerJson.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ 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 0000000..737a7dd --- /dev/null +++ b/.idea/fileTemplates/code/PHP Constructor.php @@ -0,0 +1,6 @@ +/** + * Constructor. +${PARAM_DOC} +${THROWS_DOC} +*/ +public function __construct(${PARAM_LIST}) {${BODY}} \ No newline at end of file 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 0000000..9d97f4d --- /dev/null +++ b/.idea/fileTemplates/includes/PHP Class Doc Comment.php @@ -0,0 +1,3 @@ +/** + * Class ${NAME}. + */ 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 0000000..cb387af --- /dev/null +++ b/.idea/fileTemplates/includes/PHP Interface Doc Comment.php @@ -0,0 +1,3 @@ +/** + * Interface ${NAME}. + */ 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 0000000..118cf16 --- /dev/null +++ b/.idea/fileTemplates/includes/PHP Trait Doc Comment.php @@ -0,0 +1,3 @@ +/** + * Trait ${NAME}. + */ diff --git a/.idea/fileTemplates/internal/PHP Class.php b/.idea/fileTemplates/internal/PHP Class.php new file mode 100644 index 0000000..860cba4 --- /dev/null +++ b/.idea/fileTemplates/internal/PHP Class.php @@ -0,0 +1,9 @@ + PublicWhip inspections