Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 0 additions & 89 deletions bin/generate-php-cs-fixer-tests.php

This file was deleted.

14 changes: 0 additions & 14 deletions build/target-repository/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,6 @@ Or enable everything at once with `->withPreparedSets(common: true)`.

<br>

Do you want to include one of sets from [php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst)?

You can:

```php
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
->withPhpCsFixerSets(perCS20: true, doctrineAnnotation: true);
```

<br>

### Gradual Adoption with Levels

Want to adopt a coding standard step by step instead of all at once? Use `with*Level()` methods to start from the safest rules and raise the level as your codebase catches up:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private function processFunctionOrArray(Tokens $tokens, int $position): void
}

// @todo is __construct() class method and is newline parma enabled? → skip it
if ($this->standaloneLineConstructorParamFixer && $this->methodNameResolver->isMethodName(
if ($this->standaloneLineConstructorParamFixer instanceof StandaloneLineConstructorParamFixer && $this->methodNameResolver->isMethodName(
$tokens,
$position,
'__construct'
Expand Down
29 changes: 11 additions & 18 deletions src/Config/ECSConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

namespace Symplify\EasyCodingStandard\Config;

use Entropy\Console\Output\OutputColorizer;
use Entropy\Console\Output\OutputPrinter;
use Entropy\Container\Container;
use Override;
use PHP_CodeSniffer\Sniffs\Sniff;
use PhpCsFixer\Fixer\ConfigurableFixerInterface;
use PhpCsFixer\Fixer\FixerInterface;
use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
use PhpCsFixer\FixerFactory;
use PhpCsFixer\RuleSet\RuleSet;
use PhpCsFixer\WhitespacesFixerConfig;
use Symplify\EasyCodingStandard\Configuration\ECSConfigBuilder;
use Symplify\EasyCodingStandard\DependencyInjection\CompilerPass\ConflictingCheckersCompilerPass;
Expand Down Expand Up @@ -201,27 +201,20 @@ public function reportingRealPath(bool $absolute = true): void
}

/**
* @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst
* @deprecated Loading PHP-CS-Fixer sets is deprecated. Use ->rule()/->ruleWithConfiguration() or prepared sets instead.
* @param string[] $setNames
*/
public function dynamicSets(array $setNames): void
{
$fixerFactory = new FixerFactory();
$fixerFactory->registerBuiltInFixers();

$ruleSet = new RuleSet(array_fill_keys($setNames, true));
$fixerFactory->useRuleSet($ruleSet);

/** @var FixerInterface $fixer */
foreach ($fixerFactory->getFixers() as $fixer) {
$ruleConfiguration = $ruleSet->getRuleConfiguration($fixer->getName());
$outputPrinter = new OutputPrinter(new OutputColorizer());
$outputPrinter->warning(
'The "dynamicSets()" method is deprecated. Use ->rule()/->ruleWithConfiguration() or prepared sets instead.'
);

if ($ruleConfiguration === null) {
$this->rule($fixer::class);
} else {
$this->ruleWithConfiguration($fixer::class, $ruleConfiguration);
}
}
trigger_error(
'The "dynamicSets()" method is deprecated. Use ->rule()/->ruleWithConfiguration() or prepared sets instead.',
E_USER_DEPRECATED
);
}

public function import(string $setFilePath): void
Expand Down
Loading
Loading