Skip to content

[feature] Make ecs.php extensible instead of fully replaceable#19

Merged
coisa merged 2 commits intomainfrom
feature/6-make-ecs-php-extensible
Apr 9, 2026
Merged

[feature] Make ecs.php extensible instead of fully replaceable#19
coisa merged 2 commits intomainfrom
feature/6-make-ecs-php-extensible

Conversation

@coisa
Copy link
Copy Markdown
Contributor

@coisa coisa commented Apr 9, 2026

Summary

  • Added ECSConfig class in FastForward\DevTools\Config namespace with static configure() method
  • The method returns ECSConfigBuilder with the default ECS configuration
  • Updated ecs.php to use the new class
  • Added PHPDoc documentation explaining how to extend the configuration in consumer projects

Changes

  • Created src/Config/ECSConfig.php with static configure() method
  • Updated ecs.php to use ECSConfig::configure()

Usage Example

In a consumer project, create ecs.php that extends the default configuration:

use FastForward\DevTools\Config\ECSConfig;
use PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer;

$config = ECSConfig::configure();
$config->withRules([CustomRule::class]);
$config->withConfiguredRule(PhpdocAlignFixer::class, ['align' => 'right']);

return $config;

This allows consumers to:

  • Build upon the default configuration without copying the entire file
  • Automatically receive upstream updates to the base configuration
  • Only override what they need

Testing

All tests pass (88 tests, 243 assertions).

Closes #6

- Add ECSConfig class with static configure() method returning ECSConfigBuilder
- Update ecs.php to use ECSConfig::configure()
- Remove CodeStyleCommand changes (extra-config option)
- Add PHPDoc explaining extension pattern in ECSConfig class

Usage example in consumer project:
    $config = \FastForward\DevTools\Config\ECSConfig::configure();
    $config->withRules([CustomRule::class]);
    $config->withConfiguredRule(PhpdocAlignFixer::class, ['align' => 'right']);
    return $config;

Implements: #6
@coisa coisa force-pushed the feature/6-make-ecs-php-extensible branch from ba2b6c6 to 92a7505 Compare April 9, 2026 02:40
- Add 'Extending ECS Configuration' section to overriding-defaults.rst
- Add FAQ entry explaining how to extend ECS configuration

Refs: #6
@coisa coisa merged commit 98c1e48 into main Apr 9, 2026
6 checks passed
@coisa coisa deleted the feature/6-make-ecs-php-extensible branch April 9, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make ecs.php extensible instead of fully replaceable

1 participant