Skip to content

Commit

Permalink
Make it a bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
dmolineus committed Sep 25, 2024
1 parent e26786e commit 54d2ce0
Show file tree
Hide file tree
Showing 19 changed files with 838 additions and 285 deletions.
10 changes: 10 additions & 0 deletions .composer-require-checker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"symbol-whitelist": [
"null", "true", "false",
"static", "self", "parent",
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object",
"Contao\\ManagerPlugin\\Bundle\\BundlePluginInterface",
"Contao\\ManagerPlugin\\Bundle\\Parser\\ParserInterface",
"Contao\\ManagerPlugin\\Bundle\\Config\\BundleConfig"
]
}
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[{*.(xlf,xml,html5,twig,json,js,vue}]
indent_style = space
indent_size = 2

[*.php]
indent_style = space
indent_size = 4
max_line_length = 120
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text-auto

# Configuration
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.phpcq.lock export-ignore
.phpcq.yaml.dist export-ignore
companion.json export-ignore
composer.lock -diff
phpcs.xml.dist export-ignore
psalm.xml export-ignore
rector.php export-ignore

# PHP files
*.php text eol=lf diff=php
76 changes: 76 additions & 0 deletions .github/workflows/diagnostics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Code Quality Diagnostics

on:
pull_request:
push:
branches:
- master
- develop

jobs:
build:
runs-on: ubuntu-latest

name: PHP ${{ matrix.php }}

strategy:
fail-fast: false
matrix:
include:
- php: 8.2
phpcq_install: 'update'
- php: 8.3
phpcq_install: 'update'

steps:
- name: Pull source
uses: actions/checkout@v4

- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Cache composer cache directory
uses: actions/cache@v1
env:
cache-name: composer-cache-dir-${{ matrix.php }}
with:
path: ~/.cache/composer
key: ${{ runner.os }}-build-${{ env.cache-name }}

- name: Cache vendor directory
uses: actions/cache@v3
env:
cache-name: vendor-${{ matrix.php }}
with:
path: vendor
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Cache phpcq directory
uses: actions/cache@v3
env:
cache-name: phpcq-${{ matrix.php }}
with:
path: .phpcq
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/.phpcq.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Install composer dependencies
run: composer install

- name: Install phpcq toolchain
run: ./vendor/bin/phpcq ${{ matrix.phpcq_install }} -v

- name: Run tests
run: ./vendor/bin/phpcq run -v -o github-action -o default --threshold=info

- name: Upload build directory to artifact
uses: actions/upload-artifact@v4
if: ${{ success() }} || ${{ failure() }}
with:
name: phpcq-builds-php-${{ matrix.php }}
path: .phpcq/build/
20 changes: 11 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/*
!/.gitignore
!/.gitattributes
!/contao-module/
!/dev/
!/src/
!/CHANGELOG.md
!/README.md
!/composer.json
# Companion
/.env.companion

# Composer
/composer.lock
/vendor

# PHPCQ
/.phpcq
/.phpcq.yaml
/.phpcs-cache
1 change: 1 addition & 0 deletions .phpcq.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"plugins":{"composer-normalize":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-normalize/composer-normalize-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-json":"*"},"tool":{"composer-normalize":"^2.1"}},"checksum":{"type":"sha-512","value":"d9abda440b85d501c58abf9c81bf76f417594b397129215ffa8b777e9bb5e5eda37d7661d661db3c8d11c24f20345bc6fbe56f013b3b9435d459d2b94f086e0f"},"tools":{"composer-normalize":{"version":"2.43.0","url":"https://github.com/ergebnis/composer-normalize/releases/download/2.43.0/composer-normalize.phar","requirements":{"php":{"php":"~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0","ext-json":"*"}},"checksum":null,"signature":"https://github.com/ergebnis/composer-normalize/releases/download/2.43.0/composer-normalize.phar.asc"}},"composerLock":null},"composer-require-checker":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-require-checker/composer-require-checker-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0"},"tool":{"composer-require-checker":"^3.8 || ^4.0"}},"checksum":{"type":"sha-512","value":"d5415bddfe024c5749d894034583882aee4e5c3e1087815d9fdd81cb5e71630f631a0e35de0ff84b97fbbf738c16ece5f83bd8c00695913eb846aa6f04577dc2"},"tools":{"composer-require-checker":{"version":"4.12.0","url":"https://github.com/maglnet/ComposerRequireChecker/releases/download/4.12.0/composer-require-checker.phar","requirements":{"php":{"php":"~8.2.0 || ~8.3.0 || ~8.4.0","ext-phar":"*"}},"checksum":null,"signature":"https://github.com/maglnet/ComposerRequireChecker/releases/download/4.12.0/composer-require-checker.phar.asc"}},"composerLock":null},"phpcpd":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcpd/phpcpd-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcpd":"^6.0"}},"checksum":{"type":"sha-512","value":"1189ce0bf3fade4cb4241f1d96f915ef8fc7651f4450dc79fdf464ee3d6be3009316f0d423ce2d4af9d76ad50807b7fdf4d77bfa6d9ee2c91d6eda32ea214433"},"tools":{"phpcpd":{"version":"6.0.3","url":"https://phar.phpunit.de/phpcpd-6.0.3.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*"}},"checksum":{"type":"sha-256","value":"2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb"},"signature":"https://phar.phpunit.de/phpcpd-6.0.3.phar.asc"}},"composerLock":null},"phploc":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phploc/phploc-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*","ext-json":"*"},"tool":{"phploc":"^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"}},"checksum":{"type":"sha-512","value":"f67b02d494796adf553cb3dd13ec06c1cb8e53c799954061749424251379541637538199afb3afa3c7a01cabd1cb6f1c53eb621f015dff9644c6c7cbf10c56d1"},"tools":{"phploc":{"version":"7.0.2","url":"https://phar.phpunit.de/phploc-7.0.2.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*"}},"checksum":{"type":"sha-256","value":"3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46"},"signature":"https://phar.phpunit.de/phploc-7.0.2.phar.asc"}},"composerLock":null},"phpmd":{"api-version":"1.0.0","version":"1.0.2.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpmd/phpmd-1.0.2.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpmd":"^2.6.1"}},"checksum":{"type":"sha-512","value":"f22280a6dec8dbdd2ec1d83b294f23237fe32c34f4a298e52038e0a7a0074d541635b2b488b1a6098a42d8418a6cd8eb804406ea82b91e362be2b5d11a0915b0"},"tools":{"phpmd":{"version":"2.15.0","url":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar","requirements":{"php":{"php":">=5.3.9","ext-xml":"*"}},"checksum":null,"signature":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar.asc"}},"composerLock":null},"psalm":{"api-version":"1.0.0","version":"1.2.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/psalm/psalm-1.2.0.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0","ext-dom":"*"},"tool":{"psalm":"^3.0 || ^4.0 || ^5.0"}},"checksum":{"type":"sha-512","value":"4a550c9226d7bca582d7c10bd87cce01190c96398936b1613421640c83df62ed1c6e0d44c1b39635414ea8cf4a892a6458d27590793238add24e7cb5547e6ffd"},"tools":{"psalm":{"version":"5.26.1","url":"https://github.com/vimeo/psalm/releases/download/5.26.1/psalm.phar","requirements":{"php":{"php":"^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0","ext-SimpleXML":"*","ext-ctype":"*","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-tokenizer":"*"}},"checksum":null,"signature":"https://github.com/vimeo/psalm/releases/download/5.26.1/psalm.phar.asc"}},"composerLock":null},"rector":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/rector/rector-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^8.1","ext-json":"*","ext-pcre":"*"},"composer":{"rector/rector":"^1.0"}},"checksum":{"type":"sha-512","value":"c387c8001855475f410a816b5d361631ba4eba5a369323e7d3114f8d0ddbbf5b10e549c22d04ee2981729268816430ab6eaeb862d747881a8c279faddc346239"},"tools":{},"composerLock":"{\n \"_readme\": [\n \"This file locks the dependencies of your project to a known state\",\n \"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies\",\n \"This file is @generated automatically\"\n ],\n \"content-hash\": \"f7c6abe4d39de378351466d6abd0a4b8\",\n \"packages\": [\n {\n \"name\": \"phpstan/phpstan\",\n \"version\": \"1.12.4\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/phpstan/phpstan.git\",\n \"reference\": \"ffa517cb918591b93acc9b95c0bebdcd0e4538bd\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/phpstan/phpstan/zipball/ffa517cb918591b93acc9b95c0bebdcd0e4538bd\",\n \"reference\": \"ffa517cb918591b93acc9b95c0bebdcd0e4538bd\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2|^8.0\"\n },\n \"conflict\": {\n \"phpstan/phpstan-shim\": \"*\"\n },\n \"bin\": [\n \"phpstan\",\n \"phpstan.phar\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"PHPStan - PHP Static Analysis Tool\",\n \"keywords\": [\n \"dev\",\n \"static analysis\"\n ],\n \"support\": {\n \"docs\": \"https://phpstan.org/user-guide/getting-started\",\n \"forum\": \"https://github.com/phpstan/phpstan/discussions\",\n \"issues\": \"https://github.com/phpstan/phpstan/issues\",\n \"security\": \"https://github.com/phpstan/phpstan/security/policy\",\n \"source\": \"https://github.com/phpstan/phpstan-src\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/ondrejmirtes\",\n \"type\": \"github\"\n },\n {\n \"url\": \"https://github.com/phpstan\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2024-09-19T07:58:01+00:00\"\n },\n {\n \"name\": \"rector/rector\",\n \"version\": \"1.2.5\",\n \"source\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/rectorphp/rector.git\",\n \"reference\": \"e98aa793ca3fcd17e893cfaf9103ac049775d339\"\n },\n \"dist\": {\n \"type\": \"zip\",\n \"url\": \"https://api.github.com/repos/rectorphp/rector/zipball/e98aa793ca3fcd17e893cfaf9103ac049775d339\",\n \"reference\": \"e98aa793ca3fcd17e893cfaf9103ac049775d339\",\n \"shasum\": \"\"\n },\n \"require\": {\n \"php\": \"^7.2|^8.0\",\n \"phpstan/phpstan\": \"^1.12.2\"\n },\n \"conflict\": {\n \"rector/rector-doctrine\": \"*\",\n \"rector/rector-downgrade-php\": \"*\",\n \"rector/rector-phpunit\": \"*\",\n \"rector/rector-symfony\": \"*\"\n },\n \"suggest\": {\n \"ext-dom\": \"To manipulate phpunit.xml via the custom-rule command\"\n },\n \"bin\": [\n \"bin/rector\"\n ],\n \"type\": \"library\",\n \"autoload\": {\n \"files\": [\n \"bootstrap.php\"\n ]\n },\n \"notification-url\": \"https://packagist.org/downloads/\",\n \"license\": [\n \"MIT\"\n ],\n \"description\": \"Instant Upgrade and Automated Refactoring of any PHP code\",\n \"keywords\": [\n \"automation\",\n \"dev\",\n \"migration\",\n \"refactoring\"\n ],\n \"support\": {\n \"issues\": \"https://github.com/rectorphp/rector/issues\",\n \"source\": \"https://github.com/rectorphp/rector/tree/1.2.5\"\n },\n \"funding\": [\n {\n \"url\": \"https://github.com/tomasvotruba\",\n \"type\": \"github\"\n }\n ],\n \"time\": \"2024-09-08T17:43:24+00:00\"\n }\n ],\n \"packages-dev\": [],\n \"aliases\": [],\n \"minimum-stability\": \"stable\",\n \"stability-flags\": [],\n \"prefer-stable\": false,\n \"prefer-lowest\": false,\n \"platform\": [],\n \"platform-dev\": [],\n \"plugin-api-version\": \"2.6.0\"\n}\n"},"phpcs":{"api-version":"1.0.0","version":"1.2.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcs/phpcs-1.2.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcs":"^3.0 || ^2.0","phpcbf":"^3.0 || ^2.0"}},"checksum":{"type":"sha-512","value":"b6ed00306e76068a6af5e3b1dec837724f9e1900ef1049ce88e7ce195b0583524ca33a73613fba13244307a7ca853b6ddaa14ded69f651c3f184ac130bd1aaad"},"tools":{"phpcs":{"version":"3.10.3","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.10.3/phpcs.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.10.3/phpcs.phar.asc"},"phpcbf":{"version":"3.10.3","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.10.3/phpcbf.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.10.3/phpcbf.phar.asc"}},"composerLock":null}},"tools":[]}
84 changes: 84 additions & 0 deletions .phpcq.yaml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
phpcq:
repositories:
- 'https://phpcq.github.io/repository/repository.json'
directories:
- src
artifact: .phpcq/build
plugins:
composer-normalize:
version: ^1.0
signed: false
composer-require-checker:
version: ^1.0
signed: false
phpcpd:
version: ^1.1
signed: false
phploc:
version: ^1.0
signed: false
phpmd:
version: ^1.0
signed: false
psalm:
version: ^1.0
signed: false
phpcs:
version: ^1.0
signed: false
trusted-keys:
- C00543248C87FB13
- 033E5F8D801A2F8D
- D2CCAC42F6295E7D
- 4AA394086372C20A
- 9093F8B32E4815AA
- 8A03EA3B385DBAA1
- 12CE0F1D262429A5
- 31C7E470E2138192
- 5E6DDE998AB73B8E
- A978220305CD5C32
tasks:
fix:
- composer-normalize-fix
- phpcbf
verify:
- composer-normalize
- composer-require-checker
analyze:
- phpcpd
- phploc
- phpmd
- psalm
- phpcs
default:
- verify
- analyze
composer-normalize-fix:
config:
dry_run: false
ignore_output:
- '#> pre-command-run: Contao\\ManagerPlugin\\Composer\\ArtifactsPlugin->preCommandRun#'
- '#Root package is not of type "project" or "contao-theme", we will not be installing Contao extensions.#'
plugin: composer-normalize
composer-normalize:
config:
ignore_output:
- '#> pre-command-run: Contao\\ManagerPlugin\\Composer\\ArtifactsPlugin->preCommandRun#'
- '#Root package is not of type "project" or "contao-theme", we will not be installing Contao extensions.#'
composer-require-checker:
config:
config_file: .composer-require-checker.json
phpcs:
config:
standard: ~
standard_paths:
- ./vendor/slevomat/coding-standard
- ./vendor/doctrine/coding-standard/lib
phpcbf:
plugin: phpcs
config:
standard: ~
standard_paths:
- ./vendor/slevomat/coding-standard
- ./vendor/doctrine/coding-standard/lib
fix: true
35 changes: 35 additions & 0 deletions companion.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"receipts": [
"projects/contao-bundle/4.13-5.3"
],
"config": {
"phpConstraint": "^8.2"
},
"tools": {
"composer": {
"namespace": "Hofff\\Contao\\IconFont"
},
"phpcq": {
"plugins": {
"phpunit": false,
"rector": false
},
"presets": {
"composer-require-checker": {
"tasks": {
"composer-require-checker": {
"config":{
"config_file": ".composer-require-checker.json"
}
}
}
}
}
},
"psalm": {
"configuration": {
"errorLevel": "3"
}
}
}
}
Loading

0 comments on commit 54d2ce0

Please sign in to comment.