Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
Feature/update rules (#29)
Browse files Browse the repository at this point in the history
* feat : updated kubawerlos/php-cs-fixer-custom-fixers
* feat : updated friendsofphp/php-cs-fixer
* fix : removed or replaced deprecated rules
* feat : removed phpunit.php from .gitattributes
* feat : added dependabot
* feat : changed 7.4snapshot to 7.4
* style : cs fixes
  • Loading branch information
prisis authored Jan 13, 2020
1 parent 9344e5f commit 5c6a6a3
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 46 deletions.
17 changes: 17 additions & 0 deletions .dependabot/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# https://dependabot.com/docs/config-file/

version: 1

update_configs:
- automerged_updates:
- match:
dependency_type: "development"
commit_message:
include_scope: true
prefix: "Build"
default_labels:
- "dependency"
directory: "/"
package_manager: "php:composer"
update_schedule: "live"
version_requirement_updates: "increase_versions"
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ build export-ignore
phpstan.neon export-ignore

phpunit.xml.dist export-ignore
phpunit.php export-ignore

CONTRIBUTING.md export-ignore
README.md export-ignore
CODE_OF_CONDUCT.md export-ignore
CODE_OF_CONDUCT.md export-ignore
11 changes: 2 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ install:
- $COMPOSER_UP

jobs:
allow_failures:
- php: nightly
- php: 7.4snapshot

include:
- stage: Test
php: 7.2
Expand All @@ -33,11 +29,8 @@ jobs:
php: 7.3
env: REMOVE_XDEBUG=true
- stage: Test
php: 7.4snapshot
# env: REMOVE_XDEBUG=true
- stage: Test
php: nightly
# env: REMOVE_XDEBUG=true
php: 7.4
env: REMOVE_XDEBUG=true

- stage: Static Analysis
if: type != cron
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@
],
"require": {
"php": "^7.2",
"friendsofphp/php-cs-fixer": "~2.16.0",
"kubawerlos/php-cs-fixer-custom-fixers": "~1.16.1",
"friendsofphp/php-cs-fixer": "~2.16.1",
"kubawerlos/php-cs-fixer-custom-fixers": "~1.17.0",
"pedrotroller/php-cs-custom-fixer": "~2.19.1"
},
"require-dev": {
"narrowspark/testing-helper": "^8.0.1",
"phpstan/phpstan": "^0.11.16",
"phpstan/phpstan-deprecation-rules": "^0.11.2",
"phpstan/phpstan-phpunit": "^0.11.2",
"phpstan/phpstan-strict-rules": "^0.11.1",
"phpunit/phpunit": "^8.4.1",
"thecodingmachine/phpstan-strict-rules": "^0.11.2"
"narrowspark/testing-helper": "^8.0.2",
"phpstan/phpstan": "^0.12.3",
"phpstan/phpstan-deprecation-rules": "^0.12.0",
"phpstan/phpstan-phpunit": "^0.12.1",
"phpstan/phpstan-strict-rules": "^0.12.0",
"phpunit/phpunit": "^8.5.2",
"thecodingmachine/phpstan-strict-rules": "^0.12.0"
},
"config": {
"sort-packages": true
Expand Down
13 changes: 7 additions & 6 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
includes:
- %rootDir%/../phpstan-deprecation-rules/rules.neon
- %rootDir%/../phpstan-phpunit/extension.neon
- %rootDir%/../phpstan-phpunit/rules.neon
- %rootDir%/../phpstan-strict-rules/rules.neon
- %rootDir%/../../thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
- %rootDir%/../phpstan/conf/bleedingEdge.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon

parameters:
level: max
inferPrivatePropertyTypeFromConstructor: true
checkMissingIterableValueType: true

autoload_directories:
- %currentWorkingDirectory%/src
Expand Down
20 changes: 10 additions & 10 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PhpCsFixerCustomFixers\Fixer\CommentSurroundedBySpacesFixer;
use PhpCsFixerCustomFixers\Fixer\DataProviderNameFixer;
use PhpCsFixerCustomFixers\Fixer\DataProviderReturnTypeFixer;
use PhpCsFixerCustomFixers\Fixer\DataProviderStaticFixer;
use PhpCsFixerCustomFixers\Fixer\InternalClassCasingFixer;
use PhpCsFixerCustomFixers\Fixer\MultilineCommentOpeningClosingAloneFixer;
use PhpCsFixerCustomFixers\Fixer\NoCommentedOutCodeFixer;
Expand All @@ -18,20 +19,19 @@
use PhpCsFixerCustomFixers\Fixer\NoNullableBooleanTypeFixer;
use PhpCsFixerCustomFixers\Fixer\NoPhpStormGeneratedCommentFixer;
use PhpCsFixerCustomFixers\Fixer\NoReferenceInFunctionDefinitionFixer;
use PhpCsFixerCustomFixers\Fixer\NoUnneededConcatenationFixer;
use PhpCsFixerCustomFixers\Fixer\NoSuperfluousConcatenationFixer;
use PhpCsFixerCustomFixers\Fixer\NoUselessCommentFixer;
use PhpCsFixerCustomFixers\Fixer\NoUselessDoctrineRepositoryCommentFixer;
use PhpCsFixerCustomFixers\Fixer\NoUselessSprintfFixer;
use PhpCsFixerCustomFixers\Fixer\NullableParamStyleFixer;
use PhpCsFixerCustomFixers\Fixer\OperatorLinebreakFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocNoIncorrectVarAnnotationFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocNoSuperfluousParamFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocParamOrderFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocParamTypeFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocSelfAccessorFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocSingleLineVarFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocTypesTrimFixer;
use PhpCsFixerCustomFixers\Fixer\PhpUnitNoUselessReturnFixer;
use PhpCsFixerCustomFixers\Fixer\SingleLineThrowFixer;
use PhpCsFixerCustomFixers\Fixer\SingleSpaceAfterStatementFixer;
use PhpCsFixerCustomFixers\Fixer\SingleSpaceBeforeStatementFixer;
use const PHP_VERSION_ID;
Expand All @@ -44,18 +44,18 @@ final class Config extends CsConfig
/**
* A list of override rules.
*
* @var array
* @var array<string, array<string, mixed>|bool|string>
*/
private $overwriteRules;

/** @var array */
/** @var array<string, array<string, string>> */
private $headerRules = [];

/**
* Create new Config instance.
*
* @param null|string $header
* @param array $overwriteConfig
* @param null|string $header
* @param array<string, array<string, mixed>|bool|string> $overwriteConfig
*/
public function __construct(?string $header = null, array $overwriteConfig = [])
{
Expand Down Expand Up @@ -133,10 +133,9 @@ protected function getKubawerlosRules(): array
NoNullableBooleanTypeFixer::name() => false,
NoPhpStormGeneratedCommentFixer::name() => true,
NoReferenceInFunctionDefinitionFixer::name() => false,
NoUnneededConcatenationFixer::name() => true,
NoSuperfluousConcatenationFixer::name() => true,
NoUselessCommentFixer::name() => false,
NoUselessDoctrineRepositoryCommentFixer::name() => true,
NullableParamStyleFixer::name() => false,
OperatorLinebreakFixer::name() => true,
PhpdocNoIncorrectVarAnnotationFixer::name() => true,
PhpdocNoSuperfluousParamFixer::name() => true,
Expand All @@ -149,10 +148,11 @@ protected function getKubawerlosRules(): array
DataProviderNameFixer::name() => true,
NoUselessSprintfFixer::name() => true,
PhpUnitNoUselessReturnFixer::name() => true,
SingleLineThrowFixer::name() => false,
NoDuplicatedImportsFixer::name() => true,
DataProviderReturnTypeFixer::name() => true,
CommentSurroundedBySpacesFixer::name() => true,
DataProviderStaticFixer::name() => true,
PhpdocTypesTrimFixer::name() => true,
];
}

Expand Down
19 changes: 9 additions & 10 deletions tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Narrowspark\CS\Config\Tests;

use Generator;
use Narrowspark\CS\Config\Config;
use Narrowspark\TestingHelper\Traits\AssertArrayTrait;
use PhpCsFixer\ConfigInterface;
Expand All @@ -14,6 +13,7 @@
use PhpCsFixerCustomFixers\Fixer\CommentSurroundedBySpacesFixer;
use PhpCsFixerCustomFixers\Fixer\DataProviderNameFixer;
use PhpCsFixerCustomFixers\Fixer\DataProviderReturnTypeFixer;
use PhpCsFixerCustomFixers\Fixer\DataProviderStaticFixer;
use PhpCsFixerCustomFixers\Fixer\InternalClassCasingFixer;
use PhpCsFixerCustomFixers\Fixer\MultilineCommentOpeningClosingAloneFixer;
use PhpCsFixerCustomFixers\Fixer\NoCommentedOutCodeFixer;
Expand All @@ -24,20 +24,19 @@
use PhpCsFixerCustomFixers\Fixer\NoNullableBooleanTypeFixer;
use PhpCsFixerCustomFixers\Fixer\NoPhpStormGeneratedCommentFixer;
use PhpCsFixerCustomFixers\Fixer\NoReferenceInFunctionDefinitionFixer;
use PhpCsFixerCustomFixers\Fixer\NoUnneededConcatenationFixer;
use PhpCsFixerCustomFixers\Fixer\NoSuperfluousConcatenationFixer;
use PhpCsFixerCustomFixers\Fixer\NoUselessCommentFixer;
use PhpCsFixerCustomFixers\Fixer\NoUselessDoctrineRepositoryCommentFixer;
use PhpCsFixerCustomFixers\Fixer\NoUselessSprintfFixer;
use PhpCsFixerCustomFixers\Fixer\NullableParamStyleFixer;
use PhpCsFixerCustomFixers\Fixer\OperatorLinebreakFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocNoIncorrectVarAnnotationFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocNoSuperfluousParamFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocParamOrderFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocParamTypeFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocSelfAccessorFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocSingleLineVarFixer;
use PhpCsFixerCustomFixers\Fixer\PhpdocTypesTrimFixer;
use PhpCsFixerCustomFixers\Fixer\PhpUnitNoUselessReturnFixer;
use PhpCsFixerCustomFixers\Fixer\SingleLineThrowFixer;
use PhpCsFixerCustomFixers\Fixer\SingleSpaceAfterStatementFixer;
use PhpCsFixerCustomFixers\Fixer\SingleSpaceBeforeStatementFixer;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -221,7 +220,7 @@ public function testDoesNotHaveRulesEnabled(string $fixer, $reason): void
/**
* @return array
*/
public function provideDoesNotHaveRulesEnabledCases(): iterable
public static function provideDoesNotHaveRulesEnabledCases(): iterable
{
$symfonyFixers = [
'self_accessor' => 'it causes an edge case error',
Expand Down Expand Up @@ -285,9 +284,9 @@ public function testHeaderCommentFixerIsEnabledIfHeaderIsProvided($header): void
}

/**
* @return Generator
* @return iterable
*/
public function provideHeaderCommentFixerIsEnabledIfHeaderIsProvidedCases(): iterable
public static function provideHeaderCommentFixerIsEnabledIfHeaderIsProvidedCases(): iterable
{
$values = [
'string-empty' => '',
Expand Down Expand Up @@ -371,10 +370,9 @@ protected function getKubawerlosRules(): array
NoNullableBooleanTypeFixer::name() => false,
NoPhpStormGeneratedCommentFixer::name() => true,
NoReferenceInFunctionDefinitionFixer::name() => false,
NoUnneededConcatenationFixer::name() => true,
NoSuperfluousConcatenationFixer::name() => true,
NoUselessCommentFixer::name() => false,
NoUselessDoctrineRepositoryCommentFixer::name() => true,
NullableParamStyleFixer::name() => false,
OperatorLinebreakFixer::name() => true,
PhpdocNoIncorrectVarAnnotationFixer::name() => true,
PhpdocNoSuperfluousParamFixer::name() => true,
Expand All @@ -387,10 +385,11 @@ protected function getKubawerlosRules(): array
DataProviderNameFixer::name() => true,
NoUselessSprintfFixer::name() => true,
PhpUnitNoUselessReturnFixer::name() => true,
SingleLineThrowFixer::name() => true,
NoDuplicatedImportsFixer::name() => true,
DataProviderReturnTypeFixer::name() => true,
CommentSurroundedBySpacesFixer::name() => true,
DataProviderStaticFixer::name() => true,
PhpdocTypesTrimFixer::name() => true,
];
}

Expand Down

0 comments on commit 5c6a6a3

Please sign in to comment.