Skip to content

Dev#50

Merged
milinsky merged 4 commits into
mainfrom
dev
Nov 24, 2025
Merged

Dev#50
milinsky merged 4 commits into
mainfrom
dev

Conversation

@milinsky
Copy link
Copy Markdown
Member

No description provided.

Implement enhanced error messages with context and helpful suggestions.

Features:
- NotFoundException with similar service suggestions (Levenshtein)
- CircularReferenceException with full dependency chain visualization
- InvalidBindingException with detailed requirements and examples
- ResolveDependenciesTreeException with dependency chain context
- DependencyChain utility for tracking resolution path
- Helpful hints and multiple solution suggestions for each error

Improvements:
- Service suggestions use Levenshtein distance for typo detection
- Full dependency chain visualization for circular references
- Detailed binding validation with requirements
- Context-aware error messages with actionable solutions
- Added getAvailableServices() helper for suggestion generation
- Added getAll() method to ProviderStorage

Tests: 130 tests (+5), 236 assertions (+21)
Psalm: No errors (99.91% type coverage)
php-cs-fixer: All files formatted
Add comprehensive unit and functional tests for all new features.

New unit tests:
- 21 tests for DependencyChain (100% coverage)
  * push/pop operations
  * reset functionality
  * toString, has, isEmpty, getDepth, getCurrent
  * Complex scenarios with multiple operations
- 2 tests for ProviderStorage::getAll()

New functional tests (6):
- NotFoundException with no similar services
- NotFoundException using Levenshtein for suggestions
- CircularReferenceException with empty chain
- Multiple suggestions sorted by distance
- Container getAvailableServices includes all types

Coverage improvements:
- DependencyChain: 100% method coverage
- ProviderStorage::getAll(): 100% coverage
- All Exception classes: enhanced branch coverage
- NotFoundException: Levenshtein algorithm paths covered
- CircularReferenceException: both chain paths covered

Total: 156 tests (+26), 278 assertions (+42)
Psalm: No errors (99.91% type coverage)
php-cs-fixer: All files formatted
Add comprehensive unit tests for Exception classes and functional tests
for all error message scenarios and edge cases.

New unit tests for Exception classes (17 tests):
- NotFoundException: all parameter combinations (with/without chain, with/without suggestions)
- CircularReferenceException: with and without chain
- InvalidBindingException: full message format
- ResolveDependenciesTreeException: with/without chain, with previous exception
- Levenshtein distance algorithm for suggestions
- Suggestion limiting to 3 items
- All exceptions contain actionable hints

New functional tests (8 tests):
- NotFoundException with chain
- CircularReferenceException with chain
- Invalid binding scenarios (non-interface, not implemented, not extended)
- Partial match suggestions
- Multiple binding errors
- Message format consistency

Coverage improvements:
- All Exception classes: 100% branch coverage
- NotFoundException suggestion algorithm: all paths covered
- CircularReferenceException: both with/without chain paths
- InvalidBindingException: all message parts covered
- ResolveDependenciesTreeException: all parameter combinations

Total: 177 tests (+21), 355 assertions (+77)
Psalm: No errors (99.91% type coverage)
php-cs-fixer: All files formatted
@milinsky milinsky merged commit 7193f30 into main Nov 24, 2025
2 checks passed
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.

1 participant