From 784287864ff144c8d4be5003b067402fb91ad73e Mon Sep 17 00:00:00 2001 From: Bruce Wells Date: Thu, 21 Nov 2024 22:15:54 -0500 Subject: [PATCH 1/8] Parameters with a default of null must allow null type --- src/Twilio/Base/BaseClient.php | 24 ++++++++-------- src/Twilio/Domain.php | 4 +-- src/Twilio/Http/Client.php | 4 +-- src/Twilio/Http/CurlClient.php | 8 +++--- src/Twilio/Http/File.php | 2 +- src/Twilio/Http/GuzzleClient.php | 4 +-- src/Twilio/Jwt/AccessToken.php | 2 +- src/Twilio/Jwt/JWT.php | 2 +- src/Twilio/Jwt/TaskRouter/CapabilityToken.php | 2 +- .../Jwt/TaskRouter/TaskQueueCapability.php | 2 +- .../Jwt/TaskRouter/WorkerCapability.php | 2 +- .../Jwt/TaskRouter/WorkspaceCapability.php | 2 +- src/Twilio/Page.php | 2 +- src/Twilio/TaskRouter/WorkflowRule.php | 2 +- src/Twilio/TaskRouter/WorkflowRuleTarget.php | 2 +- src/Twilio/TwiML/GenericNode.php | 2 ++ src/Twilio/TwiML/TwiML.php | 4 +-- src/Twilio/Values.php | 2 +- src/Twilio/Version.php | 28 +++++++++---------- tests/Twilio/Holodeck.php | 4 +-- tests/Twilio/Request.php | 2 +- tests/Twilio/Unit/ValuesTest.php | 2 +- 22 files changed, 55 insertions(+), 53 deletions(-) diff --git a/src/Twilio/Base/BaseClient.php b/src/Twilio/Base/BaseClient.php index d19fdb2db1..7ec0f35ca4 100644 --- a/src/Twilio/Base/BaseClient.php +++ b/src/Twilio/Base/BaseClient.php @@ -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(); @@ -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; @@ -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); } @@ -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); } diff --git a/src/Twilio/Domain.php b/src/Twilio/Domain.php index cbf6dd263a..82bc66db9f 100644 --- a/src/Twilio/Domain.php +++ b/src/Twilio/Domain.php @@ -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, diff --git a/src/Twilio/Http/Client.php b/src/Twilio/Http/Client.php index 9f3d103226..eb11478cb8 100644 --- a/src/Twilio/Http/Client.php +++ b/src/Twilio/Http/Client.php @@ -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; } diff --git a/src/Twilio/Http/CurlClient.php b/src/Twilio/Http/CurlClient.php index aaf99f2aaf..8000376895 100644 --- a/src/Twilio/Http/CurlClient.php +++ b/src/Twilio/Http/CurlClient.php @@ -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); @@ -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, diff --git a/src/Twilio/Http/File.php b/src/Twilio/Http/File.php index 304e772137..3fffb873c3 100644 --- a/src/Twilio/Http/File.php +++ b/src/Twilio/Http/File.php @@ -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, mixed $contents = null, ?string $contentType = null) { $this->fileName = $fileName; $this->contents = $contents; $this->contentType = $contentType; diff --git a/src/Twilio/Http/GuzzleClient.php b/src/Twilio/Http/GuzzleClient.php index 8b88b09f8c..fe070165e1 100644 --- a/src/Twilio/Http/GuzzleClient.php +++ b/src/Twilio/Http/GuzzleClient.php @@ -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, diff --git a/src/Twilio/Jwt/AccessToken.php b/src/Twilio/Jwt/AccessToken.php index 4ac8a3f43f..223101062c 100644 --- a/src/Twilio/Jwt/AccessToken.php +++ b/src/Twilio/Jwt/AccessToken.php @@ -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; diff --git a/src/Twilio/Jwt/JWT.php b/src/Twilio/Jwt/JWT.php index 8e1cbd24ce..3d14f83c68 100644 --- a/src/Twilio/Jwt/JWT.php +++ b/src/Twilio/Jwt/JWT.php @@ -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'); diff --git a/src/Twilio/Jwt/TaskRouter/CapabilityToken.php b/src/Twilio/Jwt/TaskRouter/CapabilityToken.php index e2ed051c7c..3136ab13e4 100644 --- a/src/Twilio/Jwt/TaskRouter/CapabilityToken.php +++ b/src/Twilio/Jwt/TaskRouter/CapabilityToken.php @@ -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; diff --git a/src/Twilio/Jwt/TaskRouter/TaskQueueCapability.php b/src/Twilio/Jwt/TaskRouter/TaskQueueCapability.php index 51ca2d08fe..ce7eaef066 100644 --- a/src/Twilio/Jwt/TaskRouter/TaskQueueCapability.php +++ b/src/Twilio/Jwt/TaskRouter/TaskQueueCapability.php @@ -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); } diff --git a/src/Twilio/Jwt/TaskRouter/WorkerCapability.php b/src/Twilio/Jwt/TaskRouter/WorkerCapability.php index 2bde217bbe..50fc981068 100644 --- a/src/Twilio/Jwt/TaskRouter/WorkerCapability.php +++ b/src/Twilio/Jwt/TaskRouter/WorkerCapability.php @@ -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/**'; diff --git a/src/Twilio/Jwt/TaskRouter/WorkspaceCapability.php b/src/Twilio/Jwt/TaskRouter/WorkspaceCapability.php index c644ec1667..64e198d572 100644 --- a/src/Twilio/Jwt/TaskRouter/WorkspaceCapability.php +++ b/src/Twilio/Jwt/TaskRouter/WorkspaceCapability.php @@ -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); } diff --git a/src/Twilio/Page.php b/src/Twilio/Page.php index df59add088..74bae62d42 100644 --- a/src/Twilio/Page.php +++ b/src/Twilio/Page.php @@ -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; } diff --git a/src/Twilio/TaskRouter/WorkflowRule.php b/src/Twilio/TaskRouter/WorkflowRule.php index 0183882ecc..07ae386c49 100644 --- a/src/Twilio/TaskRouter/WorkflowRule.php +++ b/src/Twilio/TaskRouter/WorkflowRule.php @@ -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; diff --git a/src/Twilio/TaskRouter/WorkflowRuleTarget.php b/src/Twilio/TaskRouter/WorkflowRuleTarget.php index c84fbbcdfc..d9a13b03fd 100644 --- a/src/Twilio/TaskRouter/WorkflowRuleTarget.php +++ b/src/Twilio/TaskRouter/WorkflowRuleTarget.php @@ -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; diff --git a/src/Twilio/TwiML/GenericNode.php b/src/Twilio/TwiML/GenericNode.php index 6eead6c879..0d6efb7ef4 100644 --- a/src/Twilio/TwiML/GenericNode.php +++ b/src/Twilio/TwiML/GenericNode.php @@ -4,6 +4,8 @@ class GenericNode extends TwiML { + protected $value; + /** * GenericNode constructor. * diff --git a/src/Twilio/TwiML/TwiML.php b/src/Twilio/TwiML/TwiML.php index 6e8ceb4a79..d8715201c8 100644 --- a/src/Twilio/TwiML/TwiML.php +++ b/src/Twilio/TwiML/TwiML.php @@ -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 = []; @@ -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)); } diff --git a/src/Twilio/Values.php b/src/Twilio/Values.php index 7d6ba964c5..c4ea33b65d 100644 --- a/src/Twilio/Values.php +++ b/src/Twilio/Values.php @@ -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]; } diff --git a/src/Twilio/Version.php b/src/Twilio/Version.php index d0ede2f247..5b2f274113 100644 --- a/src/Twilio/Version.php +++ b/src/Twilio/Version.php @@ -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, @@ -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, @@ -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, @@ -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, @@ -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; } @@ -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, @@ -197,7 +197,7 @@ public function page(string $method, string $uri, ); } - public function stream(Page $page, $limit = null, $pageLimit = null): Stream { + public function stream(Page $page, ?int $limit = null, ?int $pageLimit = null): Stream { return new Stream($page, $limit, $pageLimit); } @@ -206,8 +206,8 @@ public function stream(Page $page, $limit = null, $pageLimit = null): Stream { */ 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, diff --git a/tests/Twilio/Holodeck.php b/tests/Twilio/Holodeck.php index abccbcf7bb..962ac8fb63 100644 --- a/tests/Twilio/Holodeck.php +++ b/tests/Twilio/Holodeck.php @@ -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); diff --git a/tests/Twilio/Request.php b/tests/Twilio/Request.php index 9d939ffd0f..b3fa14719f 100644 --- a/tests/Twilio/Request.php +++ b/tests/Twilio/Request.php @@ -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; diff --git a/tests/Twilio/Unit/ValuesTest.php b/tests/Twilio/Unit/ValuesTest.php index 70f73163f1..a870fa386e 100644 --- a/tests/Twilio/Unit/ValuesTest.php +++ b/tests/Twilio/Unit/ValuesTest.php @@ -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 = []; From aa90ec7551f6efb93a7da5723333f54fdc1b3598 Mon Sep 17 00:00:00 2001 From: Bruce Wells Date: Thu, 21 Nov 2024 22:16:54 -0500 Subject: [PATCH 2/8] assertObjectNotHasAttribute to assertObjectNotHasProperty --- .../Jwt/TaskRouter/CapabilityTokenTest.php | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/Twilio/Unit/Jwt/TaskRouter/CapabilityTokenTest.php b/tests/Twilio/Unit/Jwt/TaskRouter/CapabilityTokenTest.php index c89f32221f..6e78fc8a2e 100644 --- a/tests/Twilio/Unit/Jwt/TaskRouter/CapabilityTokenTest.php +++ b/tests/Twilio/Unit/Jwt/TaskRouter/CapabilityTokenTest.php @@ -28,38 +28,38 @@ public function testDefaultWorker(): void { $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WK789', $policies[0]->url); $this->assertEquals('GET', $policies[0]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[0]); - $this->assertObjectNotHasAttribute('post_filter', $policies[0]); + $this->assertObjectNotHasProperty('query_filter', $policies[0]); + $this->assertObjectNotHasProperty('post_filter', $policies[0]); $this->assertEquals(true, $policies[0]->allow); $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WK789', $policies[1]->url); $this->assertEquals('POST', $policies[1]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[1]); - $this->assertObjectNotHasAttribute('post_filter', $policies[1]); + $this->assertObjectNotHasProperty('query_filter', $policies[1]); + $this->assertObjectNotHasProperty('post_filter', $policies[1]); $this->assertEquals(true, $policies[1]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456/Workers/WK789', $policies[2]->url); $this->assertEquals('GET', $policies[2]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[2]); - $this->assertObjectNotHasAttribute('post_filter', $policies[2]); + $this->assertObjectNotHasProperty('query_filter', $policies[2]); + $this->assertObjectNotHasProperty('post_filter', $policies[2]); $this->assertEquals(true, $policies[2]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456/Activities', $policies[3]->url); $this->assertEquals('GET', $policies[3]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[3]); - $this->assertObjectNotHasAttribute('post_filter', $policies[3]); + $this->assertObjectNotHasProperty('query_filter', $policies[3]); + $this->assertObjectNotHasProperty('post_filter', $policies[3]); $this->assertEquals(true, $policies[3]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456/Tasks/**', $policies[4]->url); $this->assertEquals('GET', $policies[4]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[4]); - $this->assertObjectNotHasAttribute('post_filter', $policies[4]); + $this->assertObjectNotHasProperty('query_filter', $policies[4]); + $this->assertObjectNotHasProperty('post_filter', $policies[4]); $this->assertEquals(true, $policies[4]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456/Workers/WK789/Reservations/**', $policies[5]->url); $this->assertEquals('GET', $policies[5]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[5]); - $this->assertObjectNotHasAttribute('post_filter', $policies[5]); + $this->assertObjectNotHasProperty('query_filter', $policies[5]); + $this->assertObjectNotHasProperty('post_filter', $policies[5]); $this->assertEquals(true, $policies[5]->allow); } @@ -132,20 +132,20 @@ public function testDefaultWorkspace(): void { $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WS456', $policies[0]->url); $this->assertEquals('GET', $policies[0]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[0]); - $this->assertObjectNotHasAttribute('post_filter', $policies[0]); + $this->assertObjectNotHasProperty('query_filter', $policies[0]); + $this->assertObjectNotHasProperty('post_filter', $policies[0]); $this->assertEquals(true, $policies[0]->allow); $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WS456', $policies[1]->url); $this->assertEquals('POST', $policies[1]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[1]); - $this->assertObjectNotHasAttribute('post_filter', $policies[1]); + $this->assertObjectNotHasProperty('query_filter', $policies[1]); + $this->assertObjectNotHasProperty('post_filter', $policies[1]); $this->assertEquals(true, $policies[1]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456', $policies[2]->url); $this->assertEquals('GET', $policies[2]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[2]); - $this->assertObjectNotHasAttribute('post_filter', $policies[2]); + $this->assertObjectNotHasProperty('query_filter', $policies[2]); + $this->assertObjectNotHasProperty('post_filter', $policies[2]); $this->assertEquals(true, $policies[2]->allow); } @@ -166,20 +166,20 @@ public function testWorkspaceFetchAll(): void { $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WS456', $policies[0]->url); $this->assertEquals('GET', $policies[0]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[0]); - $this->assertObjectNotHasAttribute('post_filter', $policies[0]); + $this->assertObjectNotHasProperty('query_filter', $policies[0]); + $this->assertObjectNotHasProperty('post_filter', $policies[0]); $this->assertEquals(true, $policies[0]->allow); $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WS456', $policies[1]->url); $this->assertEquals('POST', $policies[1]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[1]); - $this->assertObjectNotHasAttribute('post_filter', $policies[1]); + $this->assertObjectNotHasProperty('query_filter', $policies[1]); + $this->assertObjectNotHasProperty('post_filter', $policies[1]); $this->assertEquals(true, $policies[1]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456', $policies[2]->url); $this->assertEquals('GET', $policies[2]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[2]); - $this->assertObjectNotHasAttribute('post_filter', $policies[2]); + $this->assertObjectNotHasProperty('query_filter', $policies[2]); + $this->assertObjectNotHasProperty('post_filter', $policies[2]); $this->assertEquals(true, $policies[2]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456/**', $policies[3]->url); @@ -206,20 +206,20 @@ public function testDefaultTaskQueue(): void { $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WQ789', $policies[0]->url); $this->assertEquals('GET', $policies[0]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[0]); - $this->assertObjectNotHasAttribute('post_filter', $policies[0]); + $this->assertObjectNotHasProperty('query_filter', $policies[0]); + $this->assertObjectNotHasProperty('post_filter', $policies[0]); $this->assertEquals(true, $policies[0]->allow); $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WQ789', $policies[1]->url); $this->assertEquals('POST', $policies[1]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[1]); - $this->assertObjectNotHasAttribute('post_filter', $policies[1]); + $this->assertObjectNotHasProperty('query_filter', $policies[1]); + $this->assertObjectNotHasProperty('post_filter', $policies[1]); $this->assertEquals(true, $policies[1]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456/TaskQueues/WQ789', $policies[2]->url); $this->assertEquals('GET', $policies[2]->method); - $this->assertObjectNotHasAttribute('query_filter', $policies[2]); - $this->assertObjectNotHasAttribute('post_filter', $policies[2]); + $this->assertObjectNotHasProperty('query_filter', $policies[2]); + $this->assertObjectNotHasProperty('post_filter', $policies[2]); $this->assertEquals(true, $policies[2]->allow); } } From 1f25f818be45de26a4eefccb0017207161fa2e3c Mon Sep 17 00:00:00 2001 From: Bruce Wells Date: Thu, 21 Nov 2024 22:17:10 -0500 Subject: [PATCH 3/8] E_STRICT depreciated --- tests/Bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 62a676edc0..ea0e814478 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -1,6 +1,6 @@ Date: Thu, 21 Nov 2024 22:28:43 -0500 Subject: [PATCH 4/8] Remove mixed type for 7.1 compatibilty --- src/Twilio/Http/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Twilio/Http/File.php b/src/Twilio/Http/File.php index 3fffb873c3..0fc61d5e97 100644 --- a/src/Twilio/Http/File.php +++ b/src/Twilio/Http/File.php @@ -24,7 +24,7 @@ final class File { * @param string|resource|mixed|null $contents * @param string $contentType */ - public function __construct(string $fileName, mixed $contents = null, ?string $contentType = null) { + public function __construct(string $fileName, $contents = null, ?string $contentType = null) { $this->fileName = $fileName; $this->contents = $contents; $this->contentType = $contentType; From acea5b000b8f5b57d766500308daa0893a4e8cd7 Mon Sep 17 00:00:00 2001 From: Bruce Wells Date: Thu, 21 Nov 2024 22:38:05 -0500 Subject: [PATCH 5/8] Correct indentation --- src/Twilio/TwiML/GenericNode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Twilio/TwiML/GenericNode.php b/src/Twilio/TwiML/GenericNode.php index 0d6efb7ef4..6e22a1fee3 100644 --- a/src/Twilio/TwiML/GenericNode.php +++ b/src/Twilio/TwiML/GenericNode.php @@ -4,7 +4,7 @@ class GenericNode extends TwiML { - protected $value; + protected $value; /** * GenericNode constructor. From a36234c4e858ae87ad07d73f09b6bfd8f6b2287e Mon Sep 17 00:00:00 2001 From: Bruce Wells Date: Thu, 5 Dec 2024 14:04:55 -0500 Subject: [PATCH 6/8] Revert "assertObjectNotHasAttribute to assertObjectNotHasProperty" This reverts commit aa90ec7551f6efb93a7da5723333f54fdc1b3598. fix: Reverted depreciation change for PHPUnit fix: PHP 8.4 support added --- .../Jwt/TaskRouter/CapabilityTokenTest.php | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/Twilio/Unit/Jwt/TaskRouter/CapabilityTokenTest.php b/tests/Twilio/Unit/Jwt/TaskRouter/CapabilityTokenTest.php index 6e78fc8a2e..c89f32221f 100644 --- a/tests/Twilio/Unit/Jwt/TaskRouter/CapabilityTokenTest.php +++ b/tests/Twilio/Unit/Jwt/TaskRouter/CapabilityTokenTest.php @@ -28,38 +28,38 @@ public function testDefaultWorker(): void { $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WK789', $policies[0]->url); $this->assertEquals('GET', $policies[0]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[0]); - $this->assertObjectNotHasProperty('post_filter', $policies[0]); + $this->assertObjectNotHasAttribute('query_filter', $policies[0]); + $this->assertObjectNotHasAttribute('post_filter', $policies[0]); $this->assertEquals(true, $policies[0]->allow); $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WK789', $policies[1]->url); $this->assertEquals('POST', $policies[1]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[1]); - $this->assertObjectNotHasProperty('post_filter', $policies[1]); + $this->assertObjectNotHasAttribute('query_filter', $policies[1]); + $this->assertObjectNotHasAttribute('post_filter', $policies[1]); $this->assertEquals(true, $policies[1]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456/Workers/WK789', $policies[2]->url); $this->assertEquals('GET', $policies[2]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[2]); - $this->assertObjectNotHasProperty('post_filter', $policies[2]); + $this->assertObjectNotHasAttribute('query_filter', $policies[2]); + $this->assertObjectNotHasAttribute('post_filter', $policies[2]); $this->assertEquals(true, $policies[2]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456/Activities', $policies[3]->url); $this->assertEquals('GET', $policies[3]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[3]); - $this->assertObjectNotHasProperty('post_filter', $policies[3]); + $this->assertObjectNotHasAttribute('query_filter', $policies[3]); + $this->assertObjectNotHasAttribute('post_filter', $policies[3]); $this->assertEquals(true, $policies[3]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456/Tasks/**', $policies[4]->url); $this->assertEquals('GET', $policies[4]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[4]); - $this->assertObjectNotHasProperty('post_filter', $policies[4]); + $this->assertObjectNotHasAttribute('query_filter', $policies[4]); + $this->assertObjectNotHasAttribute('post_filter', $policies[4]); $this->assertEquals(true, $policies[4]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456/Workers/WK789/Reservations/**', $policies[5]->url); $this->assertEquals('GET', $policies[5]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[5]); - $this->assertObjectNotHasProperty('post_filter', $policies[5]); + $this->assertObjectNotHasAttribute('query_filter', $policies[5]); + $this->assertObjectNotHasAttribute('post_filter', $policies[5]); $this->assertEquals(true, $policies[5]->allow); } @@ -132,20 +132,20 @@ public function testDefaultWorkspace(): void { $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WS456', $policies[0]->url); $this->assertEquals('GET', $policies[0]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[0]); - $this->assertObjectNotHasProperty('post_filter', $policies[0]); + $this->assertObjectNotHasAttribute('query_filter', $policies[0]); + $this->assertObjectNotHasAttribute('post_filter', $policies[0]); $this->assertEquals(true, $policies[0]->allow); $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WS456', $policies[1]->url); $this->assertEquals('POST', $policies[1]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[1]); - $this->assertObjectNotHasProperty('post_filter', $policies[1]); + $this->assertObjectNotHasAttribute('query_filter', $policies[1]); + $this->assertObjectNotHasAttribute('post_filter', $policies[1]); $this->assertEquals(true, $policies[1]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456', $policies[2]->url); $this->assertEquals('GET', $policies[2]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[2]); - $this->assertObjectNotHasProperty('post_filter', $policies[2]); + $this->assertObjectNotHasAttribute('query_filter', $policies[2]); + $this->assertObjectNotHasAttribute('post_filter', $policies[2]); $this->assertEquals(true, $policies[2]->allow); } @@ -166,20 +166,20 @@ public function testWorkspaceFetchAll(): void { $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WS456', $policies[0]->url); $this->assertEquals('GET', $policies[0]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[0]); - $this->assertObjectNotHasProperty('post_filter', $policies[0]); + $this->assertObjectNotHasAttribute('query_filter', $policies[0]); + $this->assertObjectNotHasAttribute('post_filter', $policies[0]); $this->assertEquals(true, $policies[0]->allow); $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WS456', $policies[1]->url); $this->assertEquals('POST', $policies[1]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[1]); - $this->assertObjectNotHasProperty('post_filter', $policies[1]); + $this->assertObjectNotHasAttribute('query_filter', $policies[1]); + $this->assertObjectNotHasAttribute('post_filter', $policies[1]); $this->assertEquals(true, $policies[1]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456', $policies[2]->url); $this->assertEquals('GET', $policies[2]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[2]); - $this->assertObjectNotHasProperty('post_filter', $policies[2]); + $this->assertObjectNotHasAttribute('query_filter', $policies[2]); + $this->assertObjectNotHasAttribute('post_filter', $policies[2]); $this->assertEquals(true, $policies[2]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456/**', $policies[3]->url); @@ -206,20 +206,20 @@ public function testDefaultTaskQueue(): void { $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WQ789', $policies[0]->url); $this->assertEquals('GET', $policies[0]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[0]); - $this->assertObjectNotHasProperty('post_filter', $policies[0]); + $this->assertObjectNotHasAttribute('query_filter', $policies[0]); + $this->assertObjectNotHasAttribute('post_filter', $policies[0]); $this->assertEquals(true, $policies[0]->allow); $this->assertEquals('https://event-bridge.twilio.com/v1/wschannels/AC123/WQ789', $policies[1]->url); $this->assertEquals('POST', $policies[1]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[1]); - $this->assertObjectNotHasProperty('post_filter', $policies[1]); + $this->assertObjectNotHasAttribute('query_filter', $policies[1]); + $this->assertObjectNotHasAttribute('post_filter', $policies[1]); $this->assertEquals(true, $policies[1]->allow); $this->assertEquals('https://taskrouter.twilio.com/v1/Workspaces/WS456/TaskQueues/WQ789', $policies[2]->url); $this->assertEquals('GET', $policies[2]->method); - $this->assertObjectNotHasProperty('query_filter', $policies[2]); - $this->assertObjectNotHasProperty('post_filter', $policies[2]); + $this->assertObjectNotHasAttribute('query_filter', $policies[2]); + $this->assertObjectNotHasAttribute('post_filter', $policies[2]); $this->assertEquals(true, $policies[2]->allow); } } From da4b3c776ec076072432b5842a97eeb7a9008b43 Mon Sep 17 00:00:00 2001 From: Bruce Wells Date: Tue, 7 Jan 2025 11:06:08 -0500 Subject: [PATCH 7/8] Adding PHP 8.4 to test suite --- .github/workflows/test-and-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index fc94bb5cd2..3870274252 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -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 ] + php: [ 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 ] dependencies: - "lowest" - "highest" From b4abbc65e2b26565d08878f9dcaf0f3a72eb6e8a Mon Sep 17 00:00:00 2001 From: Bruce Wells Date: Wed, 8 Jan 2025 11:00:20 -0500 Subject: [PATCH 8/8] Remove parameter types on Twilio\Version::stream --- src/Twilio/Version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Twilio/Version.php b/src/Twilio/Version.php index 5b2f274113..e2ad52d58e 100644 --- a/src/Twilio/Version.php +++ b/src/Twilio/Version.php @@ -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); }