@@ -60,7 +60,7 @@ public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes
6060 throw $ this ->buildException ($ key , $ maxAttempts );
6161 }
6262
63- $ this ->limiter ->hit ($ key , $ decayMinutes * 60 );
63+ $ this ->limiter ->hit ($ key , ( int ) ( $ decayMinutes * 60 ) );
6464
6565 $ response = $ next ($ request );
6666
@@ -74,13 +74,12 @@ public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes
7474 * Resolve the number of attempts if the user is authenticated or not.
7575 *
7676 * @param \Illuminate\Http\Request $request
77- * @param int|string $maxAttempts
7877 * @return int
7978 */
80- protected function resolveMaxAttempts ($ request , $ maxAttempts )
79+ protected function resolveMaxAttempts ($ request , int | string $ maxAttempts )
8180 {
82- if (Str::contains ($ maxAttempts , '| ' )) {
83- $ maxAttempts = explode ('| ' , $ maxAttempts , 2 )[$ request ->user () ? 1 : 0 ];
81+ if (Str::contains (( string ) $ maxAttempts , '| ' )) {
82+ $ maxAttempts = explode ('| ' , ( string ) $ maxAttempts , 2 )[$ request ->user () ? 1 : 0 ];
8483 }
8584
8685 if (! is_numeric ($ maxAttempts ) && $ request ->user ()) {
@@ -101,10 +100,14 @@ protected function resolveMaxAttempts($request, $maxAttempts)
101100 protected function resolveRequestSignature ($ request )
102101 {
103102 if ($ user = $ request ->user ()) {
104- return sha1 ($ user ->getAuthIdentifier ());
103+ $ identifier = $ user ->getAuthIdentifier ();
104+
105+ return sha1 (is_scalar ($ identifier ) ? (string ) $ identifier : '' );
105106 }
106107
107- return sha1 ($ request ->fingerprint ());
108+ $ fingerprint = $ request ->fingerprint ();
109+
110+ return sha1 ((string ) $ fingerprint );
108111 }
109112
110113 /**
@@ -163,7 +166,7 @@ protected function addHeaders(Response $response, $maxAttempts, $remainingAttemp
163166 * @param int $maxAttempts
164167 * @param int $remainingAttempts
165168 * @param int|null $retryAfter
166- * @return array
169+ * @return array<string, mixed>
167170 */
168171 protected function getHeaders ($ maxAttempts , $ remainingAttempts , $ retryAfter = null )
169172 {
0 commit comments