psvneo / qs-toolset-t3
This package contains a collection of tools used for QA of TYPO3 extensions developed at PSV NEO GmbH.
Requires
- php: ^8.2
- a9f/typo3-fractor: 0.5.*
- armin/editorconfig-cli: ^2.1
- friendsofphp/php-cs-fixer: ^3.89
- helmich/typo3-typoscript-lint: ^3.3
- michielroos/typo3scan: ^1.7
- overtrue/phplint: ^9.6
- phpmd/phpmd: ^2.15
- phpstan/phpstan: ^2.1
- rector/rector: ^2.2
- symfony/console: ^7.2
- symfony/process: ^7.2
- typo3/testing-framework: ^9.1
Requires (Dev)
This package is auto-updated.
Last update: 2025-11-12 10:51:37 UTC
README
This package provides a unified Docker-based quality assurance toolset for TYPO3 extensions developed by PSV NEO GmbH. It wraps various PHP and TYPO3-specific QA tools in containerized environments for consistent testing and analysis across different development environments.
Purpose
The QA toolset simplifies the integration of quality assurance tools into TYPO3 extension development workflows by:
- Providing a single executable (
bin/t3qa) that runs multiple QA tools - Using Docker containers to ensure consistent environments across different systems
- Offering pre-configured settings optimized for TYPO3 extension development
- Supporting both local development and CI/CD pipeline integration
Installation
As a Composer Dependency
Add this package to your TYPO3 extension's composer.json:
composer require --dev psvneo/qa-toolset-t3
Using in Other TYPO3 Extensions
- Install the package as a development dependency
- Copy the example configuration files to your project root if needed
- Add the provided composer scripts to your
composer.json - Run tools using
./vendor/bin/t3qaor through composer scripts
Available Tools
- PHPLint - PHP syntax linting
- PHP CS Fixer - Code style fixing and validation
- PHPStan - Static code analysis
- PHPMD - PHP Mess Detector for code quality analysis
- TypoScript Linter - TYPO3 TypoScript validation
- TYPO3 Scanner - Deprecated code detection
- Rector - PHP refactoring tool for TYPO3 compatibility
- Fractor - TYPO3-specific refactoring tool
- EditorConfig - Text file formatting validation and fixing
- YAML Lint - YAML file validation
- PHPUnit - Unit and functional testing
Usage
Run the QA toolset using:
./vendor/bin/t3qa -t <tool> [options]
Available Tools and Commands
-t <tool>
Specifies which tool to run:
- lint:php: Lints php files (syntax).
- lint:code-style: Lints php files (code style / formatting).
- lint:typoscript: Lints typoscript files.
- lint:debug: Lints for debug usage.
- lint:yaml: Lints YAML files.
- lint:typo3scan: Scans code for usage of deprecated and or changed code.
- lint:editorconfig: Validate text files based on given .editorconfig declarations
- fix:code-style: Fixes php files (code style / formatting).
- fix:editorconfig: Auto-fix text files based on given .editorconfig declarations.
- refactoring:rector: Uses rector to check, if the code is ready for the current TYPO3 version.
- refactoring:fractor: Uses fractor to check, if the code is ready for the current TYPO3 version.
- qa:analyse: Analyse the code using phpstan.
- qa:phpmd: Analyzes the code using phpmd.
- test:unit: Runs unit tests using phpunit.
- test:functional: Runs functional tests using phpunit and sqlite.
-p <8.2>
Specifies the PHP minor version to be used
- 8.2 (default): use PHP 8.2
-e
Additional options and/or arguments to send to the specified tool.
Example:
-e "-v --filter canRetrieveValueWithGP"
-x
Only used for the test tools. Specifies the xdebug mode.
See https://xdebug.org/docs/all_settings#mode for more information.
- Default: off
Example:
-x "develop,debug,coverage"
-i
Shows information about the used tool.
--help
Show this help.
Usage Examples
# Lint PHP syntax
./vendor/bin/t3qa -t lint:php
# Check code style
./vendor/bin/t3qa -t lint:code-style
# Fix code style
./vendor/bin/t3qa -t fix:code-style
# Run static analysis
./vendor/bin/t3qa -t qa:analyse
# Run unit tests
./vendor/bin/t3qa -t test:unit
# Run unit tests with Xdebug coverage
./vendor/bin/t3qa -t test:unit -x "develop,debug,coverage"
# Run tests with specific filter
./vendor/bin/t3qa -t test:unit -e "--filter MyTestMethod"
# Use different PHP version
./vendor/bin/t3qa -t qa:analyse -p 8.2
# Show tool information
./vendor/bin/t3qa -t qa:analyse -i
Integration Examples
Composer Scripts
Add these scripts to your composer.json for easier usage:
{
"scripts": {
"build": "./bin/build.sh",
"fix:code-style": "./.Build/bin/t3qa -t fix:code-style",
"fix:editorconfig": "./.Build/bin/t3qa -t fix:editorconfig",
"fix": [
"@fix:code-style",
"@fix:editorconfig"
],
"lint:php": "./.Build/bin/t3qa -t lint:php",
"lint:code-style": "./.Build/bin/t3qa -t lint:code-style",
"lint:editorconfig": "./.Build/bin/t3qa -t lint:editorconfig",
"lint:typo3scan": "./.Build/bin/t3qa -t lint:typo3scan",
"lint:typoscript": "./.Build/bin/t3qa -t lint:typoscript",
"lint:debug": "./.Build/bin/t3qa -t lint:debug",
"lint:yaml": "./.Build/bin/t3qa -t lint:yaml",
"lint": [
"@lint:php",
"@lint:code-style",
"@lint:typo3scan",
"@lint:typoscript",
"@lint:debug",
"@lint:yaml",
"@lint:editorconfig"
],
"qa:analyse": "./.Build/bin/t3qa -t qa:analyse",
"qa:phpmd": "./.Build/bin/t3qa -t qa:phpmd",
"qa": [
"@qa:analyse",
"@qa:phpmd"
],
"refactoring:rector": "./.Build/bin/t3qa -t refactoring:rector",
"refactoring:fractor": "./.Build/bin/t3qa -t refactoring:fractor",
"refactoring": [
"@refactoring:rector",
"@refactoring:fractor"
],
"test:functional": "./.Build/bin/t3qa -t test:functional",
"test:unit": "./.Build/bin/t3qa -t test:unit",
"test:e2e": "cd Tests/E2E && npm i && npx cypress run --browser chrome"
},
"scripts-descriptions": {
"build": "Builds the extension using the build script (docker container)",
"fix:code-style": "Fixes the code style of the extension using php-cs-fixer",
"fix:editorconfig": "Fixes the editorconfig of the extension using editorconfig-cli",
"fix": "Fixes the code style and editorconfig of the extension",
"lint:php": "Lints the PHP code of the extension using phplint",
"lint:code-style": "Lints the code style of the extension using php-cs-fixer",
"lint:editorconfig": "Lints the editorconfig of the extension using editorconfig-cli",
"lint:typo3scan": "Scans code for usage of deprecated and or changed code.",
"lint:typoscript": "Lints the TypoScript code of the extension using typo3-typoscript-lint",
"lint:debug": "Searches the code base for debug statements",
"lint:yaml": "Lints the YAML code of the extension using yaml-lint",
"lint": "Lints the PHP, code style, editorconfig, TypoScript, debug statements and YAML code of the extension",
"qa:analyse": "Analyses the code of the extension using phpstan",
"qa:phpmd": "Analyses the code of the extension using phpmd",
"qa": "Analyses the code of the extension using phpstan and phpmd",
"refactoring:rector": "Refactors the code of the extension using rector.",
"refactoring:fractor": "Refactors the code of the extension using fractor.",
"refactoring": "Refactors the code of the extension using rector in version 2, rector in version 1 and fractor.",
"test:functional": "Runs the functional tests of the extension using typo3-testing-framework and phpunit",
"test:unit": "Runs the unit tests of the extension using typo3-testing-framework and phpunit",
"test:e2e": "Runs the end-to-end tests of the extension using cypress"
}
}
Then run: composer lint:yaml, composer qa:analyse, etc.
GitLab CI
#======================================================
# Cache
#======================================================
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .Build/
#======================================================
# Stages
#======================================================
stages:
- build
- lint
- quality
- test
#======================================================
# Install dependencies
#======================================================
composer-install:
image: composer:2.2
stage: build
before_script:
- composer validate
script:
- composer install --ignore-platform-reqs
artifacts:
expire_in: 1 hour
paths:
- .Build/
only:
- merge_requests
#======================================================
# Lint - PHP
#======================================================
lint-php:
image: php:8.2
stage: lint
script:
- .Build/bin/phplint -c .Build/vendor/psvneo/qa-toolset-t3/config/.phplint.yml --ansi
only:
- merge_requests
#======================================================
# Lint - Code style
#======================================================
lint-code-style:
image: php:8.2
stage: lint
script:
- .Build/bin/php-cs-fixer fix --config=.Build/vendor/psvneo/qa-toolset-t3/config/.php-cs-fixer.php --dry-run --diff --allow-risky=yes
only:
- merge_requests
#======================================================
# Lint - Typoscript
#======================================================
lint-typoscript:
image: php:8.2
stage: lint
script:
- .Build/bin/typoscript-lint . -c .Build/vendor/psvneo/qa-toolset-t3/config/typoscript-lint.yml
only:
- merge_requests
#======================================================
# Lint - Debug
#======================================================
lint-debug:
image: alpine:3.20
stage: lint
script:
- |
if grep -rnw "Resources/Private/Templates" "Resources/Private/Partials" "Resources/Private/Layouts" "Classes/" -e "f:debug" -e "DebuggerUtility"
then
exit 1;
fi
only:
- merge_requests
#======================================================
# Lint - typo3scan
#======================================================
lint-typo3scan:
image: php:${PHP_VERSION}
stage: lint
script:
- .Build/bin/typo3scan scan .
only:
- merge_requests
#======================================================
# Lint - YAML
#======================================================
lint-yaml:
image: php:8.2
stage: lint
script:
- .Build/bin/yaml-lint ./Configuration ./Resources
only:
- merge_requests
#======================================================
# Lint - Editorconfig
#======================================================
lint-editorconfig:
image: php:8.2
stage: lint
script:
- .Build/bin/ec
only:
- merge_requests
#======================================================
# Lint - Rector
#======================================================
lint-rector:
image: php:8.2
stage: lint
script:
- php -d memory_limit=-1 .Build/bin/rector process . -c .Build/vendor/psvneo/qa-toolset-t3/config/rector.php --dry-run
only:
- merge_requests
#======================================================
# Lint - Fractor
#======================================================
lint-fractor:
image: php:8.2
stage: lint
script:
- php -d memory_limit=-1 .Build/bin/fractor process -c .Build/vendor/psvneo/qa-toolset-t3/config/fractor.php --dry-run
only:
- merge_requests
#======================================================
# Quality - Analyse
#======================================================
quality-analyse:
image: php:8.2
stage: quality
script:
- php -d memory_limit=-1 .Build/bin/phpstan analyse -a .Build/vendor/autoload.php -c .Build/vendor/psvneo/qa-toolset-t3/config/phpstan.neon
only:
- merge_requests
#======================================================
# Quality - phpmd
#======================================================
quality-phpmd:
image: php:8.2
stage: quality
script:
- .Build/bin/phpmd Classes/,Configuration/ gitlab .Build/vendor/psvneo/qa-toolset-t3/config/phpmd.xml
only:
- merge_requests
##======================================================
## Test - Unit
##======================================================
test-unit:
image: riconet/quality:8.2
stage: test
script:
- .Build/bin/phpunit -c .Build/vendor/psvneo/qa-toolset-t3/config/UnitTests.xml "" Tests/Unit
only:
- merge_requests
#======================================================
# Test - Functional
#======================================================
test-functional:
image: riconet/quality:8.2
stage: test
variables:
typo3DatabaseDriver: pdo_sqlite
script:
- .Build/bin/phpunit -c .Build/vendor/psvneo/qa-toolset-t3/config/FunctionalTests.xml "" Tests/Functional;
only:
- merge_requests
Configuration
The QA toolset includes pre-configured settings for all tools in the config/
directory:
.phplint.yml- PHPLint configuration.php-cs-fixer.php- PHP CS Fixer rulesphpstan.neon- PHPStan analysis settingsphpmd.xml- PHP Mess Detector rulestyposcript-lint.yml- TypoScript Linter configurationrector.php- Rector refactoring rulesfractor.php- Fractor TYPO3-specific refactoring rulesUnitTests.xml- PHPUnit configuration for unit testsFunctionalTests.xml- PHPUnit configuration for functional tests
Requirements
- Docker (for containerized tool execution)
- PHP 8.2+ (for the main executable)
- Composer
Contributing
This toolset is developed by PSV NEO GmbH for internal use with TYPO3 extensions. The configuration files are optimized for TYPO3 extension development standards.