Detect array_sum|product array elements of castable/non-castable types

Feature request

PHP RFC: https://wiki.php.net/rfc/saner-array-sum-product

Tests cases (not sure if exhaustive, but cover a good surface): https://phpstan.org/r/bb38fc28-28c6-4100-a8e8-e9cca45f613d

  • The ones marked invalid/undesirable emit warnings since PHP 8.3, and should be flagged (version compare: https://3v4l.org/KdkVP)
  • The ones marked valid should not be flagged
  • Same logic should apply to both array_sum and array_product

Did PHPStan help you today? Did it make you happy in any way?

No response