Skip to content

Conversation

@Mohammad-Alavi
Copy link
Member

@Mohammad-Alavi Mohammad-Alavi commented Aug 6, 2025

Description

resolve #223
resolve #224

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (refactoring a current feature, method, etc...)
  • Code Coverage (adding/removing/updating/refactoring tests)
  • New feature (non-breaking change which adds functionality)
  • Remove feature (non-breaking change which removes functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

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.
@Mohammad-Alavi Mohammad-Alavi requested a review from Copilot August 6, 2025 15:08
@Mohammad-Alavi Mohammad-Alavi self-assigned this Aug 6, 2025
@Mohammad-Alavi Mohammad-Alavi added type: enhancement A proposed improvement or addition to existing features type: refactor Indicates that the issue or PR involves code restructuring without changing its external behavior labels Aug 6, 2025

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Aug 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.35%. Comparing base (76e50e8) to head (36e14bd).
⚠️ Report is 13 commits behind head on 13.x.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Mohammad-Alavi and others added 3 commits August 6, 2025 20:06
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.
@Mohammad-Alavi Mohammad-Alavi requested a review from Copilot August 6, 2025 16:50
Copy link
Contributor

Copilot AI left a 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

Mohammad-Alavi and others added 5 commits August 6, 2025 20:22
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.
@Mohammad-Alavi Mohammad-Alavi added the type: fix A correction or resolution to an identified issue label Aug 6, 2025
@apiato apiato deleted a comment from Copilot AI Aug 6, 2025
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.
@Mohammad-Alavi Mohammad-Alavi merged commit f4d410f into 13.x Aug 6, 2025
7 checks passed
@Mohammad-Alavi Mohammad-Alavi deleted the 13.x]-Improveents branch August 6, 2025 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement A proposed improvement or addition to existing features type: fix A correction or resolution to an identified issue type: refactor Indicates that the issue or PR involves code restructuring without changing its external behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loading configs from containers are not loaded/registered For Windows OS the path slash is incorrect

2 participants