Skip to content

Specify return type error#94

Open
xepozz wants to merge 12 commits into
masterfrom
fix-exception
Open

Specify return type error#94
xepozz wants to merge 12 commits into
masterfrom
fix-exception

Conversation

@xepozz

@xepozz xepozz commented Feb 18, 2024

Copy link
Copy Markdown
Member
Q A
Is bugfix? ✔️
New feature?
Breaks BC? ✔️

@codecov

codecov Bot commented Feb 18, 2024

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a80e629) to head (c26b392).
⚠️ Report is 18 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##              master       #94   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity        91       103   +12     
===========================================
  Files              7        11    +4     
  Lines            239       290   +51     
===========================================
+ Hits             239       290   +51     

☔ View full report in Codecov by Harness.
📢 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.

@what-the-diff

what-the-diff Bot commented Feb 18, 2024

Copy link
Copy Markdown

PR Summary

  • Implementation of Exception for Invalid Middleware Return Types
    A new file named InvalidMiddlewareReturnTypeException.php was introduced which behaves as an alarm system if the return types from the middleware are incorrect.

  • Creation of Two Helper Classes

    • The new DefinitionHelper.php file contains methods which support in managing middleware definitions.
    • Another file ResponseHelper.php was also introduced which houses methods that aid with responses from the middleware.
  • Organizational Changes to Existing Files

    • The InvalidMiddlewareDefinitionException.php file has been rearranged. Two methods previously present here, convertDefinitionToString() and convertToString(), have now been relocated to the newly created helper classes discussed above.
    • Additionally, there's an update in the MiddlewareFactory.php file. The process() method now localizes a different kind of system exception - InvalidMiddlewareReturnTypeException, if conditions are met. This method previously used to detect InvalidMiddlewareDefinitionException.
  • Inclusion of Tests for New Additions

    • The newly introduced exception and helper files would be put to test with the help of a couple new files. InvalidMiddlewareReturnTypeExceptionTest.php will verify the functionality of our new exception, whereas ResponseHelperTest.php confirms the working of the newly added helper class.
  • Updates to Test Cases

    • The test files InvalidMiddlewareDefinitionExceptionTest.php and MiddlewareFactoryTest.php have been modified to reflect recent changes made in their respective files. The modification ensures exceptions are accurately detected and error messages are updated to fit the latest changes made.

@vjik vjik added the status:under development Someone is working on a pull request. label Feb 18, 2024
@xepozz xepozz requested a review from a team February 21, 2024 20:59
@xepozz xepozz added status:code review The pull request needs review. and removed status:under development Someone is working on a pull request. labels Feb 21, 2024

@vjik vjik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need line in changelog

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This methods need for excpetion only. May be keep thier in AbstractInvalidMiddlewareException but change visibility from private to protected?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need add solution for friendly exception also. Solution from AbstractInvalidMiddlewareException does not fit here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:code review The pull request needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants