From 94d1cbb09b8f3f87fb190f21270f9ee0690d8c97 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Fri, 20 Jan 2023 15:34:02 -0500 Subject: [PATCH] Fix some code style issues --- .gitignore | 4 +++- RoboFile.php | 20 ++++++++++---------- build/CodeIgniter/ruleset.xml | 33 --------------------------------- composer.json | 17 +++++------------ src/JoinType.php | 3 ++- src/LikeType.php | 3 ++- src/common.php | 1 - tools/composer.json | 7 ++++++- tools/phpdox/composer.json | 5 +++++ 9 files changed, 33 insertions(+), 60 deletions(-) create mode 100644 tools/phpdox/composer.json diff --git a/.gitignore b/.gitignore index 2e700e6..1c4903b 100644 --- a/.gitignore +++ b/.gitignore @@ -132,6 +132,7 @@ test_config.json index.html tests/db_files/*.db build/api/* +build/cache build/coverage/* build/logs/* build/pdepend/* @@ -139,8 +140,9 @@ build/phpdox/* cache.properties tests/settings.json .php_cs +.phpdoc coverage/* -vendor/* +vendor composer.lock docs/phpdoc* .project diff --git a/RoboFile.php b/RoboFile.php index 43efd50..3427c99 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -105,7 +105,7 @@ class RoboFile extends Tasks { */ public function docs(): void { - $this->_run(['vendor/bin/phpdox']); + $this->_run(['tools/phpdox/vendor/bin/phpdox']); } /** @@ -128,18 +128,18 @@ class RoboFile extends Tasks { * * @param bool $report - if true, generates reports instead of direct output */ - public function phpcs($report = FALSE): void + public function phpcs(bool $report = FALSE): void { $dir = __DIR__; $report_cmd_parts = [ - 'vendor/bin/phpcs', + 'tools/vendor/bin/phpcs', "--standard=./build/CodeIgniter", "--report-checkstyle=./build/logs/phpcs.xml", ]; $normal_cmd_parts = [ - 'vendor/bin/phpcs', + 'tools/vendor/bin/phpcs', "--standard=./build/CodeIgniter", ]; @@ -148,10 +148,10 @@ class RoboFile extends Tasks { $this->_run($cmd_parts); } - public function phpmd($report = FALSE): void + public function phpmd(bool $report = FALSE): void { $report_cmd_parts = [ - 'vendor/bin/phpmd', + 'tools/vendor/bin/phpmd', './src', 'xml', 'cleancode,codesize,controversial,design,naming,unusedcode', @@ -160,7 +160,7 @@ class RoboFile extends Tasks { ]; $normal_cmd_parts = [ - 'vendor/bin/phpmd', + 'tools/vendor/bin/phpmd', './src', 'ansi', 'cleancode,codesize,controversial,design,naming,unusedcode', @@ -181,7 +181,7 @@ class RoboFile extends Tasks { { // Command for generating reports $report_cmd_parts = [ - 'vendor/bin/phploc', + 'tools/vendor/bin/phploc', '--count-tests', '--log-csv=build/logs/phploc.csv', '--log-xml=build/logs/phploc.xml', @@ -191,7 +191,7 @@ class RoboFile extends Tasks { // Command for generating direct output $normal_cmd_parts = [ - 'vendor/bin/phploc', + 'tools/vendor/bin/phploc', '--count-tests', 'src', 'tests' @@ -284,7 +284,7 @@ class RoboFile extends Tasks { protected function phpcpdReport(): void { $cmd_parts = [ - 'vendor/bin/phpcpd', + 'tools/vendor/bin/phpcpd', '--log-pmd build/logs/pmd-cpd.xml', 'src' ]; diff --git a/build/CodeIgniter/ruleset.xml b/build/CodeIgniter/ruleset.xml index e943a4b..60f57a0 100644 --- a/build/CodeIgniter/ruleset.xml +++ b/build/CodeIgniter/ruleset.xml @@ -25,39 +25,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/composer.json b/composer.json index 952db00..3604016 100644 --- a/composer.json +++ b/composer.json @@ -32,15 +32,7 @@ "ext-pdo": "*" }, "require-dev": { - "consolidation/robo": "^2.0.0", - "monolog/monolog": "^2.0.1", - "phploc/phploc": "^7.0", - "phpmd/phpmd": "^2.8", - "phpstan/phpstan": "^0.12.2", - "phpunit/phpunit": "^9.4", - "sebastian/phpcpd": "^6.0", - "simpletest/simpletest": "^1.1", - "squizlabs/php_codesniffer": "^3.0.0" + "phpunit/phpunit": "^9.4" }, "autoload": { "psr-4": { @@ -56,11 +48,12 @@ } }, "scripts": { - "build": "robo build", - "clean": "robo clean", + "build": "tools/vendor/bin/robo build", + "clean": "tools/vendor/bin/robo clean", + "docs": "php tools/phpDocumentor run --sourcecode", "coverage": "phpdbg -qrr -- vendor/bin/phpunit -c build", "pcov": "vendor/bin/phpunit -c build", - "phpstan": "phpstan analyse -l 3 -c phpstan.neon src tests", + "phpstan": "tools/vendor/bin/phpstan analyse -l 3 -c phpstan.neon src tests", "test": "phpunit -c build --no-coverage" }, "scripts-descriptions": { diff --git a/src/JoinType.php b/src/JoinType.php index f7a9f5b..4aaf05c 100644 --- a/src/JoinType.php +++ b/src/JoinType.php @@ -25,7 +25,8 @@ enum JoinType: string { case LEFT = 'left'; case RIGHT = 'right'; - public static function parse(string|self $val): self { + public static function parse(string|self $val): self + { if ($val instanceof self) { return $val; diff --git a/src/LikeType.php b/src/LikeType.php index 5714c2a..de93eda 100644 --- a/src/LikeType.php +++ b/src/LikeType.php @@ -23,7 +23,8 @@ enum LikeType: string { case AFTER = 'after'; case BOTH = 'both'; - public static function parse(string|self $val): self { + public static function parse(string|self $val): self + { if ($val instanceof self) { return $val; diff --git a/src/common.php b/src/common.php index fbb0859..f66d72b 100644 --- a/src/common.php +++ b/src/common.php @@ -100,7 +100,6 @@ namespace { * connection created. */ function Query(string|object|array|null $params = ''): ?QueryBuilderInterface - { if ($params === NULL) { diff --git a/tools/composer.json b/tools/composer.json index df338b5..2430332 100644 --- a/tools/composer.json +++ b/tools/composer.json @@ -1,5 +1,10 @@ { "require": { - "theseer/phpdox": "*" + "consolidation/robo": "^4.0.0", + "phploc/phploc": "^7.0", + "phpmd/phpmd": "^2.8", + "phpstan/phpstan": "^1.9.14", + "sebastian/phpcpd": "^6.0", + "squizlabs/php_codesniffer": "^3.0.0" } } diff --git a/tools/phpdox/composer.json b/tools/phpdox/composer.json new file mode 100644 index 0000000..1bd7929 --- /dev/null +++ b/tools/phpdox/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "theseer/phpdox": "^0.12.0" + } +} \ No newline at end of file