@@ -52,9 +52,9 @@ public function __construct(ConsumerKey $consumerKey, ConsumerSecret $consumerSe
5252 /**
5353 * @param AccessToken $accessToken
5454 * @param TokenSecret $tokenSecret
55- * @return static
55+ * @return RequestSigner
5656 */
57- public function withAccessToken (AccessToken $ accessToken , TokenSecret $ tokenSecret )
57+ public function withAccessToken (AccessToken $ accessToken , TokenSecret $ tokenSecret ): RequestSigner
5858 {
5959 $ clone = clone $ this ;
6060 $ clone ->accessToken = $ accessToken ;
@@ -67,9 +67,9 @@ public function withAccessToken(AccessToken $accessToken, TokenSecret $tokenSecr
6767 }
6868
6969 /**
70- * @return static
70+ * @return RequestSigner
7171 */
72- public function withoutAccessToken ()
72+ public function withoutAccessToken (): RequestSigner
7373 {
7474 $ clone = clone $ this ;
7575 $ clone ->accessToken = null ;
@@ -85,7 +85,7 @@ public function withoutAccessToken()
8585 * @param RequestInterface $request
8686 * @return RequestInterface
8787 */
88- public function sign (RequestInterface $ request )
88+ public function sign (RequestInterface $ request ): RequestInterface
8989 {
9090 $ parameters = [
9191 'oauth_consumer_key ' => (string ) $ this ->consumerKey ,
@@ -106,9 +106,9 @@ public function sign(RequestInterface $request)
106106
107107 public function signToRequestAuthorization (
108108 RequestInterface $ request ,
109- $ callbackUri ,
109+ string $ callbackUri ,
110110 array $ additionalParameters = []
111- ) {
111+ ): RequestInterface {
112112 $ parameters = [
113113 'oauth_consumer_key ' => (string ) $ this ->consumerKey ,
114114 'oauth_nonce ' => $ this ->generateNonce (),
@@ -130,7 +130,7 @@ public function signToRequestAuthorization(
130130 * @param array $parameters
131131 * @return array
132132 */
133- private function mergeSignatureParameter (RequestInterface $ request , array $ parameters )
133+ private function mergeSignatureParameter (RequestInterface $ request , array $ parameters ): array
134134 {
135135 $ body = [];
136136 if ($ request ->getMethod () === 'POST ' &&
@@ -148,7 +148,7 @@ private function mergeSignatureParameter(RequestInterface $request, array $param
148148 /**
149149 * @return string
150150 */
151- private function generateTimestamp ()
151+ private function generateTimestamp (): string
152152 {
153153 $ dateTime = new \DateTimeImmutable ();
154154
@@ -159,7 +159,7 @@ private function generateTimestamp()
159159 * @param int $length
160160 * @return string
161161 */
162- private function generateNonce ($ length = 32 )
162+ private function generateNonce (int $ length = 32 ): string
163163 {
164164 $ pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ' ;
165165
@@ -170,7 +170,7 @@ private function generateNonce($length = 32)
170170 * @param array $parameters
171171 * @return string
172172 */
173- private function generateAuthorizationheader (array $ parameters )
173+ private function generateAuthorizationheader (array $ parameters ): string
174174 {
175175 array_walk ($ parameters , function (&$ value , $ key ) {
176176 $ value = rawurlencode ($ key ).'=" ' .rawurlencode ($ value ).'" ' ;
0 commit comments