Skip to content

PHP 8.4 deprecation "Implicitly marking parameter as nullable" #835

@adrianbj

Description

@adrianbj

Issue Summary

There are several instances of this deprecation warning. Given that you still want to support PHP 7.2, the solution is to use the question mark solution rather than union types (which aren't supported until PHP 8).

eg:

interface Client {
    public function request(string $method, string $url,
                            array $params = [], array $data = [], array $headers = [],
                            ?string $user = null, ?string $password = null,
                            ?int $timeout = null): Response;
} 

Steps to Reproduce

  1. Use the library on PHP 8.4

Exception/Log

PHP Deprecated: Twilio\Base\BaseClient::__construct(): Implicitly marking parameter $username as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Base/BaseClient.php:51 
PHP Deprecated: Twilio\Base\BaseClient::__construct(): Implicitly marking parameter $password as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Base/BaseClient.php:0 
PHP Deprecated: Twilio\Base\BaseClient::__construct(): Implicitly marking parameter $accountSid as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Base/BaseClient.php:0 
PHP Deprecated: Twilio\Base\BaseClient::__construct(): Implicitly marking parameter $region as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Base/BaseClient.php:0 
PHP Deprecated: Twilio\Base\BaseClient::__construct(): Implicitly marking parameter $httpClient as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Base/BaseClient.php:0 
PHP Deprecated: Twilio\Base\BaseClient::__construct(): Implicitly marking parameter $environment as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Base/BaseClient.php:0 
PHP Deprecated: Twilio\Base\BaseClient::__construct(): Implicitly marking parameter $userAgentExtensions as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Base/BaseClient.php:0 
PHP Deprecated: Twilio\Base\BaseClient::request(): Implicitly marking parameter $username as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Base/BaseClient.php:116 
PHP Deprecated: Twilio\Base\BaseClient::request(): Implicitly marking parameter $password as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Base/BaseClient.php:116 
PHP Deprecated: Twilio\Base\BaseClient::request(): Implicitly marking parameter $timeout as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Base/BaseClient.php:116 
PHP Deprecated: Twilio\Base\BaseClient::setEdge(): Implicitly marking parameter $edge as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Base/BaseClient.php:344 
PHP Deprecated: Twilio\Base\BaseClient::setLogLevel(): Implicitly marking parameter $logLevel as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Base/BaseClient.php:384 
PHP Deprecated: Twilio\Http\CurlClient::request(): Implicitly marking parameter $user as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Http/CurlClient.php:21 
PHP Deprecated: Twilio\Http\CurlClient::request(): Implicitly marking parameter $password as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Http/CurlClient.php:21 
PHP Deprecated: Twilio\Http\CurlClient::request(): Implicitly marking parameter $timeout as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Http/CurlClient.php:21 
PHP Deprecated: Twilio\Http\CurlClient::options(): Implicitly marking parameter $user as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Http/CurlClient.php:86 
PHP Deprecated: Twilio\Http\CurlClient::options(): Implicitly marking parameter $password as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Http/CurlClient.php:86 
PHP Deprecated: Twilio\Http\CurlClient::options(): Implicitly marking parameter $timeout as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Http/CurlClient.php:86 
PHP Deprecated: Twilio\Http\Client::request(): Implicitly marking parameter $user as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Http/Client.php:8 
PHP Deprecated: Twilio\Http\Client::request(): Implicitly marking parameter $password as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Http/Client.php:8 
PHP Deprecated: Twilio\Http\Client::request(): Implicitly marking parameter $timeout as nullable is deprecated, the explicit nullable type must be used instead in twilio/sdk/src/Twilio/Http/Client.php:8 

Technical details:

  • twilio-php version: 8.3.9
  • php version: 8.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciespull requests that update a dependency filepriority: highNeeds immediate attention; blockers or critical or bugtype: twilio enhancementfeature request on Twilio's roadmap

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions