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
21 changes: 21 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,27 @@ When creating new formatters:

All formatters must implement the `Respect\StringFormatter\Formatter` interface.

## Modifier Development

When creating new modifiers:

1. **Follow Chain of Responsibility pattern**: Check pipe value and delegate to next modifier
2. **Use template structure**: Similar to `src/Modifier/QuoteModifier.php`
3. **Test with TestingModifier**: Located in `tests/Helper/TestingModifier.php`
4. **Handle type checking**: Always check input types before processing
5. **Return string values**: Modifiers must return strings
6. **Use Stringifier Quoter**: For string operations, inject `\Respect\Stringifier\Quoter` with CodeQuoter as default

All modifiers must implement the `Respect\StringFormatter\Modifier` interface.

## Testing Guidelines

1. **Avoid PHPUnit mocks**: Create custom test implementations instead of using createMock()
2. **Use custom test quoter**: Follow pattern in `tests/Helper/TestingQuoter.php`
3. **Test contracts not implementations**: Verify interactions without depending on specific behavior
4. **Make test properties public**: When using anonymous classes to access test state
5. **Verify method calls**: Track whether methods were called and with what parameters

## Commit Guidelines

Follow the detailed rules in `docs/contributing/commit-guidelines.md`:
Expand Down
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@
"require": {
"symfony/polyfill-mbstring": "^1.33",
"php": "^8.5",
"respect/stringifier": "^3.0"
"respect/stringifier": "^3.0",
"symfony/translation-contracts": "^3.6"
},
"suggest": {
"symfony/translation": "For translation support in TransModifier (^6.0|^7.0)"
},
"require-dev": {
"phpunit/phpunit": "^12.5",
"phpstan/phpstan": "^2.1",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"respect/coding-standard": "^5.0"
"respect/coding-standard": "^5.0",
"symfony/translation": "^6.0|^7.0"
},
"license": "ISC",
"autoload": {
Expand Down
Loading