From be4e4a786665fc485108361b86d3ca9ea9391de0 Mon Sep 17 00:00:00 2001 From: Vladimir Fishchenko Date: Wed, 17 Feb 2021 20:40:47 +0000 Subject: [PATCH 1/7] #31345 Update laminas-code to ^3.5.1 to be PHP8 compatible --- composer.json | 2 +- composer.lock | 69 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 43 insertions(+), 28 deletions(-) diff --git a/composer.json b/composer.json index 83863d1cca12c..924d59c10524f 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "elasticsearch/elasticsearch": "~7.7.0", "guzzlehttp/guzzle": "^6.3.3", "laminas/laminas-captcha": "^2.7.1", - "laminas/laminas-code": "~3.4.1", + "laminas/laminas-code": "^3.5.1", "laminas/laminas-console": "^2.6.0", "laminas/laminas-crypt": "^2.6.0", "laminas/laminas-db": "^2.8.2", diff --git a/composer.lock b/composer.lock index fcac88f57ca29..9b2f572899770 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "67df124b58eb4b4739a5ce279b8890de", + "content-hash": "78818d163172b1bae00c769315bd0725", "packages": [ { "name": "aws/aws-sdk-php", @@ -1163,48 +1163,41 @@ }, { "name": "laminas/laminas-code", - "version": "3.4.1", + "version": "3.5.1", "source": { "type": "git", "url": "https://github.com/laminas/laminas-code.git", - "reference": "1cb8f203389ab1482bf89c0e70a04849bacd7766" + "reference": "b549b70c0bb6e935d497f84f750c82653326ac77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-code/zipball/1cb8f203389ab1482bf89c0e70a04849bacd7766", - "reference": "1cb8f203389ab1482bf89c0e70a04849bacd7766", + "url": "https://api.github.com/repos/laminas/laminas-code/zipball/b549b70c0bb6e935d497f84f750c82653326ac77", + "reference": "b549b70c0bb6e935d497f84f750c82653326ac77", "shasum": "" }, "require": { - "laminas/laminas-eventmanager": "^2.6 || ^3.0", - "laminas/laminas-zendframework-bridge": "^1.0", - "php": "^7.1" + "laminas/laminas-eventmanager": "^3.3", + "laminas/laminas-zendframework-bridge": "^1.1", + "php": "^7.3 || ~8.0.0" }, "conflict": { "phpspec/prophecy": "<1.9.0" }, "replace": { - "zendframework/zend-code": "self.version" + "zendframework/zend-code": "^3.4.1" }, "require-dev": { - "doctrine/annotations": "^1.7", + "doctrine/annotations": "^1.10.4", "ext-phar": "*", - "laminas/laminas-coding-standard": "^1.0", - "laminas/laminas-stdlib": "^2.7 || ^3.0", - "phpunit/phpunit": "^7.5.16 || ^8.4" + "laminas/laminas-coding-standard": "^1.0.0", + "laminas/laminas-stdlib": "^3.3.0", + "phpunit/phpunit": "^9.4.2" }, "suggest": { "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", "laminas/laminas-stdlib": "Laminas\\Stdlib component" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4.x-dev", - "dev-develop": "3.5.x-dev", - "dev-dev-4.0": "4.0.x-dev" - } - }, "autoload": { "psr-4": { "Laminas\\Code\\": "src/" @@ -1220,7 +1213,13 @@ "code", "laminas" ], - "time": "2019-12-31T16:28:24+00:00" + "funding": [ + { + "url": "https://funding.communitybridge.org/projects/laminas-project", + "type": "community_bridge" + } + ], + "time": "2020-11-30T20:16:31+00:00" }, { "name": "laminas/laminas-config", @@ -3764,11 +3763,13 @@ "Magento\\Composer\\": "src" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "OSL-3.0", "AFL-3.0" ], - "description": "Magento composer library helps to instantiate Composer application and run composer commands." + "description": "Magento composer library helps to instantiate Composer application and run composer commands.", + "time": "2020-06-15T17:52:31+00:00" }, { "name": "magento/magento-composer-installer", @@ -4805,11 +4806,6 @@ "MIT" ], "authors": [ - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - }, { "name": "Marijn Huizendveld", "email": "marijn.huizendveld@gmail.com" @@ -4817,6 +4813,11 @@ { "name": "Thibaud Fabre", "email": "thibaud@aztech.io" + }, + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" } ], "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", @@ -7650,6 +7651,20 @@ "parser", "php" ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], "time": "2020-05-25T17:44:05+00:00" }, { From aec1039596c536cf0742cbe027ae647d8197c6da Mon Sep 17 00:00:00 2001 From: Vladimir Fishchenko Date: Wed, 17 Feb 2021 22:49:23 +0000 Subject: [PATCH 2/7] #31345 Fix for ArgumentsReader as ParameterReflection::getClass fails when array provided --- .../Magento/Framework/Code/Reader/ArgumentsReader.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php b/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php index c9a8cce706af4..4aef134a6022c 100644 --- a/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php +++ b/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php @@ -98,12 +98,16 @@ public function getConstructorArguments(\ReflectionClass $class, $groupByPositio */ private function processType(\ReflectionClass $class, \Laminas\Code\Reflection\ParameterReflection $parameter) { + $type = $parameter->detectType(); + + if ($type === 'array') { + return 'array'; + } + if ($parameter->getClass()) { return NamespaceResolver::NS_SEPARATOR . $parameter->getClass()->getName(); } - $type = $parameter->detectType(); - if ($type === 'null') { return null; } From 4bbe7a0b0d40c7bb6190e11469a0335fa0c0c6b7 Mon Sep 17 00:00:00 2001 From: Vladimir Fishchenko Date: Thu, 18 Feb 2021 23:22:26 +0000 Subject: [PATCH 3/7] #31345: update laminas-code in magento framework --- lib/internal/Magento/Framework/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index 2266922f34f24..e6e2ba234479c 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -25,7 +25,7 @@ "colinmollenhour/php-redis-session-abstract": "~1.4.0", "composer/composer": "^1.9 || ^2.0", "guzzlehttp/guzzle": "^6.3.3", - "laminas/laminas-code": "~3.4.1", + "laminas/laminas-code": "^3.5.1", "laminas/laminas-crypt": "^2.6.0", "laminas/laminas-http": "^2.6.0", "laminas/laminas-mail": "^2.9.0", From 8063e1406ee05e0e0a84e82c68cb37fd4b5c5954 Mon Sep 17 00:00:00 2001 From: Vladimir Fishchenko Date: Tue, 23 Feb 2021 18:54:32 +0000 Subject: [PATCH 4/7] #31345 Temporary add missing constants to autoload.php to see if other tests are failing --- app/autoload.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/autoload.php b/app/autoload.php index 6a0a95347a681..5a577edb18a95 100644 --- a/app/autoload.php +++ b/app/autoload.php @@ -17,6 +17,20 @@ \define('VENDOR_PATH', BP . '/app/etc/vendor_path.php'); +/** + * Ensure php backwards compatibility of laminas-code module + * + * Can be removed once https://github.com/laminas/laminas-code/pull/73 is released to 3.5.x + * or PHP minimum version is 8.0 + * or laminas-code module is updated to version 4.0+ with tested PHP 7.4+ support + */ +if (!defined('T_NAME_QUALIFIED')) { + define('T_NAME_QUALIFIED', 24001); +} +if (! defined('T_NAME_FULLY_QUALIFIED')) { + define('T_NAME_FULLY_QUALIFIED', 24002); +} + if (!\is_readable(VENDOR_PATH)) { throw new \Exception( 'We can\'t read some files that are required to run the Magento application. ' From 422f73c8af38f6c111281a6e0d4ca0a2580b6f8e Mon Sep 17 00:00:00 2001 From: Vladimir Fishchenko Date: Tue, 23 Feb 2021 20:33:15 +0000 Subject: [PATCH 5/7] #31345 A better fix for ArgumentsReader::processType --- .../Magento/Framework/Code/Reader/ArgumentsReader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php b/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php index 4aef134a6022c..9452c818f28aa 100644 --- a/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php +++ b/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php @@ -100,8 +100,8 @@ private function processType(\ReflectionClass $class, \Laminas\Code\Reflection\P { $type = $parameter->detectType(); - if ($type === 'array') { - return 'array'; + if (in_array($type, $this->scalarTypesProvider->getTypes())) { + return $type; } if ($parameter->getClass()) { From 81203f674e5a9ada527ac76a1fd9c03a32ec377f Mon Sep 17 00:00:00 2001 From: Vladimir Fishchenko Date: Fri, 26 Feb 2021 19:25:15 +0000 Subject: [PATCH 6/7] #31345: Alternative way to fix missing constants --- app/autoload.php | 14 -------------- .../Setup/Module/Di/Code/Reader/FileScanner.php | 8 ++++++++ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/app/autoload.php b/app/autoload.php index 5a577edb18a95..6a0a95347a681 100644 --- a/app/autoload.php +++ b/app/autoload.php @@ -17,20 +17,6 @@ \define('VENDOR_PATH', BP . '/app/etc/vendor_path.php'); -/** - * Ensure php backwards compatibility of laminas-code module - * - * Can be removed once https://github.com/laminas/laminas-code/pull/73 is released to 3.5.x - * or PHP minimum version is 8.0 - * or laminas-code module is updated to version 4.0+ with tested PHP 7.4+ support - */ -if (!defined('T_NAME_QUALIFIED')) { - define('T_NAME_QUALIFIED', 24001); -} -if (! defined('T_NAME_FULLY_QUALIFIED')) { - define('T_NAME_FULLY_QUALIFIED', 24002); -} - if (!\is_readable(VENDOR_PATH)) { throw new \Exception( 'We can\'t read some files that are required to run the Magento application. ' diff --git a/setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php b/setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php index 27ac2b2794bb9..9973f5fbfeb39 100644 --- a/setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php +++ b/setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php @@ -38,6 +38,14 @@ protected function scan() define('T_TRAIT', 42001); } + // ensure php backwards compatibility (from laminas code 3.5.x) + if (! defined('T_NAME_QUALIFIED')) { + define('T_NAME_QUALIFIED', 24001); + } + if (! defined('T_NAME_FULLY_QUALIFIED')) { + define('T_NAME_FULLY_QUALIFIED', 24002); + } + /** * Variables & Setup */ From 6ffa8701513bb329eba6499e39b64ec0488d424d Mon Sep 17 00:00:00 2001 From: Vladimir Fishchenko Date: Wed, 10 Mar 2021 20:01:41 +0000 Subject: [PATCH 7/7] #31345 code style fix --- setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php b/setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php index 9973f5fbfeb39..5b2667132bae4 100644 --- a/setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php +++ b/setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php @@ -39,10 +39,10 @@ protected function scan() } // ensure php backwards compatibility (from laminas code 3.5.x) - if (! defined('T_NAME_QUALIFIED')) { + if (!defined('T_NAME_QUALIFIED')) { define('T_NAME_QUALIFIED', 24001); } - if (! defined('T_NAME_FULLY_QUALIFIED')) { + if (!defined('T_NAME_FULLY_QUALIFIED')) { define('T_NAME_FULLY_QUALIFIED', 24002); }