summaryrefslogtreecommitdiffstats
path: root/php-laminas-zendframework-bridge-rpm.patch
blob: 0bd5dd1965dde4d05fe1f0e2256c071d22b08f77 (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
diff -up src/Autoloader.php.rpm src/Autoloader.php
--- src/Autoloader.php.rpm	2020-01-06 11:58:27.000000000 +0100
+++ src/Autoloader.php	2020-01-06 13:35:58.942532257 +0100
@@ -9,7 +9,6 @@
 namespace Laminas\ZendFrameworkBridge;
 
 use ArrayObject;
-use Composer\Autoload\ClassLoader;
 use RuntimeException;
 
 /**
@@ -38,7 +37,6 @@ class Autoloader
 
         spl_autoload_register(self::createPrependAutoloader(
             RewriteRules::namespaceReverse(),
-            self::getClassLoader(),
             $loaded
         ), true, true);
 
@@ -49,32 +47,15 @@ class Autoloader
     }
 
     /**
-     * @return ClassLoader
-     * @throws RuntimeException
-     */
-    private static function getClassLoader()
-    {
-        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;
             }
@@ -93,7 +74,8 @@ class Autoloader
                 return;
             }
 
-            if ($classLoader->loadClass($class)) {
+            if ($file = \Fedora\Autoloader\Autoload::findFileForClass($class)) {
+                \Fedora\Autoloader\includeFile($file);
                 $legacy = $namespaces[$check]
                     . strtr(substr($class, strlen($check)), [
                         'ApiTools' => 'Apigility',
diff -up src/Replacements.php.rpm src/Replacements.php
--- src/Replacements.php.rpm	2020-01-06 11:58:27.000000000 +0100
+++ src/Replacements.php	2020-01-06 13:32:48.361356190 +0100
@@ -16,7 +16,7 @@ class Replacements
     public function __construct(array $additionalReplacements = [])
     {
         $this->replacements = array_merge(
-            require __DIR__ . '/../config/replacements.php',
+            require __DIR__ . '/config/replacements.php',
             $additionalReplacements
         );
     }