Skip to content

Commit

Permalink
chore: revert 'fix: avoid deprecation messages for PHP 8.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwarishubham635 committed Jan 8, 2025
1 parent 6753a82 commit a5c6e7e
Show file tree
Hide file tree
Showing 24 changed files with 55 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
php: [ 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 ]
php: [ 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3 ]
dependencies:
- "lowest"
- "highest"
Expand Down
24 changes: 12 additions & 12 deletions src/Twilio/Base/BaseClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ class BaseClient
* @throws ConfigurationException If valid authentication is not present
*/
public function __construct(
?string $username = null,
?string $password = null,
?string $accountSid = null,
?string $region = null,
?HttpClient $httpClient = null,
?array $environment = null,
?array $userAgentExtensions = null
string $username = null,
string $password = null,
string $accountSid = null,
string $region = null,
HttpClient $httpClient = null,
array $environment = null,
array $userAgentExtensions = null
) {
$this->environment = $environment ?: \getenv();

Expand Down Expand Up @@ -119,9 +119,9 @@ public function request(
array $params = [],
array $data = [],
array $headers = [],
?string $username = null,
?string $password = null,
?int $timeout = null
string $username = null,
string $password = null,
int $timeout = null
): \Twilio\Http\Response{
$username = $username ?: $this->username;
$password = $password ?: $this->password;
Expand Down Expand Up @@ -341,7 +341,7 @@ public function getEdge(): string
*
* @param string $uri Edge to use, unsets the Edge when called with no arguments
*/
public function setEdge(?string $edge = null): void
public function setEdge(string $edge = null): void
{
$this->edge = $this->getArg($edge, self::ENV_EDGE);
}
Expand Down Expand Up @@ -381,7 +381,7 @@ public function getLogLevel(): ?string
*
* @param string $logLevel log level to use
*/
public function setLogLevel(?string $logLevel = null): void
public function setLogLevel(string $logLevel = null): void
{
$this->logLevel = $this->getArg($logLevel, self::ENV_LOG);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Twilio/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public function absoluteUrl(string $uri): string {
*/
public function request(string $method, string $uri,
array $params = [], array $data = [], array $headers = [],
?string $user = null, ?string $password = null,
?int $timeout = null): Response {
string $user = null, string $password = null,
int $timeout = null): Response {
$url = $this->absoluteUrl($uri);
return $this->client->request(
$method,
Expand Down
4 changes: 2 additions & 2 deletions src/Twilio/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
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;
string $user = null, string $password = null,
int $timeout = null): Response;
}
8 changes: 4 additions & 4 deletions src/Twilio/Http/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public function __construct(array $options = []) {

public function request(string $method, string $url,
array $params = [], array $data = [], array $headers = [],
?string $user = null, ?string $password = null,
?int $timeout = null): Response {
string $user = null, string $password = null,
int $timeout = null): Response {
$options = $this->options($method, $url, $params, $data, $headers,
$user, $password, $timeout);

Expand Down Expand Up @@ -85,8 +85,8 @@ public function request(string $method, string $url,

public function options(string $method, string $url,
array $params = [], array $data = [], array $headers = [],
?string $user = null, ?string $password = null,
?int $timeout = null): array {
string $user = null, string $password = null,
int $timeout = null): array {
$timeout = $timeout ?? self::DEFAULT_TIMEOUT;
$options = $this->curlOptions + [
CURLOPT_URL => $url,
Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/Http/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class File {
* @param string|resource|mixed|null $contents
* @param string $contentType
*/
public function __construct(string $fileName, $contents = null, ?string $contentType = null) {
public function __construct(string $fileName, $contents = null, string $contentType = null) {
$this->fileName = $fileName;
$this->contents = $contents;
$this->contentType = $contentType;
Expand Down
4 changes: 2 additions & 2 deletions src/Twilio/Http/GuzzleClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public function __construct(ClientInterface $client) {

public function request(string $method, string $url,
array $params = [], array $data = [], array $headers = [],
?string $user = null, ?string $password = null,
?int $timeout = null): Response {
string $user = null, string $password = null,
int $timeout = null): Response {
try {
$options = [
'timeout' => $timeout,
Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/Jwt/AccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AccessToken {
/** @var string[] $customClaims */
private $customClaims;

public function __construct(string $accountSid, string $signingKeySid, string $secret, int $ttl = 3600, ?string $identity = null, ?string $region = null) {
public function __construct(string $accountSid, string $signingKeySid, string $secret, int $ttl = 3600, string $identity = null, string $region = null) {
$this->signingKeySid = $signingKeySid;
$this->accountSid = $accountSid;
$this->secret = $secret;
Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/Jwt/JWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class JWT {
* @throws \DomainException
* @throws \UnexpectedValueException
*/
public static function decode(string $jwt, ?string $key = null, bool $verify = true) {
public static function decode(string $jwt, string $key = null, bool $verify = true) {
$tks = \explode('.', $jwt);
if (\count($tks) !== 3) {
throw new \UnexpectedValueException('Wrong number of segments');
Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/Jwt/TaskRouter/CapabilityToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CapabilityToken {
protected $optional = ['required' => false];

public function __construct(string $accountSid, string $authToken, string $workspaceSid, string $channelId,
?string $resourceUrl = null, ?string $overrideBaseUrl = null, ?string $overrideBaseWSUrl = null) {
string $resourceUrl = null, string $overrideBaseUrl = null, string $overrideBaseWSUrl = null) {
$this->accountSid = $accountSid;
$this->authToken = $authToken;
$this->friendlyName = $channelId;
Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/Jwt/TaskRouter/TaskQueueCapability.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class TaskQueueCapability extends CapabilityToken {
public function __construct(string $accountSid, string $authToken, string $workspaceSid, string $taskQueueSid,
?string $overrideBaseUrl = null, ?string $overrideBaseWSUrl = null) {
string $overrideBaseUrl = null, string $overrideBaseWSUrl = null) {
parent::__construct($accountSid, $authToken, $workspaceSid, $taskQueueSid, null, $overrideBaseUrl, $overrideBaseWSUrl);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/Jwt/TaskRouter/WorkerCapability.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class WorkerCapability extends CapabilityToken {
private $activityUrl;

public function __construct(string $accountSid, string $authToken, string $workspaceSid, string $workerSid,
?string $overrideBaseUrl = null, ?string $overrideBaseWSUrl = null) {
string $overrideBaseUrl = null, string $overrideBaseWSUrl = null) {
parent::__construct($accountSid, $authToken, $workspaceSid, $workerSid, null, $overrideBaseUrl, $overrideBaseWSUrl);

$this->tasksUrl = $this->baseUrl . '/Tasks/**';
Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/Jwt/TaskRouter/WorkspaceCapability.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class WorkspaceCapability extends CapabilityToken {
public function __construct(string $accountSid, string $authToken, string $workspaceSid,
?string $overrideBaseUrl = null, ?string $overrideBaseWSUrl = null) {
string $overrideBaseUrl = null, string $overrideBaseWSUrl = null) {
parent::__construct($accountSid, $authToken, $workspaceSid, $workspaceSid, null, $overrideBaseUrl, $overrideBaseWSUrl);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function hasMeta(string $key): bool {
return \array_key_exists('meta', $this->payload) && \array_key_exists($key, $this->payload['meta']);
}

protected function getMeta(string $key, ?string $default = null): ?string {
protected function getMeta(string $key, string $default = null): ?string {
return $this->hasMeta($key) ? $this->payload['meta'][$key] : $default;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/TaskRouter/WorkflowRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class WorkflowRule implements \JsonSerializable {
public $friendly_name;
public $targets;

public function __construct(string $expression, array $targets, ?string $friendly_name = null) {
public function __construct(string $expression, array $targets, string $friendly_name = null) {
$this->expression = $expression;
$this->targets = $targets;
$this->friendly_name = $friendly_name;
Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/TaskRouter/WorkflowRuleTarget.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class WorkflowRuleTarget implements \JsonSerializable {
public $priority;
public $timeout;

public function __construct(string $queue, ?int $priority = null, ?int $timeout = null, ?string $expression = null) {
public function __construct(string $queue, int $priority = null, int $timeout = null, string $expression = null) {
$this->queue = $queue;
$this->priority = $priority;
$this->timeout = $timeout;
Expand Down
2 changes: 0 additions & 2 deletions src/Twilio/TwiML/GenericNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

class GenericNode extends TwiML {

protected $value;

/**
* GenericNode constructor.
*
Expand Down
4 changes: 2 additions & 2 deletions src/Twilio/TwiML/TwiML.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class TwiML {
* @param string $value XML value
* @param array $attributes XML attributes
*/
public function __construct(string $name, ?string $value = null, array $attributes = []) {
public function __construct(string $name, string $value = null, array $attributes = []) {
$this->name = $name;
$this->attributes = $attributes;
$this->children = [];
Expand Down Expand Up @@ -73,7 +73,7 @@ public function setAttribute(string $key, string $value): TwiML {
* @param array $attributes XML attributes
* @return TwiML
*/
public function addChild(string $name, ?string $value = null, array $attributes = []): TwiML {
public function addChild(string $name, string $value = null, array $attributes = []): TwiML {
return $this->nest(new GenericNode($name, $value, $attributes));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Twilio/Values.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Values implements \ArrayAccess {
protected $options;
private static $noneConstants = array(self::NONE, self::ARRAY_NONE, self::INT_NONE, self::BOOL_NONE);

public static function array_get(array $array, string $key, ?string $default = null) {
public static function array_get(array $array, string $key, string $default = null) {
if (\array_key_exists($key, $array)) {
return $array[$key];
}
Expand Down
28 changes: 14 additions & 14 deletions src/Twilio/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public function relativeUri(string $uri): string {

public function request(string $method, string $uri,
array $params = [], array $data = [], array $headers = [],
?string $username = null, ?string $password = null,
?int $timeout = null): Response {
string $username = null, string $password = null,
int $timeout = null): Response {
$uri = $this->relativeUri($uri);
return $this->getDomain()->request(
$method,
Expand Down Expand Up @@ -96,8 +96,8 @@ protected function exception(Response $response, string $header): TwilioExceptio
*/
public function fetch(string $method, string $uri,
array $params = [], array $data = [], array $headers = [],
?string $username = null, ?string $password = null,
?int $timeout = null) {
string $username = null, string $password = null,
int $timeout = null) {
$response = $this->request(
$method,
$uri,
Expand All @@ -122,8 +122,8 @@ public function fetch(string $method, string $uri,
*/
public function update(string $method, string $uri,
array $params = [], array $data = [], array $headers = [],
?string $username = null, ?string $password = null,
?int $timeout = null) {
string $username = null, string $password = null,
int $timeout = null) {
$response = $this->request(
$method,
$uri,
Expand All @@ -147,8 +147,8 @@ public function update(string $method, string $uri,
*/
public function delete(string $method, string $uri,
array $params = [], array $data = [], array $headers = [],
?string $username = null, ?string $password = null,
?int $timeout = null): bool {
string $username = null, string $password = null,
int $timeout = null): bool {
$response = $this->request(
$method,
$uri,
Expand All @@ -167,7 +167,7 @@ public function delete(string $method, string $uri,
return $response->getStatusCode() === 204;
}

public function readLimits(?int $limit = null, ?int $pageSize = null): array {
public function readLimits(int $limit = null, int $pageSize = null): array {
if ($limit && $pageSize === null) {
$pageSize = $limit;
}
Expand All @@ -183,8 +183,8 @@ public function readLimits(?int $limit = null, ?int $pageSize = null): array {

public function page(string $method, string $uri,
array $params = [], array $data = [], array $headers = [],
?string $username = null, ?string $password = null,
?int $timeout = null): Response {
string $username = null, string $password = null,
int $timeout = null): Response {
return $this->request(
$method,
$uri,
Expand All @@ -197,7 +197,7 @@ public function page(string $method, string $uri,
);
}

public function stream(Page $page, ?int $limit = null, ?int $pageLimit = null): Stream {
public function stream(Page $page, $limit = null, $pageLimit = null): Stream {
return new Stream($page, $limit, $pageLimit);
}

Expand All @@ -206,8 +206,8 @@ public function stream(Page $page, ?int $limit = null, ?int $pageLimit = null):
*/
public function create(string $method, string $uri,
array $params = [], array $data = [], array $headers = [],
?string $username = null, ?string $password = null,
?int $timeout = null) {
string $username = null, string $password = null,
int $timeout = null) {
$response = $this->request(
$method,
$uri,
Expand Down
2 changes: 1 addition & 1 deletion tests/Bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

\error_reporting(E_ALL);
\error_reporting(E_ALL | E_STRICT);
\ini_set('display_errors', 1);

$root = \realpath(\dirname(__DIR__));
Expand Down
4 changes: 2 additions & 2 deletions tests/Twilio/Holodeck.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Holodeck implements Client {

public function request(string $method, string $url,
array $params = [], array $data = [], array $headers = [],
?string $user = null, ?string $password = null,
?int $timeout = null): Response {
string $user = null, string $password = null,
int $timeout = null): Response {
$this->requests[] = new Request($method, $url, $params, $data, $headers, $user, $password);
if (\count($this->responses) === 0) {
return new Response(404, null, null);
Expand Down
2 changes: 1 addition & 1 deletion tests/Twilio/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Request {

public function __construct(string $method, string $url,
?array $params = [], array $data = [], array $headers = [],
?string $user = null, ?string $password = null) {
string $user = null, string $password = null) {
$this->method = $method;
$this->url = $url;
$this->params = $params;
Expand Down
2 changes: 1 addition & 1 deletion tests/Twilio/Unit/ValuesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private function testPassingValues(
int $intVal = Values::INT_NONE,
bool $boolVal = Values::BOOL_NONE,
string $stringVal = Values::NONE,
?\DateTime $dateTimeVal = null
\DateTime $dateTimeVal = null
): array
{
$arr = [];
Expand Down

0 comments on commit a5c6e7e

Please sign in to comment.