summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-06-29 11:07:19 +0200
committerRemi Collet <fedora@famillecollet.com>2015-06-29 11:07:19 +0200
commit0f5f0b4004b8b233d3a2399a89ba00d3885fda83 (patch)
tree69b2bf95b8d57e35f0d16abc06de0ae440655339
parenta3538a72491e17c29339919b67ff9e210208e05b (diff)
php-phpunit-phploc: review autoloader
-rw-r--r--autoload.php.in22
-rw-r--r--php-phpunit-phploc.spec8
2 files changed, 19 insertions, 11 deletions
diff --git a/autoload.php.in b/autoload.php.in
index 22ad17d..0bd43af 100644
--- a/autoload.php.in
+++ b/autoload.php.in
@@ -1,20 +1,24 @@
<?php
-/* Inspired from autoload from version 2.0.3 */
+/* Autoloader for phploc/phploc and its dependencies */
$vendorDir = '/usr/share/php';
require_once $vendorDir . '/SebastianBergmann/FinderFacade/autoload.php';
require_once $vendorDir . '/SebastianBergmann/Git/autoload.php';
require_once $vendorDir . '/SebastianBergmann/Version/autoload.php';
-if (!(isset($sfuloader) && $sfuloader instanceof Symfony\Component\ClassLoader\UniversalClassLoader)) {
- require_once $vendorDir . '/Symfony/Component/ClassLoader/UniversalClassLoader.php';
- $sfuloader = new Symfony\Component\ClassLoader\UniversalClassLoader();
- $sfuloader->register();
+require_once $vendorDir . '/TheSeer/fDOMDocument/autoload.php';
+// 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->registerNamespaces(array(
- 'Symfony\\Component\\Console' => $vendorDir,
- 'Symfony\\Component\\ClassLoader' => $vendorDir,
-));
+
+/* For symfony/console */
+$fedoraClassLoader->addPrefix('Symfony\\Component\\', $vendorDir);
spl_autoload_register(
function($class) {
diff --git a/php-phpunit-phploc.spec b/php-phpunit-phploc.spec
index 0f7eb2f..685601a 100644
--- a/php-phpunit-phploc.spec
+++ b/php-phpunit-phploc.spec
@@ -18,7 +18,7 @@
Name: php-phpunit-phploc
Version: 2.1.3
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: A tool for quickly measuring the size of a PHP project
Group: Development/Libraries
@@ -46,6 +46,7 @@ BuildRequires: php-composer(sebastian/version) >= 1.0.3
BuildRequires: php-composer(sebastian/version) < 2
BuildRequires: php-composer(symfony/console) >= 2.5
BuildRequires: php-composer(symfony/console) < 3
+# For our autoloader
BuildRequires: php-composer(symfony/class-loader)
%endif
@@ -110,7 +111,7 @@ install -D -p -m 755 phploc %{buildroot}%{_bindir}/phploc
%if %{with_tests}
%check
phpunit \
- --bootstrap src/autoload.php \
+ --bootstrap %{buildroot}%{php_home}/PHPLOC/autoload.php \
--verbose tests
%endif
@@ -137,6 +138,9 @@ fi
%changelog
+* Mon Jun 29 2015 Remi Collet <remi@fedoraproject.org> - 2.1.3-2
+- switch to $fedoraClassLoader autoloader
+
* Thu Jun 4 2015 Remi Collet <remi@fedoraproject.org> - 2.1.3-1
- update to 2.1.3
- improve autoloader