From 52a15e87ce6ca83d39465b1beebe525236d06b2f Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Wed, 19 Jan 2022 11:25:34 +0000 Subject: [PATCH] fix issue #109 - need to update references after this fix --- CHANGELOG-3.x.md | 4 ++++ tests/Reference/GenericTest.php | 11 ++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG-3.x.md b/CHANGELOG-3.x.md index 74817c3a..f57273de 100644 --- a/CHANGELOG-3.x.md +++ b/CHANGELOG-3.x.md @@ -29,6 +29,10 @@ using the [Keep a CHANGELOG](http://keepachangelog.com) principles. - drop support of Doctrine DBAL v2, and raise minimum constraint to 3.2 to satisfy [Deprecated `AbstractPlatform::getName()](https://github.com/doctrine/dbal/commit/4b174ad06ec74d7678251dcacbf43977ae762554) - drop support of `composer/semver` v1 and v2 +### Fixed + +- [#109](https://github.com/llaville/php-compatinfo-db/issues/109) Class constants not well detected + ## [3.17.0] - 2022-01-05 ### Changed diff --git a/tests/Reference/GenericTest.php b/tests/Reference/GenericTest.php index 3544e8dc..19ed526b 100644 --- a/tests/Reference/GenericTest.php +++ b/tests/Reference/GenericTest.php @@ -393,7 +393,6 @@ private function classConstantsFromExtensionProvider(): Generator { $extension = $this->getReflectionExtension(); $classes = array_unique($extension->getClassNames()); - $elements = []; foreach ($classes as $classname) { try { @@ -406,17 +405,15 @@ private function classConstantsFromExtensionProvider(): Generator /* Skip class alias */ continue; } - - $elements = $elements + array_map( + $elements = array_map( function ($value) use ($classname) { return "$classname::$value"; }, array_keys($class->getConstants()) ); - } - - foreach ($elements as $name) { - yield $name; + foreach ($elements as $name) { + yield $name; + } } }