NelmioSecurityBundle icon indicating copy to clipboard operation
NelmioSecurityBundle copied to clipboard

Make data array variable type within `Report` more precise

Open fritzmg opened this issue 1 year ago • 2 comments

Just a minor issue that PHP stan found in our project:

Error: Parameter #1 $data of class Nelmio\SecurityBundle\ContentSecurityPolicy\Violation\Report constructor expects array<string, string>, array<string, int|string> given.
 ------ ---------------------------------------------------------------------- 
  Line   core-bundle/tests/EventListener/CspReportListenerTest.php             
 ------ ---------------------------------------------------------------------- 
  47     Parameter #1 $data of class                                           
         Nelmio\SecurityBundle\ContentSecurityPolicy\Violation\Report          
         constructor expects array<string, string>, array<string, int|string>  
         given.                                                                
 ------ ---------------------------------------------------------------------- 

The JSON data sent by the browser can in fact also have integers for the following keys:

  • column-number
  • line-number
  • status-code

fritzmg avatar Dec 17 '23 22:12 fritzmg

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (da7cc88) 96.93% compared to head (f7a2bde) 96.93%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #332   +/-   ##
=========================================
  Coverage     96.93%   96.93%           
  Complexity      429      429           
=========================================
  Files            52       52           
  Lines          1923     1923           
=========================================
  Hits           1864     1864           
  Misses           59       59           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Dec 18 '23 07:12 codecov-commenter

Not sure how to fix the other issues reported by PHP stan. These methods do in fact only ever return a string or null.

fritzmg avatar Dec 18 '23 10:12 fritzmg