|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Common Development Commands |
| 6 | + |
| 7 | +### Testing |
| 8 | +- Run all tests: `vendor/bin/codecept run` |
| 9 | +- Run unit tests only: `vendor/bin/codecept run Unit` |
| 10 | +- Run tests with coverage: `vendor/bin/codecept run --coverage` |
| 11 | + |
| 12 | +### Code Quality |
| 13 | +- Run PHPStan static analysis: `vendor/bin/phpstan analyse` |
| 14 | +- Check PHPStan configuration in `phpstan.neon` (level 6) |
| 15 | + |
| 16 | +### Installation |
| 17 | +- Install dependencies: `composer install` |
| 18 | +- Install with dev dependencies: `composer install --dev` |
| 19 | + |
| 20 | +## Architecture Overview |
| 21 | + |
| 22 | +This is a Pimcore bundle that wraps static method calls in service-oriented architecture. The bundle follows a consistent 4-layer pattern: |
| 23 | + |
| 24 | +### Core Architecture Pattern |
| 25 | +1. **Contract Interfaces** (`src/Contract/*/`): Public API interfaces (e.g., `DbResolverContractInterface`) |
| 26 | +2. **Contract Implementations** (`src/Contract/*/`): Wrap static calls (e.g., `DbResolverContract`) |
| 27 | +3. **Bundle Interfaces** (`src/*/`): Internal interfaces extending contracts (e.g., `DbResolverInterface`) |
| 28 | +4. **Bundle Implementations** (`src/*/`): Final implementations marked `@internal` (e.g., `DbResolver`) |
| 29 | + |
| 30 | +### Key Components |
| 31 | +- **Resolver Services**: Transform static calls into injectable services for better testability |
| 32 | +- **Proxy Services**: Handle dynamic method interception (deprecated functionality) |
| 33 | +- **DI Container**: Auto-configured services via `config/services.yaml` |
| 34 | + |
| 35 | +### Directory Structure |
| 36 | +- `src/Contract/`: Public API contracts for third-party developers |
| 37 | +- `src/Db/`, `src/Lib/`, `src/Models/`: Bundle-specific implementations (internal use) |
| 38 | +- `src/Proxy/`: Legacy proxy functionality (deprecated) |
| 39 | +- `tests/Unit/`: Comprehensive unit test coverage |
| 40 | + |
| 41 | +## Development Guidelines |
| 42 | + |
| 43 | +### Adding New Resolvers |
| 44 | +1. Create contract interface in `src/Contract/[Category]/` |
| 45 | +2. Implement contract wrapping static calls |
| 46 | +3. Create bundle-specific interface extending contract |
| 47 | +4. Create final implementation marked `@internal` |
| 48 | + |
| 49 | +### Service Registration |
| 50 | +Services are auto-registered via PSR-4 in `config/services.yaml`. Manual registration only needed for interface bindings. |
| 51 | + |
| 52 | +### Testing Strategy |
| 53 | +- All resolvers have corresponding unit tests in `tests/Unit/` |
| 54 | +- Tests use Codeception framework |
| 55 | +- Coverage reports enabled in `codeception.dist.yml` |
| 56 | + |
| 57 | +## Important Notes |
| 58 | +- Contract interfaces are public API for third-party developers |
| 59 | +- Bundle-specific interfaces marked `@internal` are for Pimcore internal use only |
| 60 | +- Bundle provides migration path from static methods to dependency injection |
| 61 | +- PHPStan baseline exists (`phpstan-baseline.neon`) for existing code |
0 commit comments