-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial fixes for raising PHPStan level to 6
Will still require more work on filling in array item types.
- Loading branch information
Showing
10 changed files
with
48 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
* @author Tobias Zeising <[email protected]> | ||
*/ | ||
class ImageUtils { | ||
private static $iconRelWeights = [ | ||
private const ICON_REL_WEIGHTS = [ | ||
'apple-touch-icon-precomposed' => 3, | ||
'apple-touch-icon' => 2, | ||
'shortcut icon' => 1, | ||
|
@@ -91,7 +91,7 @@ public static function parseShortcutIcons(string $html): array { | |
|
||
// then by rel priority | ||
[function($val) { | ||
return self::$iconRelWeights[$val['rel']]; | ||
return self::ICON_REL_WEIGHTS[$val['rel']]; | ||
}, Misc::ORDER_DESC], | ||
|
||
// and finally by order to make the sorting stable | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* @author Tobias Zeising <[email protected]> | ||
*/ | ||
class SpoutLoader { | ||
/** @var ?array<class-string<spout>, spout> array of available spouts */ | ||
/** @var ?array<class-string<spout<mixed>>, spout<mixed>> array of available spouts */ | ||
private $spouts = null; | ||
|
||
/** @var Dice dependency injection container */ | ||
|
@@ -29,7 +29,7 @@ public function __construct(Dice $dice) { | |
/** | ||
* returns all available spouts | ||
* | ||
* @return array<class-string<spout>, spout> available spouts | ||
* @return array<class-string<spout<mixed>>, spout<mixed>> available spouts | ||
*/ | ||
public function all(): array { | ||
$this->readSpouts(); | ||
|
@@ -42,7 +42,7 @@ public function all(): array { | |
* | ||
* @param class-string $spout a given spout type | ||
* | ||
* @return ?spout an instance of the spout, null if this spout doesn't exist | ||
* @return ?spout<mixed> an instance of the spout, null if this spout doesn't exist | ||
*/ | ||
public function get(string $spout): ?spout { | ||
if (!class_exists($spout)) { | ||
|
@@ -118,8 +118,8 @@ protected function loadClasses(string $location, string $parentClassName): array | |
/** | ||
* compare spouts by name | ||
* | ||
* @param spout $spout1 Spout 1 | ||
* @param spout $spout2 Spout 2 | ||
* @param spout<mixed> $spout1 Spout 1 | ||
* @param spout<mixed> $spout2 Spout 2 | ||
*/ | ||
private static function compareSpoutsByName(spout $spout1, spout $spout2): int { | ||
return strcasecmp($spout1->name, $spout2->name); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,8 @@ | |
* @license GPLv3 (https://www.gnu.org/licenses/gpl-3.0.html) | ||
* @author Tobias Zeising <[email protected]> | ||
* @author Jan Tojnar <[email protected]> | ||
* | ||
* @extends \spouts\spout<null> | ||
*/ | ||
class page extends \spouts\spout { | ||
/** @var string name of source */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ | |
* @license GPLv3 (https://www.gnu.org/licenses/gpl-3.0.html) | ||
* @author Tobias Zeising <[email protected]> | ||
* @author Tim Gerundt <[email protected]> | ||
* | ||
* @extends \spouts\spout<null> | ||
*/ | ||
class commits extends \spouts\spout { | ||
/** @var string name of source */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ | |
* @copyright Copyright (c) Tobias Zeising (http://www.aditu.de) | ||
* @license GPLv3 (https://www.gnu.org/licenses/gpl-3.0.html) | ||
* @author Tobias Zeising <[email protected]> | ||
* | ||
* @extends \spouts\spout<null> | ||
*/ | ||
class reddit2 extends \spouts\spout { | ||
/** @var string name of spout */ | ||
|
@@ -202,7 +204,7 @@ public function destroy(): void { | |
* Sign in to reddit using the credentials in params and save a session cookie | ||
* for further requests. | ||
* | ||
* @param array $params source parameters | ||
* @param array<string, string> $params source parameters | ||
* | ||
* @throws GuzzleHttp\Exception\GuzzleException When an error is encountered | ||
* @throws \RuntimeException if the response body is not in JSON format | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,8 @@ | |
* @copyright Copyright (c) Tobias Zeising (http://www.aditu.de) | ||
* @license GPLv3 (https://www.gnu.org/licenses/gpl-3.0.html) | ||
* @author Tobias Zeising <[email protected]> | ||
* | ||
* @extends \spouts\spout<null> | ||
*/ | ||
class usertimeline extends \spouts\spout { | ||
/** @var string name of source */ | ||
|
@@ -126,7 +128,7 @@ public function getHttpClient( | |
* Assumes client property is initialized to Guzzle client configured to access Twitter. | ||
* | ||
* @param string $endpoint API endpoint to use | ||
* @param array $params extra query arguments to pass to the API call | ||
* @param array<string, string> $params extra query arguments to pass to the API call | ||
* | ||
* @throws \Exception when API request fails | ||
* @throws GuzzleHttp\Exception\GuzzleException when HTTP request fails for API-unrelated reasons | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters