summaryrefslogtreecommitdiffstats
path: root/php-laminas-zendframework-bridge-rpm.patch
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-12-21 16:33:02 +0100
committerRemi Collet <remi@php.net>2021-12-21 16:33:02 +0100
commit1a2b463d661e4b75fdebac3016a4906acaac347b (patch)
tree75f3e8ee2728da1895791b4f6e4375e77fd41971 /php-laminas-zendframework-bridge-rpm.patch
parentb1ddc478933d10b05a9e2d4b919a201b2bab1afc (diff)
update to 1.4.1 (no change)
Diffstat (limited to 'php-laminas-zendframework-bridge-rpm.patch')
-rw-r--r--php-laminas-zendframework-bridge-rpm.patch74
1 files changed, 47 insertions, 27 deletions
diff --git a/php-laminas-zendframework-bridge-rpm.patch b/php-laminas-zendframework-bridge-rpm.patch
index 439038c..6d93f84 100644
--- a/php-laminas-zendframework-bridge-rpm.patch
+++ b/php-laminas-zendframework-bridge-rpm.patch
@@ -1,7 +1,7 @@
diff -up ./src/Autoloader.php.rpm ./src/Autoloader.php
---- ./src/Autoloader.php.rpm 2020-09-15 07:44:23.000000000 +0200
-+++ ./src/Autoloader.php 2020-09-15 07:46:23.579538552 +0200
-@@ -9,7 +9,6 @@
+--- ./src/Autoloader.php.rpm 2021-12-21 16:21:53.000000000 +0100
++++ ./src/Autoloader.php 2021-12-21 16:27:00.348616300 +0100
+@@ -3,7 +3,6 @@
namespace Laminas\ZendFrameworkBridge;
use ArrayObject;
@@ -9,39 +9,38 @@ diff -up ./src/Autoloader.php.rpm ./src/Autoloader.php
use RuntimeException;
use function array_values;
-@@ -50,7 +49,6 @@ class Autoloader
+@@ -45,15 +44,9 @@ class Autoloader
+ public static function load()
+ {
+ $loaded = new ArrayObject([]);
+- $classLoader = self::getClassLoader();
+-
+- if ($classLoader === null) {
+- return;
+- }
spl_autoload_register(self::createPrependAutoloader(
RewriteRules::namespaceReverse(),
-- self::getClassLoader(),
+- $classLoader,
$loaded
), true, true);
-@@ -61,36 +59,15 @@ class Autoloader
+@@ -63,27 +56,16 @@ class Autoloader
+ ));
}
- /**
-- * @return ClassLoader
-- * @throws RuntimeException
-- */
-- private static function getClassLoader()
+- private static function getClassLoader(): ?ClassLoader
- {
-- if (getenv('COMPOSER_VENDOR_DIR') && file_exists(getenv('COMPOSER_VENDOR_DIR') . '/autoload.php')) {
-- return include getenv('COMPOSER_VENDOR_DIR') . '/autoload.php';
+- $composerVendorDirectory = getenv('COMPOSER_VENDOR_DIR');
+- if (is_string($composerVendorDirectory)) {
+- return self::getClassLoaderFromVendorDirectory($composerVendorDirectory);
- }
-
-- if (file_exists(__DIR__ . '/../../../autoload.php')) {
-- return include __DIR__ . '/../../../autoload.php';
-- }
--
-- if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
-- return include __DIR__ . '/../vendor/autoload.php';
-- }
--
-- throw new RuntimeException('Cannot detect composer autoload. Please run composer install');
+- return self::getClassLoaderFromVendorDirectory(self::UPSTREAM_COMPOSER_VENDOR_DIRECTORY)
+- ?? self::getClassLoaderFromVendorDirectory(self::LOCAL_COMPOSER_VENDOR_DIRECTORY);
- }
-
-- /**
+ /**
* @return callable
*/
- private static function createPrependAutoloader(array $namespaces, ClassLoader $classLoader, ArrayObject $loaded)
@@ -56,7 +55,7 @@ diff -up ./src/Autoloader.php.rpm ./src/Autoloader.php
if (isset($loaded[$class])) {
return;
}
-@@ -109,7 +86,7 @@ class Autoloader
+@@ -102,7 +84,7 @@ class Autoloader
return;
}
@@ -65,10 +64,31 @@ diff -up ./src/Autoloader.php.rpm ./src/Autoloader.php
$legacy = $namespaces[$check]
. strtr(substr($class, strlen($check)), [
'ApiTools' => 'Apigility',
+@@ -162,20 +144,4 @@ class Autoloader
+ }
+ };
+ }
+-
+- private static function getClassLoaderFromVendorDirectory(string $composerVendorDirectory): ?ClassLoader
+- {
+- $filename = rtrim($composerVendorDirectory, '/') . '/autoload.php';
+- if (!file_exists($filename)) {
+- return null;
+- }
+-
+- /** @psalm-suppress MixedAssignment */
+- $loader = include $filename;
+- if (!$loader instanceof ClassLoader) {
+- return null;
+- }
+-
+- return $loader;
+- }
+ }
diff -up ./src/Replacements.php.rpm ./src/Replacements.php
---- ./src/Replacements.php.rpm 2020-09-15 07:44:23.000000000 +0200
-+++ ./src/Replacements.php 2020-09-15 07:44:29.456906439 +0200
-@@ -21,7 +21,7 @@ class Replacements
+--- ./src/Replacements.php.rpm 2021-12-21 16:21:53.000000000 +0100
++++ ./src/Replacements.php 2021-12-21 16:21:57.865043533 +0100
+@@ -15,7 +15,7 @@ class Replacements
public function __construct(array $additionalReplacements = [])
{
$this->replacements = array_merge(