@@ -30,16 +30,16 @@ public function signRequest($urlString, $body, $contentType = null)
3030 {
3131 $ url = parse_url ($ urlString );
3232 $ data = '' ;
33- if (isset ( $ url [ 'path ' ] )) {
33+ if (array_key_exists ( 'path ' , $ url )) {
3434 $ data = $ url ['path ' ];
3535 }
36- if (isset ( $ url [ 'query ' ] )) {
36+ if (array_key_exists ( 'query ' , $ url )) {
3737 $ data .= '? ' . $ url ['query ' ];
3838 }
3939 $ data .= "\n" ;
4040
41- if ($ body != null &&
42- ( $ contentType == 'application/x-www-form-urlencoded ' ) || $ contentType == 'application/json ' ) {
41+ if ($ body !== null &&
42+ in_array (( string ) $ contentType, array ( 'application/x-www-form-urlencoded ' , 'application/json ' ), true ) ) {
4343 $ data .= $ body ;
4444 }
4545 return $ this ->sign ($ data );
@@ -76,7 +76,7 @@ public function uploadToken(
7676 ) {
7777 $ deadline = time () + $ expires ;
7878 $ scope = $ bucket ;
79- if ($ key != null ) {
79+ if ($ key !== null ) {
8080 $ scope .= ': ' . $ key ;
8181 }
8282 $ args = array ();
@@ -120,14 +120,14 @@ public function uploadToken(
120120
121121 private static function copyPolicy (&$ policy , $ originPolicy , $ strictPolicy )
122122 {
123- if ($ originPolicy == null ) {
124- return ;
123+ if ($ originPolicy === null ) {
124+ return [] ;
125125 }
126126 foreach ($ originPolicy as $ key => $ value ) {
127- if (in_array ($ key , self ::$ deprecatedPolicyFields )) {
127+ if (in_array (( string ) $ key , self ::$ deprecatedPolicyFields, true )) {
128128 throw new \InvalidArgumentException ("{$ key } has deprecated " );
129129 }
130- if (!$ strictPolicy || in_array ($ key , self ::$ policyFields )) {
130+ if (!$ strictPolicy || in_array (( string ) $ key , self ::$ policyFields, true )) {
131131 $ policy [$ key ] = $ value ;
132132 }
133133 }
0 commit comments