summaryrefslogtreecommitdiffstats
path: root/php-laminas-zendframework-bridge-rpm.patch
blob: f2df39060e3658c2041d78f36b432aae1a8a60c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
diff -up ./src/Autoloader.php.rpm ./src/Autoloader.php
--- ./src/Autoloader.php.rpm	2020-08-19 08:24:30.000000000 +0200
+++ ./src/Autoloader.php	2020-08-19 08:27:21.275930504 +0200
@@ -9,7 +9,6 @@
 namespace Laminas\ZendFrameworkBridge;
 
 use ArrayObject;
-use Composer\Autoload\ClassLoader;
 use RuntimeException;
 
 use function array_values;
@@ -50,7 +49,6 @@ class Autoloader
 
         spl_autoload_register(self::createPrependAutoloader(
             RewriteRules::namespaceReverse(),
-            self::getClassLoader(),
             $loaded
         ), true, true);
 
@@ -61,36 +59,15 @@ class Autoloader
     }
 
     /**
-     * @return ClassLoader
-     * @throws RuntimeException
-     */
-    private static function getClassLoader()
-    {
-        if (file_exists(getenv('COMPOSER_VENDOR_DIR') . '/autoload.php')) {
-            return include getenv('COMPOSER_VENDOR_DIR') . '/autoload.php';
-        }
-
-        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 callable
      */
-    private static function createPrependAutoloader(array $namespaces, ClassLoader $classLoader, ArrayObject $loaded)
+    private static function createPrependAutoloader(array $namespaces, ArrayObject $loaded)
     {
         /**
          * @param  string $class Class name to autoload
          * @return void
          */
-        return static function ($class) use ($namespaces, $classLoader, $loaded) {
+        return static function ($class) use ($namespaces, $loaded) {
             if (isset($loaded[$class])) {
                 return;
             }
@@ -109,7 +86,7 @@ class Autoloader
                 return;
             }
 
-            if ($classLoader->loadClass($class)) {
+            if (\Fedora\Autoloader\Autoload::loadClass($class)) {
                 $legacy = $namespaces[$check]
                     . strtr(substr($class, strlen($check)), [
                         'ApiTools' => 'Apigility',
diff -up ./src/Replacements.php.rpm ./src/Replacements.php
--- ./src/Replacements.php.rpm	2020-08-19 08:24:30.000000000 +0200
+++ ./src/Replacements.php	2020-08-19 08:25:20.004129165 +0200
@@ -21,7 +21,7 @@ class Replacements
     public function __construct(array $additionalReplacements = [])
     {
         $this->replacements = array_merge(
-            require __DIR__ . '/../config/replacements.php',
+            require __DIR__ . '/config/replacements.php',
             $additionalReplacements
         );