Skip to content
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

fix: spark routes shows invalid routes with Auto Routing Improved #7417

Closed

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Apr 8, 2023

Description
Fixes #7415

  • fix the spark routes shows the default controller's method routes that cannot be accessible.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the bug Verified issues on the current code behavior or pull requests that will fix them label Apr 8, 2023
Comment on lines 96 to 103
// Skip the default controller.
if (class_basename($class) === $defaultController) {
continue;
}
Copy link
Member

Choose a reason for hiding this comment

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

just quick read, $class and $defaultControllerseems never replaced under loop, seems can be moved before loop to return early.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for review. But it cannot be moved before loop.
The method is a bit difficult to understand.
I refactored and and some comments.

Copy link
Member Author

Choose a reason for hiding this comment

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

@samsonasik I changed my mind. Please review #7419 when you have time.

@kenjis kenjis force-pushed the fix-spark-routes-auto-routing branch from 5a527d4 to d5ac6b5 Compare April 10, 2023 00:30
@kenjis kenjis force-pushed the fix-spark-routes-auto-routing branch from d5ac6b5 to a0578b3 Compare April 10, 2023 00:32
To suppress Psalm error.
ERROR: DuplicateArrayKey - system/Commands/Utilities/Routes/AutoRouterImproved/ControllerMethodReader.php:83:55 - String keys are not supported in unpacked arrays (see https://psalm.dev/151)
                            $output = [...$output, ...$routeForDefaultController];
@kenjis kenjis marked this pull request as draft April 10, 2023 22:56
@kenjis kenjis closed this Apr 10, 2023
@kenjis kenjis deleted the fix-spark-routes-auto-routing branch April 10, 2023 23:41
@kenjis
Copy link
Member Author

kenjis commented Apr 10, 2023

Go to #7419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: spark routes shows invalid routes with Auto Routing Improved
2 participants