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

Resolve errors in WebApplication for PHPStan Level 9 #148

Merged
merged 4 commits into from
Jun 13, 2023
Merged

Conversation

spaze
Copy link
Owner

@spaze spaze commented Jun 12, 2023

Fixes these two

 ------ ---------------------------------------------------------------------------------------------------------------
  Line   app/Application/WebApplication.php
 ------ ---------------------------------------------------------------------------------------------------------------
  30     Parameter #2 $actionName of method MichalSpacekCz\Http\SecurityHeaders::setCsp() expects string, mixed given.
  44     Part $uri (mixed) of encapsed string cannot be cast to string.
 ------ ---------------------------------------------------------------------------------------------------------------

by using

  1. the new spaze/csp-config API
  2. existing objects to get the URL to redirect to

For #147

 - spaze/csp-config updated from v3.0.0 to v4.0.0 major
   See changes: spaze/csp-config@v3.0.0...v4.0.0
   Release notes: https://github.com/spaze/csp-config/releases/tag/v4.0.0
@spaze spaze self-assigned this Jun 12, 2023
- Pass the fully qualified action instead of presenter and action as separate params
- Specify whether a default CSP should be used in `sendHeaders` param
- Can remove the `onRequest` event handler because the SecurityHeaders service can get the action itself now, this made the test a bit more difficult but that's fine

For #147, because `$action = $request->getParameter(...)` returns mixed
For #147, "Part $uri (mixed) of encapsed string cannot be cast to string", also `(string)$_SERVER['REQUEST_URI']` gives "Cannot cast mixed to string" which is... exciting!
@spaze spaze merged commit 2b5286c into main Jun 13, 2023
@spaze spaze deleted the spaze/csp-config branch June 13, 2023 01:34
@spaze spaze mentioned this pull request Jun 12, 2023
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