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

Commit

Permalink
Merge pull request #315 from PrisisForks/feature/cs-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
prisis committed Apr 16, 2021
2 parents 478e46e + 9a356ec commit 867cfa6
Show file tree
Hide file tree
Showing 6 changed files with 345 additions and 308 deletions.
2 changes: 2 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ $config->getFinder()
'.dependabot',
'.github',
])
// php_unit_namespaced rule thinks than the const are some namespaces
->notPath('rector.php')
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"phpstan/phpstan-strict-rules": "^0.12.9",
"phpunit/phpunit": "^9.5.2",
"psalm/plugin-phpunit": "^0.15.1",
"rector/rector": "^0.9.31",
"rector/rector": "^0.10.6",
"rector/rector-phpunit": "^0.10.6",
"slam/phpstan-extensions": "^5.1.0",
"symplify/phpstan-rules": "^9.2",
"thecodingmachine/phpstan-strict-rules": "^0.12.1",
Expand Down
25 changes: 24 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use Nette\Utils\Strings;
use Rector\Core\Configuration\Option;
use Rector\Core\ValueObject\PhpVersion;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
Expand Down Expand Up @@ -56,6 +58,27 @@
$parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, $phpstanPath);

$parameters->set(Option::SETS, [
'action-injection-to-constructor-injection', 'array-str-functions-to-static-call', 'early-return', 'doctrine-code-quality', 'dead-code', 'code-quality', 'type-declaration', 'order', 'psr4', 'type-declaration', 'type-declaration-strict', 'php71', 'php72', 'php73', 'php74', 'php80', 'phpunit91', 'phpunit-code-quality', 'phpunit-exception', 'phpunit-yield-data-provider',
SetList::CODING_STYLE,
SetList::CODE_QUALITY,
SetList::CODE_QUALITY_STRICT,
SetList::DEAD_CODE,
SetList::PRIVATIZATION,
SetList::NAMING,
SetList::TYPE_DECLARATION,
SetList::ORDER,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
PHPUnitSetList::PHPUNIT_91,
PHPUnitSetList::PHPUNIT_EXCEPTION,
PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER,
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
SetList::PHP_71,
SetList::PHP_72,
SetList::PHP_73,
SetList::PHP_74,
SetList::PHP_80,
SetList::EARLY_RETURN,
SetList::TYPE_DECLARATION_STRICT,
SetList::PSR_4,
SetList::SAFE_07,
]);
};
3 changes: 2 additions & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
use function is_string;
use function trim;

/** @noRector ArgumentAdderRector */
final class Config extends CsConfig
{
/** @var array<string, array<string, string>> */
Expand Down Expand Up @@ -171,7 +172,7 @@ public function getRules(): array
}

/**
* @return bool[][]|string[][]
* @return array<string, array<string, bool>>|array<string, array<string, string>>|array<string, bool>
*
* @psalm-return array{final_static_access: true, final_public_method_for_abstract_class: true, lowercase_constants: false, global_namespace_import: array{import_classes: true, import_constants: true, import_functions: true}, nullable_type_declaration_for_default_null_value: true, phpdoc_line_span: array{const: string, method: string, property: string}, phpdoc_to_param_type: false, self_static_accessor: true}
*/
Expand Down
9 changes: 5 additions & 4 deletions tests/Constraint/ArraySubset.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use SebastianBergmann\RecursionContext\InvalidArgumentException;
use Traversable;
use function is_array;
use function Safe\array_replace_recursive;

/**
* Constraint that asserts that the array it is evaluated for has a specified subset.
Expand All @@ -32,7 +33,7 @@
final class ArraySubset extends Constraint
{
/** @var mixed[] */
private array $subset;
private array $subset = [];

/**
* @param ArrayObject|iterable|mixed[]|Traversable $subset
Expand Down Expand Up @@ -80,14 +81,14 @@ public function evaluate($other, string $description = '', bool $returnResult =
return null;
}

$f = new ComparisonFailure(
$comparisonFailure = new ComparisonFailure(
$patched,
$arr,
var_export($patched, true),
var_export($arr, true)
);

$this->fail($arr, $description, $f);
$this->fail($arr, $description, $comparisonFailure);
}

/**
Expand Down Expand Up @@ -124,7 +125,7 @@ protected function failureDescription($other): string
*
* @return mixed[]
*/
protected function toArray(iterable $other): array
private function toArray(iterable $other): array
{
if (is_array($other)) {
return $other;
Expand Down
Loading

0 comments on commit 867cfa6

Please sign in to comment.