kreait / firebase-php

Unofficial Firebase Admin SDK for PHP
https://firebase-php.readthedocs.io/
MIT License
2.28k stars 432 forks source link

AndroidConfigShape TTL parameter has changed from string to positive-int #713

Closed nicodeboer76 closed 2 years ago

nicodeboer76 commented 2 years ago

Describe the issue you are experiencing

We use CloudMessaging to send pushnotifications in our project.

The type of the parameter 'ttl' in the AndroidConfigShape has changed from string to positive-int. But if we send the push notification with TTL as a positive-int, the push notification does not work anymore.

So we have to cast it to a string before sending it. But PHPStan complains about this:

Parameter #1 $config of static method Kreait\Firebase\Messaging\AndroidConfig::fromArray() expects array{collapse_key?: non-empty-string, priority?: 'high'|'normal', ttl?: int<1, max>, restricted_package_name?: non-empty-string, data?: array<non-empty-string, non-empty-string>, notification?: array{title?: non-empty-string, body?: non-empty-string, icon?: non-empty-string, color?: non-empty-string, sound?: non-empty-string, click_action?: non-empty-string, body_loc_key?: non-empty-string, body_loc_args?: array<int, non-empty-string>, ...}, fcm_options?: array{analytics_label?: non-empty-string}, direct_boot_ok?: bool}, array{ttl: non-empty-string, notification: array{click_action: 'FCM_PLUGIN_ACTIVITY'}} given.

Can you fix this, so we can use a string value for the TTL again, without adding exceptions to the PHPStan baseline?

Thanks!

Installed packages

adbario/php-dot-notation 3.1.1 PHP dot notation access to arrays
aws/aws-crt-php v1.0.2 AWS Common Runtime for PHP
aws/aws-sdk-php 3.229.2 AWS SDK for PHP - Use Amazon Web Services in your PHP project
beberlei/assert v3.3.2 Thin assertion library for input validation in business models.
beberlei/doctrineextensions v1.3.0 A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.
behat/gherkin v4.9.0 Gherkin DSL parser for PHP
beste/clock 2.1.0 A collection of Clock implementations
beste/json 1.0.0 A simple JSON helper to decode and encode JSON
bolivir/laravel-doctrine-sanctum v1.1.1 Laravel doctrine integration for the official laravel-sanctum package
brianium/paratest v6.4.4 Parallel testing for PHP
brick/math 0.9.3 Arbitrary-precision arithmetic library
bugsnag/bugsnag v3.28.0 Official Bugsnag notifier for PHP applications.
bugsnag/bugsnag-laravel v2.24.0 Official Bugsnag notifier for Laravel applications.
bugsnag/bugsnag-psr-logger v2.0.0 Official Bugsnag PHP PSR Logger.
cbschuld/browser.php v1.9.6 A PHP Class to detect a user's Browser. This encapsulation provides a breakdown of the browser and the version of the browser using the browser's user-agent string. Thi... cloudstek/scim-filter-parser v3.0.0 Parser for the SCIM (IETF RFC 7644, System for Cross-domain Identity Management) filter syntax.
codeception/codeception 5.0.0-RC5 BDD-style testing framework
codeception/lib-asserts 2.0.0 Assertion methods used by Codeception core and Asserts module
codeception/lib-innerbrowser 3.1.1 Parent library for all Codeception framework modules and PhpBrowser
codeception/lib-web 1.0.0 Library containing files used by module-webdriver and lib-innerbrowser or module-phpbrowser
codeception/lib-xml 1.0.0 Files used by module-rest and module-soap
codeception/module-asserts 3.0.0 Codeception module containing various assertions
codeception/module-laravel dev-codecept5 34e261a Codeception module for Laravel framework
codeception/module-rest 3.1.0 REST module for Codeception
codeception/stub 4.0.2 Flexible Stub wrapper for PHPUnit's Mock Builder
composer/ca-bundle 1.3.2 Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle. composer/pcre 3.0.0 PCRE wrapping library that offers type-safe preg_* replacements. composer/semver 3.3.1 Semver library that offers utilities, version constraint parsing and validation. composer/xdebug-handler 3.0.3 Restarts a process without Xdebug. dflydev/dot-access-data v3.0.1 Given a deep data structure, access data by dot notation. doctrine/annotations 1.13.2 Docblock Annotations Parser doctrine/cache 1.13.0 PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others. doctrine/collections 1.6.8 PHP Doctrine Collections library that adds additional functionality on top of PHP arrays. doctrine/common 3.3.0 PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies and much...
doctrine/data-fixtures 1.5.3 Data Fixtures for all Doctrine Object Managers doctrine/dbal 2.13.9 Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management. doctrine/deprecations v0.5.3 A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages. doctrine/event-manager 1.1.1 The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects. doctrine/inflector 2.0.4 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words. doctrine/instantiator 1.4.1 A small, lightweight utility to instantiate objects in PHP without invoking their constructors doctrine/lexer 1.2.3 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers. doctrine/migrations 3.4.2 PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying ch...
doctrine/orm 2.12.3 Object-Relational-Mapper for PHP doctrine/persistence 2.5.3 The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share. dragonmantank/cron-expression v3.3.1 CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due drjdr/laravel-chunk-upload 1.6.1 Service for chunked upload with several js providers egulias/email-validator 3.2.1 A library for validating emails against several RFCs evenement/evenement v3.0.1 Événement is a very simple event dispatching library for PHP ezyang/htmlpurifier v4.13.0 Standards compliant HTML filter written in PHP facade/ignition-contracts 1.0.2 Solution contracts for Ignition fakerphp/faker v1.19.0 Faker is a PHP library that generates fake data for you. fig/http-message-util 1.1.5 Utility classes and constants for use with PSR-7 (psr/http-message) filp/whoops 2.14.5 php error handling for cool kids firebase/php-jwt v6.2.0 A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec. friendsofphp/php-cs-fixer v3.8.0 A tool to automatically fix PHP code style friendsofphp/proxy-manager-lts v1.0.7 Adding support for a wider range of PHP versions to ocramius/proxy-manager fruitcake/php-cors v1.2.0 Cross-origin resource sharing library for the Symfony HttpFoundation google/auth v1.21.1 Google Auth Library for PHP google/cloud-core v1.46.1 Google Cloud PHP shared dependency, providing functionality useful to all components. google/cloud-storage v1.27.1 Cloud Storage Client for PHP google/crc32 v0.1.0 Various CRC32 implementations graham-campbell/result-type v1.0.4 An Implementation Of The Result Type guzzlehttp/guzzle 7.4.5 Guzzle is a PHP HTTP client library guzzlehttp/promises 1.5.1 Guzzle promises library guzzlehttp/psr7 2.4.0 PSR-7 message implementation that also provides common utility methods hamcrest/hamcrest-php v2.0.1 This is the PHP port of Hamcrest Matchers intervention/image 2.7.2 Image handling and manipulation library with support for Laravel integration jms/metadata 2.6.1 Class/method/property metadata management in PHP jms/serializer 3.17.1 Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML. justinrainbow/json-schema 5.2.11 A library to validate a json schema. kreait/firebase-php 6.5.1 Firebase Admin SDK kreait/firebase-tokens 3.0.2 A library to work with Firebase tokens laminas/laminas-code 4.5.1 Extensions to the PHP Reflection API, static code scanning, and code generation laravel-doctrine/extensions 1.x-dev 84941b4 Doctrine extensions for Doctrine 2 and Laravel laravel-doctrine/migrations v3.0.2 Doctrine Migrations for Laravel laravel-doctrine/orm 1.8.1 A Doctrine ORM bridge for Laravel 5 laravel/framework v9.19.0 The Laravel Framework. laravel/helpers v1.5.0 Provides backwards compatibility for helpers in the latest Laravel release. laravel/horizon v5.9.8 Dashboard and code-driven configuration for Laravel queues. laravel/sanctum v2.14.2 Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs. laravel/serializable-closure v1.2.0 Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP. laravel/tinker v2.7.2 Powerful REPL for the Laravel framework. lcobucci/clock 2.2.0 Yet another clock abstraction lcobucci/jwt 4.1.5 A simple library to work with JSON Web Token and JSON Web Signature league/commonmark 2.3.3 Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM) league/config v1.1.1 Define configuration arrays with strict schemas and access values with dot notation league/csv 9.8.0 CSV data manipulation made easy in PHP league/flysystem 3.1.0 File storage abstraction for PHP league/flysystem-aws-s3-v3 3.0.22 AWS S3 filesystem adapter for Flysystem. league/mime-type-detection 1.11.0 Mime-type detection for Flysystem messagebird/php-rest-api v1.20.0 MessageBird REST API client for PHP mews/purifier 3.3.7 Laravel 5/6/7 HtmlPurifier Package mockery/mockery 1.5.0 Mockery is a simple yet flexible PHP mock object framework monolog/monolog 2.7.0 Sends your logs to files, sockets, inboxes, databases and various web services mtdowling/jmespath.php 2.6.1 Declaratively specify how to extract elements from a JSON document myclabs/deep-copy 1.11.0 Create deep copies (clones) of your objects neomerx/json-api v4.0.1 Framework agnostic JSON API (jsonapi.org) implementation nesbot/carbon 2.59.0 An API extension for DateTime that supports 281 different languages. nette/schema v1.2.2 📐 Nette Schema: validating data structures against a given Schema. nette/tokenizer v3.1.1 Nette Tokenizer nette/utils v3.2.7 🛠 Nette Utils: lightweight utilities for string & ar ray manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.
nikic/php-parser v4.14.0 A PHP parser written in PHP nunomaduro/collision v6.2.1 Cli error handling for console/command-line PHP applications. nunomaduro/larastan v2.1.11 Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Laravel phar-io/manifest 2.0.3 Component for reading phar.io manifest information from a PHP Archive (PHAR) phar-io/version 3.2.1 Library for handling version information and constraints php-cs-fixer/diff v2.0.2 sebastian/diff v3 backport support for PHP 5.6+ php-ffmpeg/php-ffmpeg v1.0.1 FFMpeg PHP, an Object Oriented library to communicate with AVconv / ffmpeg phpdocumentor/reflection-common 2.2.0 Common reflection classes used by phpdocumentor to reflect the code structure phpdocumentor/reflection-docblock 5.3.0 With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock. phpdocumentor/type-resolver 1.6.1 A PSR-5 based resolver of Class names, Types and Structural Element Names phpmyadmin/sql-parser 5.5.0 A validating SQL lexer and parser with a focus on MySQL dialect. phpoption/phpoption 1.8.1 Option Type for PHP phpspec/prophecy v1.15.0 Highly opinionated mocking framework for PHP 5.3+ phpstan/phpdoc-parser 1.2.0 PHPDoc parser with support for nullable, intersection and generic types phpstan/phpstan 1.7.15 PHPStan - PHP Static Analysis Tool phpstan/phpstan-beberlei-assert 1.0.1 PHPStan beberlei/assert extension phpstan/phpstan-doctrine 1.3.9 Doctrine extensions for PHPStan phpunit/php-code-coverage 9.2.15 Library that provides collection, processing, and rendering functionality for PHP code coverage information. phpunit/php-file-iterator 3.0.6 FilterIterator implementation that filters files based on a list of suffixes. phpunit/php-invoker 3.1.1 Invoke callables with a timeout phpunit/php-text-template 2.0.4 Simple template engine. phpunit/php-timer 5.0.3 Utility class for timing phpunit/phpunit 9.5.21 The PHP Unit Testing framework. psr/cache 3.0.0 Common interface for caching libraries psr/container 2.0.2 Common Container Interface (PHP FIG PSR-11) psr/event-dispatcher 1.0.0 Standard interfaces for event handling. psr/http-client 1.0.1 Common interface for HTTP clients psr/http-factory 1.0.1 Common interfaces for PSR-7 HTTP message factories psr/http-message 1.0.1 Common interface for HTTP messages psr/log 3.0.0 Common interface for logging libraries psr/simple-cache 3.0.0 Common interfaces for simple caching psy/psysh v0.11.6 An interactive shell for modern PHP. ralouphie/getallheaders 3.0.3 A polyfill for getallheaders. ramsey/collection 1.2.2 A PHP library for representing and manipulating collections. ramsey/uuid 4.3.1 A PHP library for generating and working with universally unique identifiers (UUIDs). rector/rector 0.13.5 Instant Upgrade and Automated Refactoring of any PHP code riverline/multipart-parser 2.0.9 One class library to parse multipart content with encoding and charset support. rize/uri-template 0.3.4 PHP URI Template (RFC 6570) supports both expansion & extraction sebastian/cli-parser 1.0.1 Library for parsing CLI options sebastian/code-unit 1.0.8 Collection of value objects that represent the PHP code units sebastian/code-unit-reverse-lookup 2.0.3 Looks up which function or method a line of code belongs to sebastian/comparator 4.0.6 Provides the functionality to compare PHP values for equality sebastian/complexity 2.0.2 Library for calculating the complexity of PHP code units sebastian/diff 4.0.4 Diff implementation sebastian/environment 5.1.4 Provides functionality to handle HHVM/PHP environments sebastian/exporter 4.0.4 Provides the functionality to export PHP variables for visualization sebastian/global-state 5.0.5 Snapshotting of global state sebastian/lines-of-code 1.0.3 Library for counting the lines of code in PHP source code sebastian/object-enumerator 4.0.4 Traverses array structures and object graphs to enumerate all referenced objects sebastian/object-reflector 2.0.4 Allows reflection of object attributes, including inherited and non-public ones sebastian/recursion-context 4.0.4 Provides functionality to recursively process PHP variables sebastian/resource-operations 3.0.3 Provides a list of PHP built-in functions that operate on resources sebastian/type 3.0.0 Collection of value objects that represent the types of the PHP type system sebastian/version 3.0.2 Library that helps with managing the version number of Git-hosted PHP projects softcreatr/jsonpath 0.8.0 JSONPath implementation for parsing, searching and flattening arrays spatie/backtrace 1.2.1 A better backtrace spatie/flare-client-php 1.2.0 Send PHP errors to Flare spatie/ignition 1.3.1 A beautiful error page for PHP applications. spatie/laravel-ignition 1.3.1 A beautiful error page for Laravel applications. spatie/temporary-directory 2.1.0 Easily create, use and destroy temporary directories stella-maris/clock 0.1.4 A pre-release of the proposed PSR-20 Clock-Interface symfony/browser-kit v6.0.3 Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically symfony/cache v6.0.6 Provides an extended PSR-6, PSR-16 (and tags) implementation symfony/cache-contracts v3.1.1 Generic abstractions related to caching symfony/console v6.1.2 Eases the creation of beautiful and testable command line interfaces symfony/css-selector v6.1.0 Converts CSS selectors to XPath expressions symfony/deprecation-contracts v3.1.1 A generic function and convention to trigger deprecation notices symfony/dom-crawler v6.0.6 Eases DOM navigation for HTML and XML documents symfony/error-handler v6.1.0 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher v6.1.0 Provides tools that allow your application components to communicate with each other by dispatching events and listening to them symfony/event-dispatcher-contracts v3.1.1 Generic abstractions related to dispatching event symfony/filesystem v6.0.6 Provides basic utilities for the filesystem symfony/finder v6.1.0 Finds files and directories via an intuitive fluent interface symfony/http-foundation v6.1.2 Defines an object-oriented layer for the HTTP specification symfony/http-kernel v6.1.2 Provides a structured process for converting a Request into a Response symfony/mailer v6.1.2 Helps sending emails symfony/mime v6.1.1 Allows manipulating MIME messages symfony/options-resolver v6.0.3 Provides an improved replacement for the arrayreplace PHP function symfony/polyfill-ctype v1.26.0 Symfony polyfill for ctype functions symfony/polyfill-intl-grapheme v1.26.0 Symfony polyfill for intl's grapheme* functions symfony/polyfill-intl-idn v1.26.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer v1.26.0 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring v1.26.0 Symfony polyfill for the Mbstring extension symfony/polyfill-php72 v1.26.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions symfony/polyfill-php80 v1.26.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions symfony/polyfill-php81 v1.26.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions symfony/process v6.1.0 Executes commands in sub-processes symfony/routing v6.1.1 Maps an HTTP request to a set of configuration variables symfony/serializer v6.1.2 Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON. symfony/service-contracts v3.1.1 Generic abstractions related to writing services symfony/stopwatch v6.0.5 Provides a way to profile code symfony/string v6.1.2 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way symfony/translation v6.1.0 Provides tools to internationalize your application symfony/translation-contracts v3.1.1 Generic abstractions related to translation symfony/var-dumper v6.1.0 Provides mechanisms for walking through any arbitrary PHP variable symfony/var-exporter v6.0.6 Allows exporting any serializable PHP data structure to plain PHP code symfony/yaml v6.1.2 Loads and dumps YAML files theseer/tokenizer 1.2.1 A small library for converting tokenized PHP source code into XML and potentially other formats tijsverkoyen/css-to-inline-styles 2.2.4 CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails. vlucas/phpdotenv v5.4.1 Loads environment variables from .env to getenv(), $_ENV and $_SERVER automagically. voku/portable-ascii 2.0.1 Portable ASCII library - performance optimized (ascii) string functions for php. webmozart/assert 1.11.0 Assertions to validate method input/output with nice error messages.

PHP version and extensions

composer 2.3.8 Composer package composer-plugin-api 2.3.0 The Composer Plugin API composer-runtime-api 2.2.2 The Composer Runtime API ext-bcmath 8.1.7 The bcmath PHP extension ext-calendar 8.1.7 The calendar PHP extension ext-ctype 8.1.7 The ctype PHP extension ext-curl 8.1.7 The curl PHP extension ext-date 8.1.7 The date PHP extension ext-dom 20031129 The dom PHP extension ext-exif 8.1.7 The exif PHP extension ext-ffi 8.1.7 The FFI PHP extension ext-fileinfo 8.1.7 The fileinfo PHP extension ext-filter 8.1.7 The filter PHP extension ext-ftp 8.1.7 The ftp PHP extension ext-gd 8.1.7 The gd PHP extension ext-gettext 8.1.7 The gettext PHP extension ext-hash 8.1.7 The hash PHP extension ext-iconv 8.1.7 The iconv PHP extension ext-igbinary 3.2.6 The igbinary PHP extension ext-imagick 0 The imagick PHP extension (actual version: @PACKAGE_VERSION@) ext-intl 8.1.7 The intl PHP extension ext-json 8.1.7 The json PHP extension ext-libxml 8.1.7 The libxml PHP extension ext-mbstring 8.1.7 The mbstring PHP extension ext-memcached 3.2.0 The memcached PHP extension ext-msgpack 2.2.0RC1 The msgpack PHP extension ext-mysqli 8.1.7 The mysqli PHP extension ext-mysqlnd 0 The mysqlnd PHP extension (actual version: mysqlnd 8.1.7) ext-openssl 8.1.7 The openssl PHP extension ext-pcntl 8.1.7 The pcntl PHP extension ext-pcre 8.1.7 The pcre PHP extension ext-pdo 8.1.7 The PDO PHP extension ext-pdo_mysql 8.1.7 The pdo_mysql PHP extension ext-pdo_pgsql 8.1.7 The pdo_pgsql PHP extension ext-pdo_sqlite 8.1.7 The pdo_sqlite PHP extension ext-pgsql 8.1.7 The pgsql PHP extension ext-phar 8.1.7 The Phar PHP extension ext-posix 8.1.7 The posix PHP extension ext-readline 8.1.7 The readline PHP extension ext-redis 5.3.7 The redis PHP extension ext-reflection 8.1.7 The Reflection PHP extension ext-session 8.1.7 The session PHP extension ext-shmop 8.1.7 The shmop PHP extension ext-simplexml 8.1.7 The SimpleXML PHP extension ext-sockets 8.1.7 The sockets PHP extension ext-sodium 8.1.7 The sodium PHP extension ext-spl 8.1.7 The SPL PHP extension ext-sqlite3 8.1.7 The sqlite3 PHP extension ext-sysvmsg 8.1.7 The sysvmsg PHP extension ext-sysvsem 8.1.7 The sysvsem PHP extension ext-sysvshm 8.1.7 The sysvshm PHP extension ext-tokenizer 8.1.7 The tokenizer PHP extension ext-xml 8.1.7 The xml PHP extension ext-xmlreader 8.1.7 The xmlreader PHP extension ext-xmlwriter 8.1.7 The xmlwriter PHP extension ext-xsl 8.1.7 The xsl PHP extension ext-zend-opcache 8.1.7 The Zend OPcache PHP extension ext-zip 1.19.5 The zip PHP extension ext-zlib 8.1.7 The zlib PHP extension lib-curl 7.68.0 The curl library lib-curl-libssh 0.9.3 curl libssh version lib-curl-openssl 1.1.1.6 curl OpenSSL version (1.1.1.6) lib-curl-zlib 1.2.11 curl zlib version lib-date-timelib 2021.12 date timelib version lib-date-zoneinfo 0 zoneinfo ("Olson") database for date lib-fileinfo-libmagic 540 fileinfo libmagic version lib-gd 2.3.0 The gd library lib-iconv 2.31 The iconv library lib-icu 66.1 The ICU unicode and globalization support library lib-icu-cldr 36.1 ICU CLDR project version lib-icu-unicode 13.0.0 ICU unicode version lib-imagick-imagemagick 6.9.10.23 The imagick-imagemagick library lib-libsodium 1.0.18 The libsodium library lib-libxml 2.9.14 libxml library version lib-libxslt 1.1.34 The libxslt library lib-libxslt-libxml 2.9.10 libxml version libxslt is compiled against lib-mbstring-libmbfl 1.3.2 mbstring libmbfl version lib-mbstring-oniguruma 6.9.4 mbstring oniguruma version lib-memcached-libmemcached 1.0.18 libmemcached version lib-openssl 1.1.1.6 OpenSSL 1.1.1f 31 Mar 2020 lib-pcre 10.39 The pcre library lib-pcre-unicode 14.0.0 PCRE Unicode version support lib-pdo_pgsql-libpq 12.9 libpq for pdo_pgsql lib-pdo_sqlite-sqlite 3.31.1 The pdo_sqlite-sqlite library lib-sqlite3-sqlite 3.31.1 The sqlite3-sqlite library lib-zip-libzip 1.7.3 The zip-libzip library lib-zlib 1.2.11 The zlib library php 8.1.7 The PHP interpreter php-64bit 8.1.7 The PHP interpreter, 64bit php-ipv6 8.1.7 The PHP interpreter, with IPv6 support

On which operating system(s) does the issue occur?

Steps to reproduce the issue.

  1. ...
  2. ...
  3. ...
use Kreait\Firebase\Exception\FirebaseException;
use Kreait\Firebase\Exception\MessagingException;
use Kreait\Firebase\Factory;
use Kreait\Firebase\Messaging;
use Kreait\Firebase\Messaging\AndroidConfig;
use Kreait\Firebase\Messaging\ApnsConfig;
use Kreait\Firebase\Messaging\CloudMessage;
use Kreait\Firebase\Messaging\MessageData;
use Kreait\Firebase\Messaging\Notification;
use Kreait\Firebase\Messaging\WebPushConfig;

    /**
     * @param array<string, string> $additionalData
     * @param array<string>         $tokens
     * @param positive-int          $ttl
     *
     * @throws FirebaseException
     * @throws MessagingException
     */
    private function sendBulkPushNotification(
        Messaging $messaging,
        Notification $notification,
        array $additionalData,
        array $tokens,
        int $ttl
    ): Messaging\MulticastSendReport {
        $androidConfig = AndroidConfig::fromArray([
            'ttl' => $ttl,
            'notification' => [
                'click_action' => 'FCM_PLUGIN_ACTIVITY',
            ],
        ]);

        $expirationDate = time() + $ttl;
        $apnsConfig = ApnsConfig::fromArray([
            'headers' => [
                'apns-expiration' => (string) $expirationDate,
            ],
        ]);

        $webPushConfig = WebPushConfig::fromArray([
            'headers' => [
                'TTL' => $ttl,
            ],
        ]);

        $message = CloudMessage::new()->withData(MessageData::fromArray($additionalData))
            ->withAndroidConfig($androidConfig)
            ->withApnsConfig($apnsConfig)
            ->withWebPushConfig($webPushConfig)
            ->withNotification($notification);

        return $messaging->sendMulticast($message, $tokens);
    }

Error message/Stack trace

PHPStan message:

Parameter #1 $config of static method Kreait\Firebase\Messaging\AndroidConfig::fromArray() expects array{collapse_key?: non-empty-string, priority?: 'high'|'normal', ttl?: int<1, max>, restricted_package_name?: non-empty-string, data?: array<non-empty-string, non-empty-string>, notification?: array{title?: non-empty-string, body?: non-empty-string, icon?: non-empty-string, color?: non-empty-string, sound?: non-empty-string, click_action?: non-empty-string, body_loc_key?: non-empty-string, body_loc_args?: array<int, non-empty-string>, ...}, fcm_options?: array{analytics_label?: non-empty-string}, direct_boot_ok?: bool}, array{ttl: non-empty-string, notification: array{click_action: 'FCM_PLUGIN_ACTIVITY'}} given.

Additional information

No response

jeromegamez commented 2 years ago

@nicodeboer76 Thank you for reporting this! Could you have a look at https://github.com/kreait/firebase-php/pull/714 and confirm that it works for you? If yes 🤞, I'll merge it and create a new release afterward.