Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpcs.xml.dist export-ignore
/.php-cs-fixer.php export-ignore
/psalm.xml.dist export-ignore
/README.md export-ignore
/.github export-ignore
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Run Psalm
run: vendor/bin/psalm --output-format=github --shepherd

phpcs:
php-cs-fixer:
name: Code style
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -91,8 +91,8 @@ jobs:
env:
COMPOSER_ROOT_VERSION: dev-master

- name: Run PHPCodeSniffer
run: vendor/bin/phpcs --report=checkstyle -q --parallel=1 | cs2pr
- name: Run PHP-CS-Fixer
run: vendor/bin/php-cs-fixer check --format=checkstyle | cs2pr

test-static-analysis:
name: Run static analysis on the tests themselves
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
composer.lock
vendor
.claude/settings.local.json
/.php-cs-fixer.cache
35 changes: 35 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

return (new Config())
->setUnsupportedPhpVersionAllowed(true)
->setRiskyAllowed(false)
->setRules([
'@PER-CS3x0' => true,
// import
'global_namespace_import' => [
'import_classes' => false,
'import_constants' => false,
'import_functions' => false,
],
'no_unused_imports' => true,
'ordered_imports' => true,
])
->setFinder(
(new Finder())
->in([
__DIR__ . '/src',
__DIR__ . '/tools/behat',
])
->name('*.php')
->exclude(['vendor', 'run'])
->append([
__FILE__,
]),
)
->setParallelConfig(ParallelConfigFactory::detect());
11 changes: 5 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ These come first, before every other rule here:
CI (`.github/workflows/ci.yml`) is the source of truth:
- `psalm` (PHP 8.2): `COMPOSER_ROOT_VERSION=dev-master composer update --prefer-dist`, then
`vendor/bin/psalm --output-format=github --shepherd` on `src/`.
- `phpcs`: `vendor/bin/phpcs`. `composer check` runs phpcs and Psalm.
- `php-cs-fixer`: `vendor/bin/php-cs-fixer check --diff`. `composer check` runs PHP-CS-Fixer and Psalm.
- `test-static-analysis` (PHP 8.2): `cd tools/behat && composer install && vendor/bin/psalm`, then
`php tools/behat/lint-features.php` (see "Tests").
- `tests`: deps high/low/stable × PHP 8.2 and 8.4 on pull requests, PHP 8.2 to 8.4 on pushes,
Expand All @@ -83,8 +83,8 @@ Locally:
nothing ("No scenarios"). Check that the output says `1 scenario`.
- The full suite (a few minutes) at most once, right before pushing. Never between
iterations, and never sweeps (re-running batches of scenarios, looping over fixtures).
- `vendor/bin/phpcs -q`, `vendor/bin/psalm --no-cache` (~2 s) and `php tools/behat/lint-features.php` are cheap
and fine at any time.
- `vendor/bin/php-cs-fixer check`, `vendor/bin/psalm --no-cache` (~2 s) and
`php tools/behat/lint-features.php` are cheap and fine at any time.
- Also fine: a scratch-project repro (skill `plugin-repro`).
- When briefing a subagent, spell all of this out ("single scenarios only, no full suite,
no sweeps"); a vague "don't run the tests" is not enough.
Expand Down Expand Up @@ -209,9 +209,8 @@ workaround explicitly in the report.

## Code style

- phpcs (`phpcs.xml.dist`): PSR12, short arrays, 120-character absolute line limit, applied
to `src/`. Run `vendor/bin/phpcs`
(`vendor/bin/phpcbf` fixes).
- PHP-CS-Fixer (`.php-cs-fixer.php`): PER-CS 3.0, applied to `src/` and `tools/behat/`. Run
`vendor/bin/php-cs-fixer check --diff` (`vendor/bin/php-cs-fixer fix` fixes).
- Match the surrounding code: comment density, naming, idiom.
- Comments are concise and only explain what isn't obvious from the code:
- don't restate the code in prose;
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"vimeo/psalm": "^7.2 || dev-master"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.88",
"phpspec/prophecy-phpunit": "^2.5",
"phpunit/phpunit": "^11.0 || ^12.0 || ^13.0",
"squizlabs/php_codesniffer": "^3.13"
"phpunit/phpunit": "^11.0 || ^12.0 || ^13.0"
},
"conflict": {
"phpspec/prophecy": "<1.20.0",
Expand Down Expand Up @@ -48,7 +48,7 @@
"@cs-check",
"@analyze"
],
"cs-check": "phpcs",
"cs-fix": "phpcbf"
"cs-check": "php-cs-fixer check --diff",
"cs-fix": "php-cs-fixer fix"
}
}
33 changes: 0 additions & 33 deletions phpcs.xml.dist

This file was deleted.

Loading