Use this skill for tests, static analysis, quality gates, Composer scripts, verification steps, and code style checks.
Automated tests are expected for new behavior.
Preferred tools:
tests/run.php runnerRules:
var_dump() or manual browser testing as the only verification.Run basic tests:
php tests/run.php
If PHPUnit is installed:
vendor/bin/phpunit
Example PHPUnit test:
final class InvoiceCalculatorTest extends TestCase
{
public function testItCalculatesTotalInCents(): void
{
$calculator = new InvoiceCalculator();
$total = $calculator->calculateTotal([
['amountCents' => 1000],
['amountCents' => 2500],
]);
self::assertSame(3500, $total);
}
}
Use static analysis when available.
Recommended tools:
composer require --dev phpstan/phpstan
composer require --dev vimeo/psalm
Common quality commands:
composer validate
composer audit
vendor/bin/phpcs --standard=PSR12 src tests
vendor/bin/phpunit
vendor/bin/phpstan analyse src tests
Do not ignore tool failures without documenting why.
composer require --dev squizlabs/php_codesniffer
composer require --dev friendsofphp/php-cs-fixer
Example checks:
vendor/bin/phpcs --standard=PSR12 src tests
vendor/bin/php-cs-fixer fix --dry-run --diff
Example fix:
vendor/bin/php-cs-fixer fix
A project may include scripts like this:
{
"scripts": {
"test": "phpunit",
"style": "phpcs --standard=PSR12 src tests",
"style:fix": "php-cs-fixer fix",
"analyse": "phpstan analyse src tests",
"quality": [
"@style",
"@test",
"@analyse"
]
}
}
Then run:
composer quality
When completing work:
Before considering work complete:
Powered by TurnKey Linux.