Skip to content

Commit

Permalink
Add tools for and and apply coding standards (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
greylabel authored Nov 14, 2023
1 parent 2d9e58e commit 7a0948f
Show file tree
Hide file tree
Showing 9 changed files with 2,013 additions and 308 deletions.
21 changes: 18 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true

[*]
charset = utf-8
indent_size = 2
# Change these settings to your own preference
indent_style = space
trim_trailing_whitespace = true
indent_size = 2
max_line_length = 80

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{md,markdown}]
trim_trailing_whitespace = false

[*.php]
indent_style = space
indent_size = 4

[composer.json]
indent_style = space
indent_size = 4
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ node_modules
vendor
dist
src/shared-config*

###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###
12 changes: 12 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude('var');

return (new PhpCsFixer\Config())
->setRules([
'@PhpCsFixer' => true,
])
->setFinder($finder)
->setCacheFile(__DIR__.'/.php-cs-fixer.cache');
7 changes: 4 additions & 3 deletions __tests__/twig-extensions/alter-twig.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

// declare(strict_types=1);
declare(strict_types=1);

use Twig\Environment;
use Twig\TwigFunction;

function addCustomExtension(Environment &$twigEnvironment, $config): void {
$twigEnvironment->addFunction(new TwigFunction('customTwigFunctionThatSaysWorld', static fn(): string => 'Custom World'));
function addCustomExtension(Environment &$twigEnvironment, $config): void
{
$twigEnvironment->addFunction(new TwigFunction('customTwigFunctionThatSaysWorld', static fn (): string => 'Custom World'));
}
36 changes: 23 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
{
"name": "basaltinc/twig-renderer",
"description": "Render templates using Twig PHP, via this Node JS renderer.",
"license": "MIT",
"autoload": {
"psr-4": {
"BasaltInc\\TwigRenderer\\": "dist/"
}
},
"require": {
"ext-json": "*",
"twig/twig": "^2.12",
"react/http": "^0.8.3"
}
"name": "basaltinc/twig-renderer",
"description": "Render templates using Twig PHP, via this Node JS renderer.",
"license": "MIT",
"autoload": {
"psr-4": {
"BasaltInc\\": "dist/"
}
},
"config": {
"platfrom": {
"php": "8.2"
}
},
"require": {
"php": ">=8.1",
"ext-json": "*",
"react/http": "^0.8.3",
"twig/twig": "^2.12"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.38.0"
},
"sort-packages": true
}
Loading

0 comments on commit 7a0948f

Please sign in to comment.