Skip to content

Commit

Permalink
Правки
Browse files Browse the repository at this point in the history
  • Loading branch information
Elnadrion committed May 4, 2024
1 parent 8c374d5 commit c2ebd77
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 76 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
7 changes: 2 additions & 5 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
ecs-check:
Expand All @@ -26,11 +24,10 @@ jobs:
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
ini-values: short_open_tag=On
coverage: none

- name: install dependencies
run: composer install
run: composer install --no-progress --no-suggest --no-interaction

- name: check code style
run: php vendor/bin/ecs check
run: ./vendor/bin/ecs check
104 changes: 58 additions & 46 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,64 @@
{
"name": "elnadrion/tools.twig",
"description": "Модуль подключения шаблонизатора twig к битриксу",
"keywords": ["bitrix", "1С Битрикс", "twig", "шаблонизатор"],
"license": "MIT",
"support": {
"source": "https://github.com/Elnadrion/tools.twig.git"
},
"authors": [
{
"name": "Журов Михаил",
"email": "m.zhurov@maximaster.ru"
"name": "elnadrion/tools.twig",
"description": "Модуль подключения шаблонизатора twig к битриксу",
"keywords": [
"bitrix",
"1С Битрикс",
"twig",
"шаблонизатор"
],
"license": "MIT",
"support": {
"source": "https://github.com/Elnadrion/tools.twig.git"
},
{
"name": "Лавриненко Максим",
"email": "maxim.lavrinenko@maximaster.ru"
"authors": [
{
"name": "Журов Михаил",
"email": "m.zhurov@maximaster.ru"
},
{
"name": "Лавриненко Максим",
"email": "maxim.lavrinenko@maximaster.ru"
},
{
"name": "Elnadrion",
"email": "elnadrion.dev@yandex.ru"
}
],
"require": {
"php": ">=7.2.5",
"twig/twig": "~3.0"
},
{
"name": "Elnadrion",
"email": "elnadrion.dev@yandex.ru"
}
],
"require": {
"php": ">=7.2.5",
"twig/twig": "~3.0",
"symfony/var-dumper": "^5.0|^6.0|^7.0"
},
"autoload": {
"psr-4": {
"Maximaster\\": "src/Maximaster/",
"Maximaster\\Tools\\Twig\\Test\\": "tests/"
"require-dev": {
"phpunit/phpunit": "^5.7",
"goaop/framework": "dev-autoload_unregister_bugfix",
"symfony/var-dumper": "^5.0|^6.0|^7.0",
"symplify/easy-coding-standard": "^12.1.14"
},
"autoload": {
"psr-4": {
"Maximaster\\": "src/Maximaster/",
"Maximaster\\Tools\\Twig\\Test\\": "tests/"
},
"files": [
"src/Maximaster/functions.php"
]
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/mlavrinenko/framework"
}
],
"suggest": {
"goaop/framework": "Для того чтобы использовать twig-шаблоны для стандартных компонент работающих в ajax-режиме, необходимо подключить доп. зависимость. Требуется специальная исправленная версия (https://github.com/mlavrinenko/framework#dev-autoload_unregister_bugfix) и php 5.6+"
},
"scripts": {
"test": "vendor/bin/phpunit"
},
"files": ["src/Maximaster/functions.php"]
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"goaop/framework": "dev-autoload_unregister_bugfix",
"symplify/easy-coding-standard": "^11.0"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/mlavrinenko/framework"
"config": {
"platform": {
"php": "7.4"
}
}
],
"suggest": {
"goaop/framework": "Для того чтобы использовать twig-шаблоны для стандартных компонент работающих в ajax-режиме, необходимо подключить доп. зависимость. Требуется специальная исправленная версия (https://github.com/mlavrinenko/framework#dev-autoload_unregister_bugfix) и php 5.6+"
},
"scripts": {
"test": "vendor/bin/phpunit"
}
}
34 changes: 14 additions & 20 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,21 @@
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return static function (ECSConfig $ecsConfig): void {
$services = $ecsConfig->services();

$services->set(OrderedTraitsFixer::class);
$services->set(SingleQuoteFixer::class);
$services->set(NoExtraBlankLinesFixer::class);
$services->set(SingleTraitInsertPerStatementFixer::class);
$ecsConfig->rules([
OrderedTraitsFixer::class,
SingleQuoteFixer::class,
NoExtraBlankLinesFixer::class,
SingleTraitInsertPerStatementFixer::class,
]);

$services->set(YodaStyleFixer::class)
->call('configure', [
[
'equal' => false,
'identical' => false,
'less_and_greater' => false,
],
]);
$services->set(TrailingCommaInMultilineFixer::class)
->call('configure', [
[
'elements' => ['arrays'],
],
]);
$ecsConfig->ruleWithConfiguration(YodaStyleFixer::class, [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
]);
$ecsConfig->ruleWithConfiguration(TrailingCommaInMultilineFixer::class, [
'elements' => ['arrays'],
]);

$ecsConfig->paths([
__DIR__ . '/src',
Expand Down
2 changes: 1 addition & 1 deletion src/Maximaster/Tools/Twig/BitrixLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private function getComponentTemplatePath(string $name): string

return $_SERVER['DOCUMENT_ROOT'] . (
$isRelative ? ($obTemplate->GetFolder() . DIRECTORY_SEPARATOR . $page) : $obTemplate->GetFile()
);
);
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/Maximaster/Tools/Twig/Extensions/DDExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public function getFunctions(): array
];
}

public static function dd($data): void
public static function dd(mixed ...$data): void
{
dd($data);
if (function_exists('dd')) {
dd($data);
}
}
}
6 changes: 4 additions & 2 deletions src/Maximaster/Tools/Twig/Extensions/DumpExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public function getFunctions(): array
];
}

public static function dump($data): void
public static function dump(mixed ...$data): void
{
dump($data);
if (!function_exists('dd')) {
dump($data);
}
}
}

0 comments on commit c2ebd77

Please sign in to comment.