Skip to content

Commit 5be0cca

Browse files
Fixed Supported Library Autoloading Issue.
1 parent 9ad49a6 commit 5be0cca

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src/generator.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,26 @@ private static function find_classes( $path ) {
232232

233233
if ( file_exists( __DIR__ . '/../vendor/autoload.php' ) ) {
234234
require_once __DIR__ . '/../vendor/autoload.php';
235-
} elseif ( file_exists( dirname( dirname( dirname( __DIR__ ) ) ) . '/autoload.php' ) ) {
236-
require_once dirname( dirname( dirname( __DIR__ ) ) ) . '/autoload.php';
235+
} else {
236+
try {
237+
\spl_autoload_register( function ( $class ) {
238+
$base_dir = dirname( dirname( dirname( __DIR__ ) ) );
239+
if ( file_exists( $base_dir . '/symfony/finder/Finder.php' ) ) {
240+
if ( false === strpos( $class, 'Symfony\Component\Finder\\' ) ) {
241+
} else {
242+
$class = explode( 'Symfony\Component\Finder\\', $class );
243+
if ( isset( $class[1] ) ) {
244+
$class = $class[1] . '.php';
245+
if ( file_exists( $base_dir . '/symfony/finder/' . $class ) ) {
246+
require_once $base_dir . '/symfony/finder/' . $class;
247+
}
248+
}
249+
}
250+
}
251+
} );
252+
} catch ( Exception $exception ) {
253+
echo 'Error : ' . $exception->getMessage();
254+
}
237255
}
238256

239257
$config_file = ( isset( $argv[1] ) ) ? $argv[1] : false;

0 commit comments

Comments
 (0)