Problem/Motivation

PHPStan identifies some type-safety errors:

 ------ ----------------------------------------------------------------------------------------------------
  Line   web/modules/contrib/push_notifications_registration_tokens/src/RegistrationTokenTypePluginManager.php
 ------ ----------------------------------------------------------------------------------------------------
  42     Cannot cast mixed to string.
         🪪  cast.string
 ------ ----------------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------------------------
  Line   web/modules/contrib/push_notifications_registration_tokens/src/Services/ProcessTokens.php
 ------ -----------------------------------------------------------------------------------------------------------------------------
  90     Parameter #1 $value of function intval expects array|bool|float|GMP|int|resource|SimpleXMLElement|string|null, mixed given.
         🪪  argument.type
 ------ -----------------------------------------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------------------------------------------
  Line   web/modules/contrib/push_notifications_registration_tokens/submodules/firebase_php_integration/src/Form/FirebasePhpIntegrationSe
         ndMessageSingleUserForm.php
 ------ -------------------------------------------------------------------------------------------------------------------------------
  117    Parameter #1 $id of method Drupal\Core\Entity\EntityStorageInterface::load() expects int|string, mixed given.
         🪪  argument.type
  119    Part $user_value (mixed) of encapsed string cannot be cast to string.
         🪪  encapsedStringPart.nonString
  131    Parameter #2 $notification_title of method Drupal\firebase_php\FirebasePhpMessagingApiInterface::sendMessageSingleDevice()
         expects string|null, mixed given.
         🪪  argument.type
  132    Parameter #3 $notification_body of method Drupal\firebase_php\FirebasePhpMessagingApiInterface::sendMessageSingleDevice()
         expects string|null, mixed given.
         🪪  argument.type
  136    Parameter #1 $value of function intval expects array|bool|float|GMP|int|resource|SimpleXMLElement|string|null, mixed given.
         🪪  argument.type
  150    Parameter #2 $notification_title of method Drupal\firebase_php\FirebasePhpMessagingApiInterface::sendMessageMultipleDevices()
         expects string|null, mixed given.
         🪪  argument.type
  151    Parameter #3 $notification_body of method Drupal\firebase_php\FirebasePhpMessagingApiInterface::sendMessageMultipleDevices()
         expects string|null, mixed given.
         🪪  argument.type
  155    Parameter #1 $value of function intval expects array|bool|float|GMP|int|resource|SimpleXMLElement|string|null, mixed given.
         🪪  argument.type
 ------ -------------------------------------------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------------------------------------------
  Line   web/modules/contrib/push_notifications_registration_tokens/submodules/firebase_php_integration/src/Plugin/Action/RegistrationTok
         enValidateAction.php
 ------ -------------------------------------------------------------------------------------------------------------------------------
  102    Parameter #1 $token of method Drupal\firebase_php\FirebasePhpMessagingApiInterface::validateToken() expects string, mixed
         given.
         🪪  argument.type
  168    Cannot call method access() on mixed.
         🪪  method.nonObject
  169    Cannot call method access() on mixed.
         🪪  method.nonObject
  170    Cannot call method access() on mixed.
         🪪  method.nonObject
 ------ -------------------------------------------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------------------------------------------
  Line   web/modules/contrib/push_notifications_registration_tokens/submodules/jsonrpc_add_registration_token/src/Plugin/jsonrpc/Method/A
         ddPushToken.php
 ------ -------------------------------------------------------------------------------------------------------------------------------
  62     Parameter #3 $plugin_definition of class Drupal\jsonrpc_add_registration_token\Plugin\jsonrpc\Method\AddPushToken constructor
         expects Drupal\jsonrpc\MethodInterface, mixed given.
         🪪  argument.type
 ------ -------------------------------------------------------------------------------------------------------------------------------
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ptmkenny created an issue. See original summary.

ptmkenny’s picture

Title: Fix PHPStan type-safety errors » Fix PHPStan type-safety errors and require phpstan/drupal v2

  • ptmkenny committed c19d69ea on 1.0.x
    task: #3590991 Fix PHPStan type-safety errors and require phpstan/drupal...
ptmkenny’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.