summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-06-29 11:05:40 +0200
committerRemi Collet <fedora@famillecollet.com>2015-06-29 11:05:40 +0200
commit1b6100f728d21208b96a5dd3318229d2f5746683 (patch)
tree120241be88d99eea7dde23c2a2cace03e8707708
parent2c9ae343bb23a45e968d7fd66aa6dbf048d5926c (diff)
php-phpunit-FinderFacade: review autoloader
-rw-r--r--autoload.php.in24
-rw-r--r--php-phpunit-FinderFacade.spec5
2 files changed, 16 insertions, 13 deletions
diff --git a/autoload.php.in b/autoload.php.in
index 5309eae..a5f9520 100644
--- a/autoload.php.in
+++ b/autoload.php.in
@@ -1,20 +1,21 @@
<?php
-/* Inspipred from Autoload from version 1.1 */
+/* Autoloader for sebastian/finder-facade and its dependencies */
$vendorDir = '/usr/share/php';
require_once $vendorDir . '/TheSeer/fDOMDocument/autoload.php';
-require_once $vendorDir . '/Symfony/Component/ClassLoader/UniversalClassLoader.php';
-use Symfony\Component\ClassLoader\UniversalClassLoader;
+// Use Symfony autoloader
+if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
+ if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
+ require_once $vendorDir . '/Symfony/Component/ClassLoader/ClassLoader.php';
+ }
+
+ $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
+ $fedoraClassLoader->register();
+}
-$sfuloader = new UniversalClassLoader();
-$sfuloader->registerNamespaces(array(
- 'Symfony\\Component\\Finder' => $vendorDir,
- 'Symfony\\Component\\ClassLoader' => $vendorDir,
-));
-$sfuloader->register();
+/* For symfony/finder */
+$fedoraClassLoader->addPrefix('Symfony\\Component\\', $vendorDir);
-// @codingStandardsIgnoreFile
-// @codeCoverageIgnoreStart
spl_autoload_register(
function($class) {
static $classes = NULL;
@@ -32,4 +33,3 @@ spl_autoload_register(
}
}
);
-// @codeCoverageIgnoreEnd
diff --git a/php-phpunit-FinderFacade.spec b/php-phpunit-FinderFacade.spec
index 4a62cb8..96c6857 100644
--- a/php-phpunit-FinderFacade.spec
+++ b/php-phpunit-FinderFacade.spec
@@ -17,7 +17,7 @@
Name: php-phpunit-FinderFacade
Version: 1.2.0
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Wrapper for Symfony Finder component
Group: Development/Libraries
@@ -107,6 +107,9 @@ fi
%changelog
+* Mon Jun 29 2015 Remi Collet <remi@fedoraproject.org> - 1.2.0-3
+- switch to $fedoraClassLoader autoloader
+
* Thu Jun 4 2015 Remi Collet <remi@fedoraproject.org> - 1.2.0-2
- use $sfuloader