summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer.json2
-rw-r--r--php-bartlett-PHP-Reflect-autoload.php38
-rw-r--r--php-bartlett-PHP-Reflect.spec40
3 files changed, 48 insertions, 32 deletions
diff --git a/composer.json b/composer.json
index b22d5ad..cdc5d85 100644
--- a/composer.json
+++ b/composer.json
@@ -24,7 +24,7 @@
"ext-json": "*",
"ext-date": "*",
"ext-reflection": "*",
- "sebastian/version": "~1.0",
+ "sebastian/version": "~1.0|~2.0",
"nikic/php-parser": "~1.4",
"doctrine/collections": "~1.2",
"symfony/event-dispatcher": "~2.5",
diff --git a/php-bartlett-PHP-Reflect-autoload.php b/php-bartlett-PHP-Reflect-autoload.php
index 9fe6a64..fc451b5 100644
--- a/php-bartlett-PHP-Reflect-autoload.php
+++ b/php-bartlett-PHP-Reflect-autoload.php
@@ -16,31 +16,29 @@ if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Compo
}
$fedoraClassLoader->addPrefixes(array(
'Symfony\\Component' => $vendorDir,
- 'JsonSchema' => $vendorDir,
- 'Seld\\JsonLint' => $vendorDir,
'Bartlett' => dirname(dirname(__DIR__)),
));
-// Mandatory dependencies
-require_once $vendorDir . '/PhpParser/Autoloader.php';
-PhpParser\Autoloader::register();
-require_once $vendorDir . '/SebastianBergmann/Version/autoload.php';
-require_once $vendorDir . '/Doctrine/Common/Collections/autoload.php';
-require_once $vendorDir . '/Doctrine/Common/Cache/autoload.php';
-require_once $vendorDir . '/phpDocumentor/Reflection/DocBlock/autoload.php';
-
// Needed when installed for 'Bartlett\CompatInfo\Analyser\CompatibilityAnalyser'
-if (is_dir($vendorDir . '/Bartlett/CompatInfo')) {
+if (is_dir("$vendorDir/Bartlett/CompatInfo")) {
$fedoraClassLoader->addPrefix('Bartlett\\CompatInfo', $vendorDir);
}
-// Optional dependencies
-if (file_exists($vendorDir . '/Bartlett/UmlWriter/autoload.php')) {
- require_once $vendorDir . '/Bartlett/UmlWriter/autoload.php';
-}
-if (is_dir($vendorDir . '/Psr/Log')) {
- $fedoraClassLoader->addPrefix('Psr\\Log', $vendorDir);
-}
-if (is_dir($vendorDir . '/Monolog')) {
- $fedoraClassLoader->addPrefix('Monolog', $vendorDir);
+// Dependencies (autoloader => required)
+foreach(array(
+ "$vendorDir/PhpParser/autoload.php" => true,
+ "$vendorDir/Seld/JsonLint/autoload.php" => true,
+ "$vendorDir/JsonSchema/autoload.php" => true,
+ "$vendorDir/SebastianBergmann/Version/autoload.php" => true,
+ "$vendorDir/Doctrine/Common/Collections/autoload.php" => true,
+ "$vendorDir/Doctrine/Common/Cache/autoload.php" => true,
+ "$vendorDir/phpDocumentor/Reflection/DocBlock/autoload.php" => true,
+ "$vendorDir/Bartlett/UmlWriter/autoload.php" => false,
+ "$vendorDir/Psr/Log/autoload.php" => false,
+ "$vendorDir/Monolog/autoload.php" => false,
+) as $dependencyAutoloader => $required) {
+ if ($required || file_exists($dependencyAutoloader)) {
+ require_once $dependencyAutoloader;
+ }
}
+
diff --git a/php-bartlett-PHP-Reflect.spec b/php-bartlett-PHP-Reflect.spec
index 3fa8aac..6f31ac1 100644
--- a/php-bartlett-PHP-Reflect.spec
+++ b/php-bartlett-PHP-Reflect.spec
@@ -7,7 +7,7 @@
# Please, preserve the changelog entries
#
%global bootstrap 0
-%global gh_commit e8da05ee5d7469f8a48d6d28ed0bcd8eaf8ef79e
+%global gh_commit 73eac11e5bd3b161745ad5d6bef6af73458010f6
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
#global gh_date 20150331
%global gh_owner llaville
@@ -20,8 +20,8 @@
%endif
Name: php-bartlett-PHP-Reflect
-Version: 4.0.0
-%global specrel 3
+Version: 4.0.1
+%global specrel 1
Release: %{?gh_date:0.%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist}
Summary: Adds the ability to reverse-engineer PHP
@@ -68,7 +68,7 @@ BuildRequires: php-composer(symfony/class-loader) >= 2.5
# "ext-json": "*",
# "ext-date": "*",
# "ext-reflection": "*",
-# "sebastian/version": "~1.0",
+# "sebastian/version": "~1.0|~2.0",
# "nikic/php-parser": "~1.4",
# "doctrine/collections": "~1.2",
# "symfony/event-dispatcher": "~2.5",
@@ -127,12 +127,17 @@ Requires: php-composer(psr/log) >= 1.0
%if ! %{bootstrap}
Requires: php-composer(bartlett/umlwriter) >= 1.0
Requires: php-composer(bartlett/umlwriter) < 2
+%if 0%{?fedora} >= 21
+Suggests: php-composer(psr/log)
+Suggests: php-composer(monolog/monolog)
+%endif
%endif
# For our patch / autoloader
Requires: php-composer(symfony/class-loader) >= 2.5
Requires: php-composer(symfony/class-loader) < 3
Requires: php-doctrine-collections >= 1.3.0-2
Requires: php-doctrine-cache >= 1.4.1
+Requires: php-PsrLog >= 1.0.0-8
Obsoletes: php-channel-bartlett <= 1.3
@@ -171,17 +176,26 @@ install -D -p -m 644 bin/phpreflect.1 %{buildroot}%{_mandir}/man1/phpref
%check
%if %{with_tests}
-# Version 4.0.0: OK, but incomplete, skipped, or risky tests!
-# Tests: 122, Assertions: 123, Incomplete: 3.
+# Version 4.0.1: OK, but incomplete, skipped, or risky tests!
+# Tests: 122, Assertions: 122, Incomplete: 3.
+# remirepo:11
+run=0
+ret=0
+if which php56; then
+ php56 %{_bindir}/phpunit --include-path=%{buildroot}%{_datadir}/php || ret=1
+ run=1
+fi
+if which php71; then
+ php71 %{_bindir}/phpunit --include-path=%{buildroot}%{_datadir}/php || ret=1
+ run=1
+fi
+if [ $run -eq 0 ]; then
%{_bindir}/phpunit \
--include-path=%{buildroot}%{_datadir}/php \
--verbose
-
-if which php70; then
- php70 %{_bindir}/phpunit \
- --include-path=%{buildroot}%{_datadir}/php \
- --verbose
+# remirepo:2
fi
+exit $ret
%else
: Test suite disabled
%endif
@@ -205,6 +219,10 @@ fi
%changelog
+* Wed Jul 6 2016 Remi Collet <remi@fedoraproject.org> - 4.0.1-1
+- update to 4.0.1
+- rewrite autoloader
+
* Mon Apr 18 2016 Remi Collet <remi@fedoraproject.org> - 1.1.0-3
- allow sebastian/version 2.0
- run test suite with both PHP 5 and 7 when available