Skip to content

Commit 1a08336

Browse files
committed
feat(chore): init project + add accessibility rules for img tags in Twig templates
0 parents  commit 1a08336

15 files changed

Lines changed: 5171 additions & 0 deletions

.github/workflows/phpunit.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Run tests
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
phpunit:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
php: [ '8.2', '8.3', '8.4' ]
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v6
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: ${{ matrix.php }}
25+
extensions: mbstring, dom
26+
coverage: none
27+
28+
- name: Get composer cache directory
29+
id: composer-cache
30+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
31+
32+
- name: Cache composer dependencies
33+
uses: actions/cache@v4
34+
with:
35+
path: ${{ env.COMPOSER_CACHE_DIR }}
36+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
37+
restore-keys: ${{ runner.os }}-composer-
38+
39+
- name: Install dependencies
40+
run: composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader
41+
42+
- name: Run tests
43+
run: composer test

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
vendor
2+
.agents
3+
.php-cs-fixer.cache
4+
.phpunit.result.cache
5+
AGENT.md

.php-cs-fixer.dist.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Config;
6+
use PhpCsFixer\Finder;
7+
8+
return (new Config())
9+
->setRiskyAllowed(false)
10+
->setRules([
11+
'@auto' => true,
12+
'@PhpCsFixer' => true
13+
])
14+
->setFinder(
15+
(new Finder())
16+
// 💡 root folder to check
17+
->in(__DIR__)
18+
// 💡 additional files, eg bin entry file
19+
// ->append([__DIR__.'/bin-entry-file'])
20+
// 💡 folders to exclude, if any
21+
// ->exclude([/* ... */])
22+
// 💡 path patterns to exclude, if any
23+
// ->notPath([/* ... */])
24+
// 💡 extra configs
25+
// ->ignoreDotFiles(false) // true by default in v3, false in v4 or future mode
26+
// ->ignoreVCS(true) // true by default
27+
)
28+
;

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Twig A11y Rules
2+
================
3+
4+
Petit projet fournissant des règles d'accessibilité pour les templates Twig.
5+
6+
Prerequis
7+
-
8+
- PHP >= 8.2
9+
- Composer
10+
11+
Installer les dépendances
12+
-
13+
1. Installer les dépendances :
14+
15+
composer install
16+
17+
Lancer les tests
18+
-
19+
1. Exécuter la suite de tests :
20+
21+
composer test
22+
23+
Workflow CI
24+
-
25+
Un workflow GitHub Actions est fourni dans `.github/workflows/phpunit.yml`. Il installe PHP (8.2/8.3/8.4), installe les dépendances via Composer et exécute `composer test` sur chaque push et pull request vers `main` / `master`.
26+
27+
Contribuer
28+
-
29+
Les contributions sont bienvenues — ouvrez une issue ou une PR.

composer.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "phildaiguille/twig-a11y-rules",
3+
"description": "Accessibility linting rules for Twig templates",
4+
"type": "library",
5+
"license": "MIT",
6+
"version": "1.0.0",
7+
"require": {
8+
"php": "^8.2",
9+
"vincentlanglet/twig-cs-fixer": "^3.14.0"
10+
},
11+
"require-dev": {
12+
"phpunit/phpunit": "^13.1.7",
13+
"friendsofphp/php-cs-fixer": "^3.95",
14+
"rector/rector": "^2.4"
15+
},
16+
"autoload": {
17+
"psr-4": {
18+
"TwigA11y\\": "src/"
19+
}
20+
},
21+
"autoload-dev": {
22+
"psr-4": {
23+
"TwigA11y\\Tests\\": "tests/"
24+
}
25+
},
26+
"scripts": {
27+
"test": "phpunit tests --testdox",
28+
"lint": "php-cs-fixer fix --dry-run --diff --verbose",
29+
"fix": "php-cs-fixer fix",
30+
"rector": "rector src"
31+
}
32+
}

0 commit comments

Comments
 (0)