@@ -157,7 +157,7 @@ public function __construct(
157157 if (is_null ($ client )) {
158158 // Since the user did not pass a client, try and make a client
159159 // using the Guzzle 6 adapter or Guzzle 7 (depending on availability)
160- list ( $ guzzleVersion) = explode ('@ ' , InstalledVersions::getVersion ('guzzlehttp/guzzle ' ), 1 );
160+ [ $ guzzleVersion] = explode ('@ ' , ( string ) InstalledVersions::getVersion ('guzzlehttp/guzzle ' ), 1 );
161161 $ guzzleVersion = (float ) $ guzzleVersion ;
162162
163163 if ($ guzzleVersion >= 6.0 && $ guzzleVersion < 7 ) {
@@ -235,15 +235,13 @@ public function __construct(
235235
236236 // Additional utility classes
237237 APIResource::class => APIResource::class,
238- Client::class => function () {
239- return $ this ;
240- }
238+ Client::class => fn () => $ this
241239 ];
242240
243241 if (class_exists ('Vonage\Video\ClientFactory ' )) {
244242 $ services ['video ' ] = 'Vonage\Video\ClientFactory ' ;
245243 } else {
246- $ services ['video ' ] = function () {
244+ $ services ['video ' ] = function (): never {
247245 throw new \RuntimeException ('Please install @vonage/video to use the Video API ' );
248246 };
249247 }
@@ -258,15 +256,7 @@ public function __construct(
258256 // Disable throwing E_USER_DEPRECATED notices by default, the user can turn it on during development
259257 if (array_key_exists ('show_deprecations ' , $ this ->options ) && ($ this ->options ['show_deprecations ' ] == true )) {
260258 set_error_handler (
261- static function (
262- int $ errno ,
263- string $ errstr ,
264- string $ errfile = null ,
265- int $ errline = null ,
266- array $ errorcontext = null
267- ) {
268- return true ;
269- },
259+ static fn (int $ errno , string $ errstr , string $ errfile = null , int $ errline = null , array $ errorcontext = null ) => true ,
270260 E_USER_DEPRECATED
271261 );
272262 }
@@ -539,7 +529,7 @@ protected function validateAppOptions($app): void
539529 }
540530
541531 foreach ($ disallowedCharacters as $ char ) {
542- if (strpos ( $ app [$ key ], $ char ) !== false ) {
532+ if (str_contains (( string ) $ app [$ key ], $ char )) {
543533 throw new InvalidArgumentException ('app. ' . $ key . ' cannot contain the ' . $ char . ' character ' );
544534 }
545535 }
@@ -611,8 +601,8 @@ public function getCredentials(): CredentialsInterface
611601 protected static function requiresBasicAuth (RequestInterface $ request ): bool
612602 {
613603 $ path = $ request ->getUri ()->getPath ();
614- $ isSecretManagementEndpoint = strpos ($ path , '/accounts ' ) === 0 && strpos ($ path , '/secrets ' ) !== false ;
615- $ isApplicationV2 = strpos ($ path , '/v2/applications ' ) === 0 ;
604+ $ isSecretManagementEndpoint = str_starts_with ($ path , '/accounts ' ) && str_contains ($ path , '/secrets ' );
605+ $ isApplicationV2 = str_starts_with ($ path , '/v2/applications ' );
616606
617607 return $ isSecretManagementEndpoint || $ isApplicationV2 ;
618608 }
@@ -625,8 +615,8 @@ protected static function requiresAuthInUrlNotBody(RequestInterface $request): b
625615 {
626616 $ path = $ request ->getUri ()->getPath ();
627617
628- $ isRedact = strpos ($ path , '/v1/redact ' ) === 0 ;
629- $ isMessages = strpos ($ path , '/v1/messages ' ) === 0 ;
618+ $ isRedact = str_starts_with ($ path , '/v1/redact ' );
619+ $ isMessages = str_starts_with ($ path , '/v1/messages ' );
630620
631621 return $ isRedact || $ isMessages ;
632622 }
@@ -638,10 +628,10 @@ protected static function requiresAuthInUrlNotBody(RequestInterface $request): b
638628 protected function needsKeypairAuthentication (RequestInterface $ request ): bool
639629 {
640630 $ path = $ request ->getUri ()->getPath ();
641- $ isCallEndpoint = strpos ($ path , '/v1/calls ' ) === 0 ;
642- $ isRecordingUrl = strpos ($ path , '/v1/files ' ) === 0 ;
643- $ isStitchEndpoint = strpos ($ path , '/beta/conversation ' ) === 0 ;
644- $ isUserEndpoint = strpos ($ path , '/beta/users ' ) === 0 ;
631+ $ isCallEndpoint = str_starts_with ($ path , '/v1/calls ' );
632+ $ isRecordingUrl = str_starts_with ($ path , '/v1/files ' );
633+ $ isStitchEndpoint = str_starts_with ($ path , '/beta/conversation ' );
634+ $ isUserEndpoint = str_starts_with ($ path , '/beta/users ' );
645635
646636 return $ isCallEndpoint || $ isRecordingUrl || $ isStitchEndpoint || $ isUserEndpoint ;
647637 }
0 commit comments