Skip to content

Commit 7a0948f

Browse files
authored
Add tools for and and apply coding standards (#121)
1 parent 2d9e58e commit 7a0948f

File tree

9 files changed

+2013
-308
lines changed

9 files changed

+2013
-308
lines changed

.editorconfig

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
13
# editorconfig.org
24
root = true
35

46
[*]
5-
charset = utf-8
6-
indent_size = 2
7+
# Change these settings to your own preference
78
indent_style = space
8-
trim_trailing_whitespace = true
9+
indent_size = 2
10+
max_line_length = 80
911

12+
# We recommend you to keep these unchanged
13+
end_of_line = lf
14+
charset = utf-8
15+
trim_trailing_whitespace = true
16+
insert_final_newline = true
1017

1118
[*.{md,markdown}]
1219
trim_trailing_whitespace = false
20+
21+
[*.php]
22+
indent_style = space
23+
indent_size = 4
24+
25+
[composer.json]
26+
indent_style = space
27+
indent_size = 4

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ node_modules
22
vendor
33
dist
44
src/shared-config*
5+
6+
###> friendsofphp/php-cs-fixer ###
7+
/.php-cs-fixer.php
8+
/.php-cs-fixer.cache
9+
###< friendsofphp/php-cs-fixer ###

.php-cs-fixer.dist.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())
4+
->in(__DIR__)
5+
->exclude('var');
6+
7+
return (new PhpCsFixer\Config())
8+
->setRules([
9+
'@PhpCsFixer' => true,
10+
])
11+
->setFinder($finder)
12+
->setCacheFile(__DIR__.'/.php-cs-fixer.cache');
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22

3-
// declare(strict_types=1);
3+
declare(strict_types=1);
44

55
use Twig\Environment;
66
use Twig\TwigFunction;
77

8-
function addCustomExtension(Environment &$twigEnvironment, $config): void {
9-
$twigEnvironment->addFunction(new TwigFunction('customTwigFunctionThatSaysWorld', static fn(): string => 'Custom World'));
8+
function addCustomExtension(Environment &$twigEnvironment, $config): void
9+
{
10+
$twigEnvironment->addFunction(new TwigFunction('customTwigFunctionThatSaysWorld', static fn (): string => 'Custom World'));
1011
}

composer.json

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
{
2-
"name": "basaltinc/twig-renderer",
3-
"description": "Render templates using Twig PHP, via this Node JS renderer.",
4-
"license": "MIT",
5-
"autoload": {
6-
"psr-4": {
7-
"BasaltInc\\TwigRenderer\\": "dist/"
8-
}
9-
},
10-
"require": {
11-
"ext-json": "*",
12-
"twig/twig": "^2.12",
13-
"react/http": "^0.8.3"
14-
}
2+
"name": "basaltinc/twig-renderer",
3+
"description": "Render templates using Twig PHP, via this Node JS renderer.",
4+
"license": "MIT",
5+
"autoload": {
6+
"psr-4": {
7+
"BasaltInc\\": "dist/"
8+
}
9+
},
10+
"config": {
11+
"platfrom": {
12+
"php": "8.2"
13+
}
14+
},
15+
"require": {
16+
"php": ">=8.1",
17+
"ext-json": "*",
18+
"react/http": "^0.8.3",
19+
"twig/twig": "^2.12"
20+
},
21+
"require-dev": {
22+
"friendsofphp/php-cs-fixer": "^3.38.0"
23+
},
24+
"sort-packages": true
1525
}

0 commit comments

Comments
 (0)