Skip to content

Commit

Permalink
Merge pull request #50 from ray-di/update-cs
Browse files Browse the repository at this point in the history
Update CS
  • Loading branch information
koriym committed Oct 7, 2020
2 parents 28fe188 + e4a8a88 commit d32be4a
Show file tree
Hide file tree
Showing 79 changed files with 709 additions and 968 deletions.
11 changes: 6 additions & 5 deletions .gitignore
@@ -1,7 +1,8 @@
/.idea/
/build/
/vendor/
composer.lock
.php_cs.cache
.phpunit.result.cache
/tests/tmp/*
/composer.lock
/.phpunit.result.cache
/tests/tmp/*
/.phpcs-cache
/.php_cs.cache
.phpcs-cache
6 changes: 1 addition & 5 deletions .php_cs.dist
@@ -1,10 +1,6 @@
<?php

$header = <<<'EOF'
This file is part of the Ray.AuraSqlModule package.
@license http://opensource.org/licenses/MIT MIT
EOF;
$header = '';

return \PhpCsFixer\Config::create()
->setRiskyAllowed(true)
Expand Down
1 change: 1 addition & 0 deletions .phpcs-cache

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -59,8 +59,8 @@ jobs:
- stage: Code Quality
name: Coding standards
php: 7.4
install: composer global require --dev friendsofphp/php-cs-fixer ^2.0;
install: composer global require --dev doctrine/coding-standard ^8.1
script:
- ~/.composer/vendor/bin/php-cs-fixer --dry-run -v fix;
- ~/.composer/vendor/bin/phpcs --standard=./phpcs.xml src tests
allow_failures:
- php: nightly
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -41,8 +41,8 @@
"test": ["phpunit"],
"tests": ["@cs", "@sa", "@test"],
"coverage": ["php -dzend_extension=xdebug.so ./vendor/bin/phpunit --coverage-text --coverage-html=build/coverage"],
"cs": ["php-cs-fixer fix -v --dry-run", "phpcs --standard=./phpcs.xml src"],
"cs-fix": ["php-cs-fixer fix -v", "phpcbf src"],
"cs": ["phpcs --standard=./phpcs.xml src tests"],
"cs-fix": ["phpcbf src tests"],
"sa": ["phpstan analyse -c phpstan.neon", "psalm"],
"metrics": ["phpmetrics --report-html=build/metrics/ --extensions=php src,composer.json,composer.lock"]
}
Expand Down
5 changes: 0 additions & 5 deletions docs/demo/run.php
@@ -1,9 +1,4 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/
use Aura\Sql\ExtendedPdo;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Ray\AuraSqlModule\AuraSqlInject;
Expand Down
5 changes: 0 additions & 5 deletions docs/demo/run_by_app_module.php
@@ -1,9 +1,4 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/
use Aura\Sql\ExtendedPdo;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Ray\AuraSqlModule\AuraSqlInject;
Expand Down
79 changes: 63 additions & 16 deletions phpcs.xml
@@ -1,19 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="PHP_CodeSniffer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
<rule ref="PSR2">
<exclude name="Generic.Files.LineLength"/>
<?xml version="1.0"?>
<ruleset
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="bearcs"
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">

<arg name="basepath" value="."/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<arg name="cache" value=".phpcs-cache"/>

<!-- Ignore warnings, show progress of the run and show sniff names -->
<arg value="nps"/>

<!-- Directories to be checked -->
<file>src</file>
<file>tests</file>
<exclude-pattern>*/tests/tmp/*</exclude-pattern>

<!-- PSR12 Coding Standard -->
<rule ref="PSR12"/>

<!-- Doctrine Coding Standard -->
<rule ref="Doctrine">
<!-- Inapplicable for this project -->
<!-- Base -->
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSame"/>
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"/>
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable"/>
<exclude name="SlevomatCodingStandard.Commenting.UselessInheritDocComment.UselessInheritDocComment"/>
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint"/>
<!-- /Base -->
<!-- Option -->
<exclude name="SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed"/>
<!-- /Option -->
<!-- Exclude Fake files form Doctrine CS -->
<exclude-pattern>*/tests/Fake/*</exclude-pattern>
</rule>
<rule ref="PEAR.Commenting.FunctionComment">
<exclude name="PEAR.Commenting.FunctionComment.MissingReturn"/>
<exclude name="PEAR.Commenting.FunctionComment.MissingParamComment"/>
<exclude name="PEAR.Commenting.FunctionComment.SpacingBeforeTags"/>
<exclude name="PEAR.Commenting.FunctionComment.MissingParamTag"/>
<exclude name="PEAR.Commenting.FunctionComment.Missing"/>
<exclude name="PEAR.Commenting.FunctionComment.ParameterCommentsNotAligned"/>
<exclude name="PEAR.Commenting.FunctionComment.ParamNameNoMatch"/>

<!-- Additional Rules -->
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
<properties>
<property name="annotationsGroups" type="array">
<element value="@param, @psalm-param, @phpstan-param"/>
<element value="@return, @psalm-return, @phpstan-return"/>
<element value="@throws"/>
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint">
<include-pattern>src/Module/*</include-pattern>
<include-pattern>tests/*</include-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Classes.PropertySpacing">
<properties>
<property name="minLinesCountBeforeWithComment" value="1"/>
<property name="maxLinesCountBeforeWithComment" value="1"/>
<property name="maxLinesCountBeforeWithoutComment" value="0"/>
</properties>
</rule>
<exclude-pattern>*/tests/Fake/*</exclude-pattern>
</ruleset>
5 changes: 0 additions & 5 deletions src-deprecated/PropTransaction.php
@@ -1,9 +1,4 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/
namespace Ray\AuraSqlModule;

use Aura\Sql\ExtendedPdoInterface;
Expand Down
5 changes: 0 additions & 5 deletions src-files/uri_template.php
@@ -1,9 +1,4 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/
if (! \function_exists('\\uri_template')) {
/**
* Implementation of URI Template(RFC6570) specification for PHP
Expand Down
8 changes: 3 additions & 5 deletions src/Annotation/AuraSql.php
@@ -1,9 +1,7 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Ray\AuraSqlModule\Annotation;

/**
Expand Down
12 changes: 4 additions & 8 deletions src/Annotation/AuraSqlConfig.php
@@ -1,9 +1,7 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Ray\AuraSqlModule\Annotation;

use Ray\Di\Di\Qualifier;
Expand All @@ -15,8 +13,6 @@
*/
final class AuraSqlConfig
{
/**
* @var array<string>
*/
/** @var array<string> */
public $value;
}
12 changes: 4 additions & 8 deletions src/Annotation/AuraSqlQueryConfig.php
@@ -1,9 +1,7 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Ray\AuraSqlModule\Annotation;

use Ray\Di\Di\Qualifier;
Expand All @@ -15,8 +13,6 @@
*/
final class AuraSqlQueryConfig
{
/**
* @var array<string, string>
*/
/** @var array<string, string> */
public $value;
}
8 changes: 3 additions & 5 deletions src/Annotation/HttpMethod.php
@@ -1,9 +1,7 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Ray\AuraSqlModule\Annotation;

/**
Expand Down
12 changes: 4 additions & 8 deletions src/Annotation/PagerViewOption.php
@@ -1,9 +1,7 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Ray\AuraSqlModule\Annotation;

use Ray\Di\Di\Qualifier;
Expand All @@ -15,8 +13,6 @@
*/
final class PagerViewOption
{
/**
* @var string
*/
/** @var string */
public $value;
}
12 changes: 4 additions & 8 deletions src/Annotation/Read.php
@@ -1,9 +1,7 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Ray\AuraSqlModule\Annotation;

use Ray\Di\Di\Qualifier;
Expand All @@ -15,8 +13,6 @@
*/
final class Read
{
/**
* @var string
*/
/** @var string */
public $value;
}
8 changes: 3 additions & 5 deletions src/Annotation/ReadOnlyConnection.php
@@ -1,9 +1,7 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Ray\AuraSqlModule\Annotation;

/**
Expand Down
9 changes: 3 additions & 6 deletions src/Annotation/Transactional.php
@@ -1,9 +1,7 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Ray\AuraSqlModule\Annotation;

/**
Expand All @@ -14,7 +12,6 @@ final class Transactional
{
/**
* @var array<string>
*
* @deprecated
*/
public $value = ['pdo'];
Expand Down
12 changes: 4 additions & 8 deletions src/Annotation/Write.php
@@ -1,9 +1,7 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Ray\AuraSqlModule\Annotation;

use Ray\Di\Di\Qualifier;
Expand All @@ -15,8 +13,6 @@
*/
final class Write
{
/**
* @var string
*/
/** @var string */
public $value;
}
8 changes: 3 additions & 5 deletions src/Annotation/WriteConnection.php
@@ -1,9 +1,7 @@
<?php
/**
* This file is part of the Ray.AuraSqlModule package.
*
* @license http://opensource.org/licenses/MIT MIT
*/

declare(strict_types=1);

namespace Ray\AuraSqlModule\Annotation;

/**
Expand Down

0 comments on commit d32be4a

Please sign in to comment.