1. Go to this page and download the library: Download ctw/ctw-qa library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ctw / ctw-qa example snippets
declare(strict_types=1);
use Ctw\Qa\Rector\Config\RectorConfig\DefaultFileExtensions;
use Ctw\Qa\Rector\Config\RectorConfig\DefaultSets;
use Ctw\Qa\Rector\Config\RectorConfig\DefaultSkip;
use Rector\Config\RectorConfig;
return static function (RectorConfig $rectorConfig): void {
$fileExtensions = new DefaultFileExtensions();
$sets = new DefaultSets();
$skip = new DefaultSkip();
$rectorConfig->fileExtensions($fileExtensions());
$rectorConfig->sets($sets());
$rectorConfig->paths(['src', 'test']);
$rectorConfig->skip([...$skip()]);
};
declare(strict_types=1);
use Ctw\Qa\EasyCodingStandard\Config\ECSConfig\DefaultFileExtensions;
use Ctw\Qa\EasyCodingStandard\Config\ECSConfig\DefaultIndentation;
use Ctw\Qa\EasyCodingStandard\Config\ECSConfig\DefaultLineEnding;
use Ctw\Qa\EasyCodingStandard\Config\ECSConfig\DefaultRules;
use Ctw\Qa\EasyCodingStandard\Config\ECSConfig\DefaultRulesWithConfiguration;
use Ctw\Qa\EasyCodingStandard\Config\ECSConfig\DefaultSets;
use Ctw\Qa\EasyCodingStandard\Config\ECSConfig\DefaultSkip;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\Configuration\ECSConfigBuilder;
// Wrapped in an immediately-invoked closure: ECS withSpacing(indentation: $indentation(), lineEnding: $lineEnding())
->withPaths(['src', 'test'])
->withSets($sets())
->withRules($rules())
->withSkip($skip());
foreach ($rulesConfig() as $checkerClass => $configuration) {
$ecsConfig->withConfiguredRule($checkerClass, $configuration);
}
return $ecsConfig;
})();
declare(strict_types=1);
use Ctw\Qa\ComposerDependencyAnalyser\Config\Configuration\DefaultFileExtensions;
use Ctw\Qa\ComposerDependencyAnalyser\Config\Configuration\DefaultIgnoredPackageErrors;
use Ctw\Qa\ComposerDependencyAnalyser\Config\Configuration\DefaultIgnoredUnknownClassPatterns;
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
$fileExtensions = new DefaultFileExtensions();
$packageErrors = new DefaultIgnoredPackageErrors();
$unknownClassPatterns = new DefaultIgnoredUnknownClassPatterns();
$configuration = new Configuration();
$configuration->setFileExtensions($fileExtensions());
foreach ($packageErrors() as $packageName => $errorTypes) {
$configuration->ignoreErrorsOnPackage($packageName, $errorTypes);
}
foreach ($unknownClassPatterns() as $unknownClassPattern) {
$configuration->ignoreUnknownClassesRegex($unknownClassPattern);
}
// The analyser scans the autoload paths of composer.json on its own, which
// covers "src" and "test" but not the root of the project. Add whichever
// root-level files reference a dependency, so that scanning them proves it.
$configuration->addPathsToScan(
[
sprintf('%s/composer-dependency-analyser.php', __DIR__),
sprintf('%s/ecs.php', __DIR__),
sprintf('%s/rector.php', __DIR__),
],
false
);
return $configuration;
declare(strict_types=1);
namespace App\QA;
use Ctw\Qa\Rector\Config\RectorConfig\DefaultSkip;
class CustomSkip extends DefaultSkip
{
public function __invoke(): array
{
$skip = parent::__invoke();
$skip[] = '*/legacy/*';
return $skip;
}
}
$skip = new \App\QA\CustomSkip();
$rectorConfig->skip([...$skip()]);
neon
parameters:
level: max
paths:
- src
- test
bootstrapFiles:
- vendor/autoload.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.