1. Go to this page and download the library: Download wieni/wmcodestyle 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/ */
wieni / wmcodestyle example snippets
use Wieni\wmcodestyle\PhpCsFixer\Config\Factory;
use Wieni\wmcodestyle\PhpCsFixer\Config\RuleSet\Php73;
$config = Factory::fromRuleSet(new Php73);
$config->getFinder()
->ignoreVCSIgnored(true)
->in(__DIR__)
->name('/\.(php|module|inc|install|test|profile|theme)$/')
->notPath('/(public|web)\/(index|update)\.php/');
$config->setCacheFile(__DIR__ . '/.cache/php_cs.cache');
return $config;
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\TwigSetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Wieni\wmcodestyle\Rector\SetList as WieniSetList;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
$parameters->set(Option::IMPORT_SHORT_CLASSES, false);
$parameters->set(Option::PATHS, [
__DIR__ . '/public/modules/custom',
]);
$parameters->set(Option::AUTOLOAD_PATHS, [
__DIR__ . '/public/core',
__DIR__ . '/public/core/modules',
__DIR__ . '/public/modules',
__DIR__ . '/public/profiles',
__DIR__ . '/public/sites',
__DIR__ . '/public/themes',
]);
$parameters->set(Option::SETS, [
SetList::DEAD_CODE,
SetList::PHP_73,
SetList::PHP_74,
TwigSetList::TWIG_UNDERSCORE_TO_NAMESPACE,
]);
$containerConfigurator->import(WieniSetList::CODE_QUALITY);
$containerConfigurator->import(WieniSetList::CODING_STYLE);
$containerConfigurator->import(WieniSetList::DEPENDENCY_INJECTION);
$containerConfigurator->import(WieniSetList::EARLY_RETURN);
$containerConfigurator->import(WieniSetList::TYPE_DECLARATION);
};
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Wieni\wmcodestyle\Rector\SetList as WieniSetList;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::SYMFONY_CONTAINER_XML_PATH_PARAMETER, __DIR__ . '/.cache/drupal_container.xml');
};