Fix some code style issues

This commit is contained in:
Timothy Warren 2023-01-20 15:34:02 -05:00
parent 1bfbcf2ffe
commit 94d1cbb09b
9 changed files with 33 additions and 60 deletions

4
.gitignore vendored
View File

@ -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

View File

@ -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'
];

View File

@ -25,39 +25,6 @@
<!-- One statement per line -->
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<!-- Classes and functions should be commented -->
<rule ref="PEAR.Commenting.ClassComment">
<exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag" />
<exclude name="PEAR.Commenting.ClassComment.MissingPackageTag" />
<exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag" />
<exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag" />
<exclude name="PEAR.Commenting.ClassComment.MissingLinkTag" />
</rule>
<rule ref="PEAR.Commenting.FunctionComment">
<!-- Exclude this sniff because it doesn't understand multiple types -->
<exclude name="PEAR.Commenting.FunctionComment.MissingParamComment" />
<exclude name="PEAR.Commenting.FunctionComment.SpacingAfterParamType" />
<exclude name="PEAR.Commenting.FunctionComment.SpacingAfterParamName" />
</rule>
<!-- Use warnings for docblock comments for files and variables, since nothing is clearly explained -->
<rule ref="PEAR.Commenting.FileComment">
<exclude name="PEAR.Commenting.FileComment.InvalidVersion" />
<exclude name="PEAR.Commenting.FileComment.MissingCategoryTag" />
<properties>
<property name="error" value="false"/>
</properties>
</rule>
<rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
<rule ref="Squiz.Commenting.VariableComment">
<properties>
<property name="error" value="false"/>
</properties>
</rule>
<!-- Use Allman style indenting. With the exception of Class declarations,
braces are always placed on a line by themselves, and indented at the same level as the control statement that "owns" them. -->
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>

View File

@ -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": {

View File

@ -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;

View File

@ -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;

View File

@ -100,7 +100,6 @@ namespace {
* connection created.
*/
function Query(string|object|array|null $params = ''): ?QueryBuilderInterface
{
if ($params === NULL)
{

View File

@ -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"
}
}

View File

@ -0,0 +1,5 @@
{
"require": {
"theseer/phpdox": "^0.12.0"
}
}