-
-
Notifications
You must be signed in to change notification settings - Fork 84
[13.x] improveents #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[13.x] improveents #227
Conversation
Improves exception handling by providing more detailed error messages in debug mode and refactors method signatures for clarity. Adds event dispatching to the delete method, updates findOrFail and findById logic, and reorganizes method order for better readability.
Updated the findOrFail method to throw a ResourceNotFound exception if the provided ID is null, improving error handling and preventing invalid queries.
Replaces decodeOrFail with decode and adds a type check for string values before decoding. This prevents errors when non-string values are encountered during input processing.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 13.x #227 +/- ##
============================================
+ Coverage 88.97% 89.35% +0.37%
- Complexity 339 342 +3
============================================
Files 43 43
Lines 980 996 +16
============================================
+ Hits 872 890 +18
+ Misses 108 106 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Removed redundant null check in Repository::findOrFail. Updated related test to verify exception is thrown for both non-existent and null IDs.
Reordered and refactored decode and encode methods for clarity and consistency. Updated decodeOrFail to handle multiple hash IDs more robustly and adjusted related unit tests to match new method signatures and behaviors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR performs refactoring improvements to the codebase, including reorganizing method orders, enhancing error handling, and expanding test coverage for edge cases.
- Reorganized method order in HashidsManagerDecorator for better logical flow
- Enhanced error handling in Repository class with better exception messages and proper deletion events
- Expanded test coverage to include additional edge cases for hashids decoding and repository operations
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Support/HashidsManagerDecorator.php | Reordered methods and improved code formatting with expanded closure syntax |
| src/Core/Repositories/Repository.php | Enhanced error handling, added proper deletion events, and improved exception messages |
| src/Core/Requests/Request.php | Changed from decodeOrFail to decode with null safety check |
| tests/Unit/Support/HashidsManagerDecoratorTest.php | Expanded test coverage for multiple hashids and edge cases |
| tests/Unit/Core/Repositories/RepositoryTest.php | Added test case for null ID in findOrFail method |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Simplified test cases for custom exception throwing in RepositoryTest and improved clarity in HashidsManagerDecoratorTest by separating exception and value assertions. This enhances test readability and maintainability.
Updated View.php to use realpath when processing view paths for more reliable normalization.
Replaces usage of Illuminate\Support\Str with PHP's basename function to extract config keys from file paths in ConfigServiceProvider. Simplifies code and removes unnecessary dependency.
Introduces a test to verify that original exception messages are returned by the repository when app debug mode is enabled, ensuring proper error reporting for resource creation and update failures.
Description
resolve #223
resolve #224
Type of change