Skip to content

Commit 6e82d53

Browse files
committed
feat: house keeping and improving symfony bundle
1 parent 120fd58 commit 6e82d53

18 files changed

Lines changed: 642 additions & 52 deletions

File tree

.githooks/commit-msg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/bin/bash
22

33
# Commit message must be in correct format
4-
# https://semver.org/
54
# https://www.conventionalcommits.org/
6-
# https://youtu.be/nOVZxZX5dx8
75

86
# Colors
97
RED='\033[0;31m'
@@ -39,9 +37,7 @@ ${YELLOW}<type>${NC}(${YELLOW}<scope>${NC}): ${YELLOW}<subject>${NC}
3937
${YELLOW}<subject>${NC} there must be a description of the change
4038
4139
Find more on this topic here:
42-
- ${GREEN}https://semver.org/${NC}
4340
- ${GREEN}https://www.conventionalcommits.org/${NC}
44-
- ${GREEN}https://youtu.be/nOVZxZX5dx8${NC}
4541
"
4642
exit 1
4743
fi

docs/phpmd.md

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,6 @@ layout: home
44
# PHP Mess Detector Report
55

66
[[toc]]
7-
## Unused Code
8-
9-
| Priority | File | Line | Rule | Message |
10-
| -------- | ------ | ------------ | ----- | ------- |
11-
| <span class="prio3">3</span> | src/Command/BatchGeneratorCommand.php | 58 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$specification`. |
12-
| <span class="prio3">3</span> | src/Command/BatchGeneratorCommand.php | 95 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$elementShortName`. |
13-
| <span class="prio3">3</span> | src/Command/CreateClassCommand.php | 400 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$type`. |
14-
| <span class="prio3">3</span> | src/Command/GenerateComposedCommand.php | 57 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$specification`. |
15-
| <span class="prio3">3</span> | src/Command/MergeSpecifications.php | 26 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$input`. |
16-
| <span class="prio3">3</span> | src/Command/MergeSpecifications.php | 34 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$props`. |
17-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 37 | [UnusedPrivateField](https://phpmd.org/rules/unusedcode.html#unusedprivatefield) | Avoid unused private fields such as `$data`. |
18-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 216 | [UnusedPrivateMethod](https://phpmd.org/rules/unusedcode.html#unusedprivatemethod) | Avoid unused private methods such as `parseFile`. |
19-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 216 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$generator`. |
20-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 216 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$sourceFile`. |
21-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 216 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$dest`. |
22-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 216 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$io`. |
23-
| <span class="prio3">3</span> | src/Command/WatchCommand.php | 224 | [UnusedPrivateMethod](https://phpmd.org/rules/unusedcode.html#unusedprivatemethod) | Avoid unused private methods such as `formatHtml`. |
24-
| <span class="prio3">3</span> | src/Service/ComponentBuilder.php | 50 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$childElement`. |
25-
| <span class="prio3">3</span> | src/TemplateGenerator/BladeGenerator.php | 275 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$parentRef`. |
26-
| <span class="prio3">3</span> | src/TemplateGenerator/NextJSGenerator.php | 204 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$level`. |
27-
| <span class="prio3">3</span> | src/TemplateGenerator/NextJSGenerator.php | 213 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$propsInterface`. |
28-
| <span class="prio3">3</span> | src/TemplateGenerator/NextJSGenerator.php | 298 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$value`. |
29-
| <span class="prio3">3</span> | src/TemplateGenerator/StorybookJSGenerator.php | 565 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$choices`. |
30-
| <span class="prio3">3</span> | src/TemplateGenerator/StorybookJSGenerator.php | 575 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$type`. |
31-
| <span class="prio3">3</span> | src/TemplateGenerator/StorybookJSGenerator.php | 626 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$props`. |
32-
| <span class="prio3">3</span> | src/TemplateGenerator/StorybookJSGenerator.php | 629 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$renderAssignments`. |
33-
| <span class="prio3">3</span> | src/TemplateGenerator/StorybookJSGenerator.php | 743 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$level`. |
34-
| <span class="prio3">3</span> | src/TemplateGenerator/StorybookJSGenerator.php | 843 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$parentRef`. |
35-
| <span class="prio3">3</span> | src/TemplateGenerator/TwigGenerator.php | 257 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$key`. |
36-
| <span class="prio3">3</span> | src/TemplateGenerator/TwigGenerator.php | 450 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$parentRef`. |
37-
| <span class="prio3">3</span> | src/TemplateGenerator/TwigGenerator.php | 626 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$document`. |
38-
| <span class="prio3">3</span> | src/TemplateGenerator/TwigGenerator.php | 657 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$templateName`. |
39-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 155 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$level`. |
40-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 158 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$enums`. |
41-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 172 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$example`. |
42-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 200 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$setterMethod`. |
43-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 268 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$getter`. |
44-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 395 | [UnusedPrivateMethod](https://phpmd.org/rules/unusedcode.html#unusedprivatemethod) | Avoid unused private methods such as `getGlobalAttributeTraits`. |
45-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 397 | [UnusedLocalVariable](https://phpmd.org/rules/unusedcode.html#unusedlocalvariable) | Avoid unused local variables such as `$traits`. |
46-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 537 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$enumImports`. |
47-
| <span class="prio3">3</span> | src/TemplateGenerator/TypeScriptGenerator.php | 748 | [UnusedFormalParameter](https://phpmd.org/rules/unusedcode.html#unusedformalparameter) | Avoid unused parameters such as `$ref`. |
48-
49-
Issues detected: 37
507
## Code Size
518

529
| Priority | File | Line | Rule | Message |
@@ -1011,4 +968,4 @@ Issues detected: 746
1011968

1012969
Issues detected: 14
1013970

1014-
Fri May 8 08:44:02 PM CEST 2026
971+
Sat May 9 12:52:43 PM CEST 2026
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
8+
jobs:
9+
installable-symfony-require:
10+
name: PHP ${{ matrix.php }} installable (extra.symfony.require=${{ matrix.symfony-require }})
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php: ["8.4", "8.5"]
16+
symfony-require: ["5.4.*", "6.*", "7.*", "8.*"]
17+
# exclude:
18+
# - php: "8.3"
19+
# symfony-require: "8.*"
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v6
24+
25+
- name: Set up PHP ${{ matrix.php }}
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php }}
29+
coverage: none
30+
tools: composer:v2
31+
32+
- name: Validate composer.json
33+
run: composer validate --no-check-publish
34+
35+
- name: Set extra.symfony.require
36+
run: composer config extra.symfony.require "${{ matrix.symfony-require }}"
37+
38+
- name: Resolve dependencies
39+
run: composer update --no-interaction --no-progress --prefer-dist --no-scripts
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Code Coverage
2+
on:
3+
push:
4+
# only trigger if theres a change in src/ directory
5+
paths:
6+
- '.github/workflows/code-coverage.yml'
7+
- 'clover.xml'
8+
pull_request:
9+
paths:
10+
- '.github/workflows/code-coverage.yml'
11+
- 'clover.xml'
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: write
16+
jobs:
17+
run:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v6
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: '8.4'
27+
28+
- name: Generate code coverage badge
29+
run: php bin/generate-coverage-badge.php clover.xml coverage.svg
30+
31+
- name: Commit badge
32+
if: github.event_name != 'pull_request'
33+
env:
34+
SSH_SIGNING_PRIVATE_KEY: ${{ secrets.SSH_SIGNING_KEY }}
35+
run: |
36+
git config --global user.name 'Erik Pöhler'
37+
git config --global user.email 'admin@teuton.mx'
38+
39+
if [ -n "$SSH_SIGNING_PRIVATE_KEY" ]; then
40+
KEY_PATH="$RUNNER_TEMP/sign_key"
41+
PUB_KEY_PATH="$RUNNER_TEMP/sign_key.pub"
42+
43+
printf '%s\n' "$SSH_SIGNING_PRIVATE_KEY" > "$KEY_PATH"
44+
chmod 600 "$KEY_PATH"
45+
46+
# Derive public key and use it as signing identity for Git SSH signatures.
47+
ssh-keygen -y -f "$KEY_PATH" > "$PUB_KEY_PATH"
48+
chmod 644 "$PUB_KEY_PATH"
49+
50+
eval "$(ssh-agent -s)"
51+
ssh-add "$KEY_PATH"
52+
53+
git config --global gpg.format ssh
54+
git config --global user.signingkey "$PUB_KEY_PATH"
55+
git config --global commit.gpgsign true
56+
else
57+
echo "SSH_SIGNING_KEY is not set; committing without signing."
58+
git config --global --unset-all user.signingkey || true
59+
git config --global commit.gpgsign false
60+
fi
61+
62+
git add coverage.svg
63+
64+
if git diff --staged --quiet; then
65+
echo "No badge changes to commit."
66+
exit 0
67+
fi
68+
69+
git commit -m "chore: coverage.svg badge updated" --no-verify
70+
git push --no-verify
71+
continue-on-error: true # do not fail if nothing changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Workflow for Depency Track and Trivy
2+
env:
3+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
4+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
5+
on:
6+
push:
7+
paths:
8+
- .github/workflows/dtrack-trivy.yml
9+
- 'composer.json'
10+
- 'composer.lock'
11+
pull_request:
12+
paths:
13+
- .github/workflows/dtrack-trivy.yml
14+
- 'composer.json'
15+
- 'composer.lock'
16+
workflow_dispatch:
17+
permissions:
18+
contents: write
19+
jobs:
20+
run:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v6
25+
with:
26+
fetch-depth: '0'
27+
token: ${{ github.token }}
28+
29+
- name: Set up php 8.4
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: '8.4'
33+
34+
- name: Install dependencies
35+
run: composer self-update && composer install && composer dump-autoload -o -a
36+
37+
- name: Show that Composer Lockfile exists
38+
run: |
39+
ls -lart composer.lock
40+
41+
- name: Install trivy
42+
uses: aquasecurity/setup-trivy@v0.2.6
43+
with:
44+
version: v0.69.3
45+
- name: Create CycloneDX SBOM with Trivy
46+
run: trivy fs --skip-files vendor/rector/swiss-knife/vendor/composer/installed.json,vendor/symplify/easy-coding-standard/vendor/composer/installed.json --format cyclonedx --include-dev-deps --output sbom.json --severity HIGH,CRITICAL,MEDIUM --scanners vuln,license,secret --debug ./
47+
48+
- name: Commit SBOM if changed
49+
run: |
50+
git config --global user.name 'github-actions[bot]'
51+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
52+
git add sbom.json
53+
git commit -am "sbom.json updated" --no-verify || exit 1
54+
git push origin HEAD:${BRANCH_NAME} -f
55+
continue-on-error: false
56+
57+
- name: Push SBOM to Dependency Track
58+
run: |
59+
curl --fail -L -X "POST" "${{ secrets.DTRACK_API_URL }}" \
60+
-H "X-Api-Key: ${{ secrets.DTRACK_API_KEY }}" \
61+
-F "project=${{ secrets.DTRACK_PROJECT_UID }}" \
62+
-F "bom=@sbom.json"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
5+
6+
## Our Standards
7+
Examples of behavior that contributes to a positive environment for our community include:
8+
* Demonstrating empathy and kindness toward other people
9+
* Being respectful of differing opinions, viewpoints, and experiences
10+
* Giving and gracefully accepting constructive feedback
11+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
12+
* Focusing on what is best not just for us as individuals, but for the overall community
13+
14+
Examples of unacceptable behavior include:
15+
* The use of sexualized language or imagery, and unwelcome sexual attention or advances
16+
* Trolling, insulting or derogatory comments, and personal or political attacks
17+
* Public or private harassment
18+
* Publishing others' private information, such as a physical or email address, without their explicit permission
19+
* Other conduct which could reasonably be considered inappropriate in a professional setting
20+
21+
## Enforcement Responsibilities
22+
Project leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
23+
24+
## Scope
25+
This Code of Conduct applies within all project spaces, and also applies when an individual is officially representing the project or its community in public spaces.
26+
27+
## Reporting
28+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project team at **you@example.com**. All complaints will be reviewed and investigated promptly and fairly.
29+
30+
## Enforcement Guidelines
31+
Project leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
32+
1. **Correction**: A private, written warning, providing clarity around the nature of the violation.
33+
2. **Warning**: A warning with consequences for continued behavior.
34+
3. **Temporary Ban**: A temporary ban from any sort of interaction or communication with the community.
35+
4. **Permanent Ban**: A permanent ban from any sort of interaction or communication with the community.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Contributing to Package Name
2+
3+
Thank you for considering contributing! To make the process as smooth as possible, please follow these guidelines:
4+
5+
## Pull Request Process
6+
1. Fork the repository and create your branch from `main`.
7+
2. If you've added code that should be tested, add tests.
8+
3. Ensure the test suite passes (`vendor/bin/pest`).
9+
4. Update the documentation if you've changed any public APIs.
10+
5. Submit your PR with a clear description of the specific changes.
11+
12+
## Bug Reports
13+
Please use the [GitHub Issue Tracker](https://github.com/vardumper/extended-htmldocument/issues) to report bugs. Include as much detail as possible, including your PHP version and a code snippet to reproduce the issue.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 vardumper
3+
Copyright (c) 2019-2023 DOM-ORM
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

templates/twig-component/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ The bundle includes automatic service registration - no additional configuration
3232

3333
## Configuration
3434

35-
The bundle is automatically registered via Symfony Flex. If you need to register it manually, add to `config/bundles.php`:
35+
When installed via Symfony Flex, this bundle is automatically configured by the recipe in `flex/recipe`.
36+
37+
If you are not using Symfony Flex, register the bundle manually in `config/bundles.php`:
3638

3739
```php
3840
# config/bundles.php
@@ -42,7 +44,7 @@ return [
4244
];
4345
```
4446

45-
Next, tell Symfony that Twig Components can be found in a new path. Edit `config/packages/twig_component.yaml` and add the following:
47+
Then tell Symfony where the Twig Components are located. Edit `config/packages/twig_component.yaml` and add the following:
4648

4749
```yaml
4850
# config/packages/twig_component.yaml

0 commit comments

Comments
 (0)