Skip to content

Commit

Permalink
Add code standards and testing tools with cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
greylabel committed Nov 13, 2023
1 parent 2d9e58e commit d9a0ee9
Show file tree
Hide file tree
Showing 10 changed files with 3,567 additions and 305 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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,13 @@ node_modules
vendor
dist
src/shared-config*

###> friendsofphp/php-cs-fixer ###
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###
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'));
}
42 changes: 29 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
{
"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\\TwigRenderer\\": "dist/"
}
},
"autoload-dev": {
"psr-4": {
"BasaltInc\\TwigRenderer\\Tests\\": "tests/"
}
},
"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",
"phpunit/phpunit": "^10.4.2"
},
"sort-packages": true
}
Loading

0 comments on commit d9a0ee9

Please sign in to comment.