From 174877ec8102c7de3b3201cd7a8d050c2d5a3cd4 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Mon, 13 Apr 2020 09:20:05 -0400 Subject: [PATCH] More types --- composer.json | 2 +- tests/AnimeClient/RequirementsTest.php | 6 +++--- tests/AnimeClient/mocks.php | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index b166b893..875ff6cd 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,7 @@ "laminas/laminas-httphandlerrunner": "^1.0", "maximebf/consolekit": "^1.0", "monolog/monolog": "^2.0.1", - "php": "^7.4 || ^8", + "php": ">=7.4", "psr/container": "~1.0", "psr/http-message": "~1.0", "psr/log": "~1.0", diff --git a/tests/AnimeClient/RequirementsTest.php b/tests/AnimeClient/RequirementsTest.php index 22b2372a..20034ed9 100644 --- a/tests/AnimeClient/RequirementsTest.php +++ b/tests/AnimeClient/RequirementsTest.php @@ -20,17 +20,17 @@ use PDO; class RequirementsTest extends AnimeClientTestCase { - public function testPHPVersion() + public function testPHPVersion(): void { $this->assertTrue(version_compare(PHP_VERSION, "5.4", "ge")); } - public function testHasPDO() + public function testHasPDO(): void { $this->assertTrue(class_exists('PDO')); } - public function testHasPDOSqlite() + public function testHasPDOSqlite(): void { $drivers = PDO::getAvailableDrivers(); $this->assertTrue(in_array('sqlite', $drivers)); diff --git a/tests/AnimeClient/mocks.php b/tests/AnimeClient/mocks.php index 2584a1dd..270d49d2 100644 --- a/tests/AnimeClient/mocks.php +++ b/tests/AnimeClient/mocks.php @@ -32,24 +32,24 @@ class TestEnum extends Enum { } class FriendGrandParentTestClass { - protected $grandParentProtected = 84; + protected int $grandParentProtected = 84; } class FriendParentTestClass extends FriendGrandParentTestClass { - protected $parentProtected = 47; - private $parentPrivate = 654; + protected int $parentProtected = 47; + private int $parentPrivate = 654; } class FriendTestClass extends FriendParentTestClass { - protected $protected = 356; - private $private = 486; + protected int $protected = 356; + private int $private = 486; - protected function getProtected() + protected function getProtected(): int { return 4; } - private function getPrivate() + private function getPrivate(): int { return 23; } @@ -57,7 +57,7 @@ class FriendTestClass extends FriendParentTestClass { class TestTransformer extends AbstractTransformer { - public function transform($item) + public function transform($item): array { $out = []; $genre_list = (array) $item; @@ -95,7 +95,7 @@ trait MockViewOutputTrait { } class MockUtil { - public function get_cached_image($api_path, $series_slug, $type = "anime") + public function get_cached_image($api_path, $series_slug, $type = "anime"): string { return "/public/images/{$type}/{$series_slug}.jpg"; } @@ -144,7 +144,7 @@ trait MockInjectionTrait { class MockBaseApiModel extends BaseApiModel { use MockInjectionTrait; - protected $base_url = 'https://httpbin.org/'; + protected string $base_url = 'https://httpbin.org/'; protected function _get_list_from_api(string $status): array {