1. Go to this page and download the library: Download vanta/gitlab-rector 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/ */
vanta / gitlab-rector example snippets
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use Vanta\Integration\Rector\GitlabOutputFormatter;
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\ChangesReporting\Contract\Output\OutputFormatterInterface;
return RectorConfig::configure()
->withCache(
cacheDirectory: 'var',
cacheClass: FileCacheStorage::class
)
->withTypeCoverageLevel(10)
->withDeadCodeLevel(10)
->withPreparedSets(codeQuality: true, codingStyle: true)
->withAttributesSets(symfony: true, doctrine: true)
->withPaths([
__DIR__ . '/fixture',
])
->withRules([
ChangeNestedIfsToEarlyReturnRector::class,
RemoveAlwaysElseRector::class,
])
->registerService(GitlabOutputFormatter::class, 'gitlab', OutputFormatterInterface::class)
;
declare(strict_types=1);
use Rector\ChangesReporting\Contract\Output\OutputFormatterInterface;
use Rector\Config\RectorConfig;
use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use Rector\Set\ValueObject\SetList;
use Vanta\Integration\Rector\GitlabOutputFormatter;
return static function (RectorConfig $config): void {
$config->paths([
__DIR__ . '/fixture',
]);
$config->cacheDirectory('var');
$config->bind(GitlabOutputFormatter::class);
$config->tag(GitlabOutputFormatter::class, [OutputFormatterInterface::class]);
$config->rules([
ChangeNestedIfsToEarlyReturnRector::class,
RemoveAlwaysElseRector::class,
]);
$config->sets([
SetList::CODE_QUALITY,
]);
};
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use Rector\Set\ValueObject\SetList;
use Vanta\Integration\Rector\GitlabOutputFormatter;
return static function (RectorConfig $config): void {
$config->paths([
__DIR__ . '/fixture',
]);
$config->cacheDirectory('var');
$config->services()
->defaults()
->autowire()
->autoconfigure()
->set(GitlabOutputFormatter::class)
;
$config->rules([
ChangeNestedIfsToEarlyReturnRector::class,
RemoveAlwaysElseRector::class,
]);
$config->sets([
SetList::CODE_QUALITY,
]);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.