From 6d474f8dc002bec398e951b055e3d9965c9f64da Mon Sep 17 00:00:00 2001 From: Marc Reichel Date: Mon, 1 Jul 2024 11:23:41 +0200 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=91=BD=20Implement=20Pop=20Score=20En?= =?UTF-8?q?dpoints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Closes #95 --- src/Console/CreateWebhook.php | 4 ++-- src/Enums/Popularity/Source.php | 10 ++++++++++ src/Enums/Webhook/Category.php | 1 + src/Events/PopularityTypeCreated.php | 19 +++++++++++++++++++ src/Events/PopularityTypeDeleted.php | 9 +++++++++ src/Events/PopularityTypeUpdated.php | 9 +++++++++ src/Models/PopularityPrimitive.php | 12 ++++++++++++ src/Models/PopularityType.php | 9 +++++++++ tests/TestCase.php | 2 +- 9 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 src/Enums/Popularity/Source.php create mode 100644 src/Events/PopularityTypeCreated.php create mode 100644 src/Events/PopularityTypeDeleted.php create mode 100644 src/Events/PopularityTypeUpdated.php create mode 100644 src/Models/PopularityPrimitive.php create mode 100644 src/Models/PopularityType.php diff --git a/src/Console/CreateWebhook.php b/src/Console/CreateWebhook.php index 9535fbb..bb306a1 100644 --- a/src/Console/CreateWebhook.php +++ b/src/Console/CreateWebhook.php @@ -89,9 +89,9 @@ public function handle(): int private function getModels(): array { - $glob = glob(__DIR__ . '/../Models/*.php') ?? []; + $glob = glob(__DIR__ . '/../Models/*.php') ?: []; - $pattern = '/\/(?:Model|Search|Webhook|Image)\.php$/'; + $pattern = '/\/(?:Model|PopularityPrimitive|Search|Webhook|Image)\.php$/'; $grep = preg_grep($pattern, $glob, PREG_GREP_INVERT); return collect($grep ?: []) diff --git a/src/Enums/Popularity/Source.php b/src/Enums/Popularity/Source.php new file mode 100644 index 0000000..50742d1 --- /dev/null +++ b/src/Enums/Popularity/Source.php @@ -0,0 +1,10 @@ +data = $data; + } +} diff --git a/src/Events/PopularityTypeDeleted.php b/src/Events/PopularityTypeDeleted.php new file mode 100644 index 0000000..59b3ca7 --- /dev/null +++ b/src/Events/PopularityTypeDeleted.php @@ -0,0 +1,9 @@ + PopularityType::class, + ]; +} diff --git a/src/Models/PopularityType.php b/src/Models/PopularityType.php new file mode 100644 index 0000000..7ed3a77 --- /dev/null +++ b/src/Models/PopularityType.php @@ -0,0 +1,9 @@ + Date: Mon, 1 Jul 2024 11:33:55 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=94=A5=20Update=20PHPStan=20Baseline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpstan-baseline.neon | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index f210962..b7a8d7e 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,15 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" - count: 1 - path: src/Console/CreateWebhook.php - - - - message: "#^Parameter \\#2 \\$array of function preg_grep expects array, array\\\\|false given\\.$#" - count: 1 - path: src/Console/CreateWebhook.php - - message: "#^Cannot call method assertExitCode\\(\\) on Illuminate\\\\Testing\\\\PendingCommand\\|int\\.$#" count: 12 From af8fe5f5ae5f2bda0a244f81caac3e71cbbb4aae Mon Sep 17 00:00:00 2001 From: Marc Reichel Date: Mon, 1 Jul 2024 11:43:32 +0200 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=92=9A=20Fix=20PHPStan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpstan-baseline.neon | 5 +++++ phpstan.neon | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index b7a8d7e..a987bfd 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,5 +1,10 @@ parameters: ignoreErrors: + - + message: "#^Unable to resolve the template type TMapValue in call to method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:map\\(\\)$#" + count: 1 + path: src/Models/Model.php + - message: "#^Cannot call method assertExitCode\\(\\) on Illuminate\\\\Testing\\\\PendingCommand\\|int\\.$#" count: 12 diff --git a/phpstan.neon b/phpstan.neon index d6626bd..6c9a47f 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -13,5 +13,5 @@ parameters: - '#Call to an undefined static method MarcReichel\\IGDBLaravel\\Models\\Game::foo\(\).#' - '#Unable to resolve the template type TValue in call to function collect#' - '#Unable to resolve the template type TKey in call to function collect#' - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false + - identifier: missingType.iterableValue + - identifier: missingType.generics From 821008ef2c1f758b214258a1fb99ffbc6f483839 Mon Sep 17 00:00:00 2001 From: Marc Reichel Date: Mon, 1 Jul 2024 11:47:07 +0200 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=92=9A=20Fix=20Dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f0a4a82..5a67363 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "wrapper" ], "type": "library", - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": "^8.1", "ext-json": "*", @@ -26,7 +26,7 @@ "larastan/larastan": "^2.9.2", "laravel/pint": "^1.13", "pestphp/pest": "^2", - "pestphp/pest-plugin-type-coverage": "2.x-dev" + "pestphp/pest-plugin-type-coverage": "^2.8.3" }, "license": "MIT", "authors": [