2525
2626class Crawler {
2727
28- /**
29- * @var Client
30- */
31- private $ client ;
28+ private readonly \GuzzleHttp \Client $ client ;
3229
3330 private readonly Uri $ site_uri ;
3431
35- /**
36- * @var integer
37- */
38- private $ crawled = 0 ;
32+ private int $ crawled = 0 ;
3933
40- /**
41- * @var integer
42- */
43- private $ cache_hits = 0 ;
34+ private int $ cache_hits = 0 ;
4435
4536 private int $ concurrency ;
4637
@@ -145,6 +136,9 @@ public function crawlComplete(): void {
145136 do_action ( Controller::getHookName ( 'crawling_complete ' ), $ args );
146137 }
147138
139+ /**
140+ * @param string[] $site_urls
141+ */
148142 public function crawlPath ( PathInfo $ detected , array $ site_urls ): PromiseInterface {
149143 $ absolute_uri = URLHelper::normalize ( $ this ->site_uri . $ detected ->path );
150144 try {
@@ -158,7 +152,7 @@ public function crawlPath( PathInfo $detected, array $site_urls ): PromiseInterf
158152 }
159153
160154 return $ this ->client ->sendAsync ( $ request )->then (
161- function ( $ response ) use ( &$ detected , &$ site_urls ) {
155+ function ( $ response ) use ( &$ detected , &$ site_urls ): array {
162156 $ status = $ response ->getStatusCode ();
163157
164158 if ( in_array ( $ status , STATIC_DEPLOY_REDIRECT_CODES , true ) ) {
@@ -202,7 +196,7 @@ function ( $response ) use ( &$detected, &$site_urls ) {
202196 'path ' => $ path_info ,
203197 ];
204198 },
205- function () use ( &$ detected ) {
199+ function () use ( &$ detected ): array {
206200 return [
207201 'error ' => 'Error crawling ' . $ detected ->path ,
208202 'path ' => $ detected ,
0 commit comments