From d14dfda69e74ca94c286dafd813e126c607d2ef4 Mon Sep 17 00:00:00 2001 From: Andrii Krasnoholovets Date: Mon, 3 Mar 2025 21:29:55 +0200 Subject: [PATCH 1/4] AC-282: add void typehint --- .github/workflows/ci.yml | 2 ++ CHANGELOG.md | 5 +++++ src/PayseraApiBundle.php | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e24837..e8700f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,7 @@ jobs: - '8.0' - '8.1' - '8.2' + - '8.3' symfony: - '3.*' - '4.*' @@ -38,6 +39,7 @@ jobs: - { php: '8.0', symfony: '3.*' } - { php: '8.1', symfony: '3.*' } - { php: '8.2', symfony: '3.*' } + - { php: '8.3', symfony: '3.*' } - { php: '7.1', symfony: '5.*' } - { php: '7.1', symfony: '6.*' } - { php: '7.2', symfony: '6.*' } diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f5ed61..1148684 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.8.1] +### Added +- `void` typehint to `PayseraApiBundle::build` method +- PHP 8.3 to CI + ## [1.8.0] ### Added - Support for PHP 8 attributes diff --git a/src/PayseraApiBundle.php b/src/PayseraApiBundle.php index 551138e..7be4b1e 100644 --- a/src/PayseraApiBundle.php +++ b/src/PayseraApiBundle.php @@ -9,7 +9,7 @@ class PayseraApiBundle extends Bundle { - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { parent::build($container); From 991b2d66f5b2676787993c1e249bced7022588b5 Mon Sep 17 00:00:00 2001 From: Andrii Krasnoholovets Date: Tue, 4 Mar 2025 21:40:39 +0200 Subject: [PATCH 2/4] AC-282: route loading error fix --- CHANGELOG.md | 4 +++- src/Service/RoutingLoader/RoutingAttributeLoader.php | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1148684..7f051b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.8.1] ### Added -- `void` typehint to `PayseraApiBundle::build` method +- `void` typehint to `PayseraApiBundle::build` method to fix the deprecation message - PHP 8.3 to CI +### Fixed +- `Call to a member function getClassAnnotations() on null` error in `RoutingAttributeLoader` on Symfony 6 ## [1.8.0] ### Added diff --git a/src/Service/RoutingLoader/RoutingAttributeLoader.php b/src/Service/RoutingLoader/RoutingAttributeLoader.php index 87eaae8..8ad8a87 100644 --- a/src/Service/RoutingLoader/RoutingAttributeLoader.php +++ b/src/Service/RoutingLoader/RoutingAttributeLoader.php @@ -4,6 +4,7 @@ namespace Paysera\Bundle\ApiBundle\Service\RoutingLoader; +use Doctrine\Common\Annotations\Reader; use Paysera\Bundle\ApiBundle\Annotation\RestAnnotationInterface; use Paysera\Bundle\ApiBundle\Attribute\RestAttributeInterface; use Paysera\Bundle\ApiBundle\Service\RestRequestHelper; @@ -61,6 +62,10 @@ protected function configureRoute( private function loadAnnotations(Route $route, ReflectionClass $class, ReflectionMethod $method): void { + if (!isset($this->reader) || !$this->reader instanceof Reader) { + return; + } + $annotations = []; foreach ($this->reader->getClassAnnotations($class) as $annotation) { if ($annotation instanceof RestAnnotationInterface) { From d0981e60798d0703c03bf09bee851c7854542bc8 Mon Sep 17 00:00:00 2001 From: Andrii Krasnoholovets Date: Tue, 4 Mar 2025 21:40:57 +0200 Subject: [PATCH 3/4] AC-282: extra check removed --- src/Listener/RestResponseListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Listener/RestResponseListener.php b/src/Listener/RestResponseListener.php index 9aca71e..bd5239e 100644 --- a/src/Listener/RestResponseListener.php +++ b/src/Listener/RestResponseListener.php @@ -65,7 +65,7 @@ private function normalizeResult(Request $request, RestRequestOptions $options, { $includedFields = []; $fields = $request->query->get('fields'); - if ($fields !== null && is_string($fields) && $fields !== '') { + if (is_string($fields) && $fields !== '') { $includedFields = explode(',', $fields); } From dfbc22cbe5144814eddf66c4aec0614cc05ca766 Mon Sep 17 00:00:00 2001 From: Andrii Krasnoholovets Date: Wed, 5 Mar 2025 13:28:57 +0200 Subject: [PATCH 4/4] AC-282: remove Reader check --- src/Service/RoutingLoader/RoutingAttributeLoader.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Service/RoutingLoader/RoutingAttributeLoader.php b/src/Service/RoutingLoader/RoutingAttributeLoader.php index 8ad8a87..955f27d 100644 --- a/src/Service/RoutingLoader/RoutingAttributeLoader.php +++ b/src/Service/RoutingLoader/RoutingAttributeLoader.php @@ -4,7 +4,6 @@ namespace Paysera\Bundle\ApiBundle\Service\RoutingLoader; -use Doctrine\Common\Annotations\Reader; use Paysera\Bundle\ApiBundle\Annotation\RestAnnotationInterface; use Paysera\Bundle\ApiBundle\Attribute\RestAttributeInterface; use Paysera\Bundle\ApiBundle\Service\RestRequestHelper; @@ -62,7 +61,7 @@ protected function configureRoute( private function loadAnnotations(Route $route, ReflectionClass $class, ReflectionMethod $method): void { - if (!isset($this->reader) || !$this->reader instanceof Reader) { + if (!isset($this->reader)) { return; }