project-nos / spryker-twig-code-sniffer
此包旨在为spryker中的twig模板提供类似于phpcs对php的功能。它检查您的代码库中是否存在违反编码标准的问题。
v1.1.1
2024-02-12 17:06 UTC
Requires
- php: >=8.1
- spryker/kernel: ^3.52.0
- vincentlanglet/twig-cs-fixer: 2.0.*
Requires (Dev)
- phpstan/phpstan: ^1.10
- spryker/code-sniffer: *
- spryker/testify: *
This package is auto-updated.
Last update: 2024-09-12 18:38:03 UTC
README
此包旨在为spryker中的twig模板提供类似于phpcs对php的功能。它检查您的代码库中是否存在违反编码标准的问题。
安装
composer require --dev project-nos/spryker-twig-code-sniffer
设置
要使用提供的控制台命令,您需要在config/Shared/config_default.php中注册命名空间Nos
。
$config[KernelConstants::CORE_NAMESPACES] = [ // add 'Nos' as a core namespace 'Nos', ];
在src/Pyz/Yves/Console/ConsoleDependencyProvider.php
中,您需要为部署任务注册控制台命令插件。
use Nos\Yves\TwigCodeSniffer\Plugin\Console\TwigCodeSnifferConsole; protected function getConsoleCommands(Container $container): array { $commands = [ // other registered console plugins ... new TwigCodeSnifferConsole(), ];
然后,您应该可以在code
部分看到一个新的命令
code
...
code:sniff:twig Sniff and fix twig code style
...
定义
Description:
Sniff and fix twig code style
Usage:
code:sniff:twig [options] [--] [<paths>...]
Arguments:
paths Paths of files and folders to parse
Options:
--level=LEVEL Allowed values are notice, warning or error [default: "NOTICE"]
--report=REPORT Report format [default: "text"]
--fix Automatically fix all the fixable violations
--no-cache Disable cache while running the fixer
编码标准
此包试图模仿以下官方编码标准,但有以下例外
- 在|(管道)操作符前后各有一个(且仅有一个)空格。
许可证
版权(c)Andreas Penz。在MIT许可证下发布。