[Vortex] FCM: Throw exception if data value is not a string in the fcm payload

Review Request #1137 — Created April 19, 2024 and submitted

b.stoop
Lunr.Vortex
fcm/checkdatavalues
b965ede...
lunr

Based on master

FCM: Throw exception if data value is not a string in the fcm payload

Github actions run: https://github.com/brianstoop/lunr.vortex/actions/runs/8835759428

  • 0
  • 0
  • 4
  • 0
  • 4
Description From Last Updated
pprkut
  1. 
      
  2. src/Lunr/Vortex/FCM/FCMPayload.php (Diff revision 1)
     
     

    foreach ($data as &$value)

  3. src/Lunr/Vortex/FCM/FCMPayload.php (Diff revision 1)
     
     

    === FALSE

    1. phpstan is complaining about it: https://github.com/brianstoop/lunr.vortex/actions/runs/8801861811/job/24156247613

  4. src/Lunr/Vortex/FCM/FCMPayload.php (Diff revision 1)
     
     

    Backticks? We don't use backticks as quotes anywhere else.

    Also, Data type not Data value

  5. 
      
b.stoop
pprkut
  1. 
      
  2. src/Lunr/Vortex/FCM/FCMPayload.php (Diff revisions 1 - 2)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    array<string,mixed> isn't correct though, because data values are only allowed to be strings.

    phpstan sees that the incoming value, according to phpdoc, is only allowed to be string, so is_string() will always return TRUE.

    I think the better fix here might be to ignore the specific phpstan error using @phpstan-ignore.

  3. 
      
b.stoop
pprkut
  1. Ship It!
  2. 
      
b.stoop
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (b965ede)
Loading...