Shawn Iwinski 5227b52
#
Shawn Iwinski 5227b52
# Fedora spec file for php-phpdocumentor-type-resolver
Shawn Iwinski 5227b52
#
1def428
# Copyright (c) 2017-2021 Shawn Iwinski <shawn@iwin.ski>
Shawn Iwinski 5227b52
#
Shawn Iwinski 5227b52
# License: MIT
Shawn Iwinski 5227b52
# http://opensource.org/licenses/MIT
Shawn Iwinski 5227b52
#
Shawn Iwinski 5227b52
# Please preserve changelog entries
Shawn Iwinski 5227b52
#
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
%global github_owner     phpDocumentor
Shawn Iwinski 5227b52
%global github_name      TypeResolver
Shawn Iwinski 8f53e32
%global github_version   0.4.0
Shawn Iwinski 8f53e32
%global github_commit    9c977708995954784726e25d0cd1dddf4e65b0f7
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
%global composer_vendor  phpdocumentor
Shawn Iwinski 5227b52
%global composer_project type-resolver
Shawn Iwinski 5227b52
Shawn Iwinski 8f53e32
# "php": "^5.5 || ^7.0"
Shawn Iwinski 5227b52
%global php_min_ver 5.5
Shawn Iwinski 5227b52
# "phpdocumentor/reflection-common": "^1.0"
Shawn Iwinski 5227b52
%global reflection_common_min_ver 1.0
Shawn Iwinski 5227b52
%global reflection_common_max_ver 2.0
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
# Build using "--without tests" to disable tests
Shawn Iwinski 5227b52
%global with_tests 0%{!?_without_tests:1}
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
%{!?phpdir:  %global phpdir  %{_datadir}/php}
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
Name:          php-%{composer_vendor}-%{composer_project}
Shawn Iwinski 5227b52
Version:       %{github_version}
5e5f853
Release:       18%{?github_release}%{?dist}
Shawn Iwinski 5227b52
Summary:       A PSR-5 based resolver of Class names, Types and Structural Element Names
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
License:       MIT
Shawn Iwinski 5227b52
URL:           https://github.com/%{github_owner}/%{github_name}
Shawn Iwinski 8f53e32
Shawn Iwinski 8f53e32
# GitHub export does not include tests.
Shawn Iwinski 8f53e32
# Run php-phpdocumentor-type-resolver-get-source.sh to create full source.
Shawn Iwinski 8f53e32
Source0:       %{name}-%{github_version}-%{github_commit}.tar.gz
Shawn Iwinski 8f53e32
Source1:       %{name}-get-source.sh
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
BuildArch:     noarch
Shawn Iwinski 5227b52
# Tests
Shawn Iwinski 5227b52
%if %{with_tests}
Shawn Iwinski 5227b52
## composer.json
Shawn Iwinski 5227b52
BuildRequires: php(language) >= %{php_min_ver}
Shawn Iwinski 5227b52
BuildRequires: php-composer(phpunit/phpunit)
b49724a
BuildRequires: (php-composer(phpdocumentor/reflection-common) >= %{reflection_common_min_ver} with php-composer(phpdocumentor/reflection-common) <  %{reflection_common_max_ver})
Shawn Iwinski 8f53e32
## phpcompatinfo (computed from version 0.4.0)
Shawn Iwinski 5227b52
BuildRequires: php-reflection
Shawn Iwinski 5227b52
BuildRequires: php-spl
Shawn Iwinski 5227b52
BuildRequires: php-tokenizer
Shawn Iwinski 5227b52
## Autoloader
Shawn Iwinski 5227b52
BuildRequires: php-fedora-autoloader-devel
Shawn Iwinski 5227b52
%endif
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
# composer.json
Shawn Iwinski 5227b52
Requires:      php(language) >= %{php_min_ver}
b49724a
Requires:     (php-composer(phpdocumentor/reflection-common) >= %{reflection_common_min_ver} with php-composer(phpdocumentor/reflection-common) <  %{reflection_common_max_ver})
Shawn Iwinski 8f53e32
# phpcompatinfo (computed from version 0.4.0)
Shawn Iwinski 5227b52
Requires:      php-spl
Shawn Iwinski 5227b52
Requires:      php-tokenizer
Shawn Iwinski 5227b52
# Autoloader
Shawn Iwinski 5227b52
Requires:      php-composer(fedora/autoloader)
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
# Composer
Shawn Iwinski 5227b52
Provides:      php-composer(%{composer_vendor}/%{composer_project}) = %{version}
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
%description
Shawn Iwinski 5227b52
The specification on types in DocBlocks (PSR-5) describes various keywords
Shawn Iwinski 5227b52
and special constructs but also how to statically resolve the partial name
Shawn Iwinski 5227b52
of a Class into a Fully Qualified Class Name (FQCN).
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
PSR-5 also introduces an additional way to describe deeper elements than
Shawn Iwinski 5227b52
Classes, Interfaces and Traits called the Fully Qualified Structural Element
Shawn Iwinski 5227b52
Name (FQSEN). Using this it is possible to refer to methods, properties and
Shawn Iwinski 5227b52
class constants but also functions and global constants.
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
This package provides two Resolvers that are capable of:
Shawn Iwinski 5227b52
1. Returning a series of Value Object for given expression while resolving any
Shawn Iwinski 5227b52
  partial class names, and
Shawn Iwinski 5227b52
2. Returning an FQSEN object after resolving any partial Structural Element
Shawn Iwinski 5227b52
  Names into Fully Qualified Structural Element names.
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
Autoloader: %{phpdir}/phpDocumentor/Reflection/autoload-type-resolver.php
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
%prep
Shawn Iwinski 5227b52
%setup -qn %{github_name}-%{github_commit}
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
: Update examples autoload require
Shawn Iwinski 5227b52
sed "s#.*require.*vendor.*/autoload.php.*#require_once '%{phpdir}/phpDocumentor/Reflection/autoload-type-resolver.php';#" \
Shawn Iwinski 5227b52
    -i examples/*
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
%build
Shawn Iwinski 5227b52
: Create autoloader
Shawn Iwinski 5227b52
%{_bindir}/phpab --template fedora --output src/autoload-type-resolver.php src
Shawn Iwinski 5227b52
cat <<'AUTOLOAD' | tee -a src/autoload-type-resolver.php
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
\Fedora\Autoloader\Dependencies::required([
Shawn Iwinski 5227b52
    '%{phpdir}/phpDocumentor/Reflection/autoload-common.php',
Shawn Iwinski 5227b52
]);
Shawn Iwinski 5227b52
AUTOLOAD
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
%install
Shawn Iwinski 5227b52
mkdir -p %{buildroot}%{phpdir}/phpDocumentor/Reflection
Shawn Iwinski 5227b52
cp -rp src/* %{buildroot}%{phpdir}/phpDocumentor/Reflection/
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
%check
Shawn Iwinski 5227b52
%if %{with_tests}
Shawn Iwinski 5227b52
: Create tests bootstrap
1def428
mkdir vendor
1def428
cat <<'BOOTSTRAP' | tee vendor/autoload.php
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
\Fedora\Autoloader\Autoload::addPsr4('phpDocumentor\\Reflection\\', __DIR__.'/tests/unit');
Shawn Iwinski 5227b52
BOOTSTRAP
Shawn Iwinski 5227b52
1def428
: Drop listener
1def428
(head -n 24 <phpunit.xml.dist ; tail -n1 <phpunit.xml.dist) > phpunit.xml
Shawn Iwinski 5227b52
1def428
: Upstream tests - ignoring mockery tests
Shawn Iwinski 5227b52
RETURN_CODE=0
Shawn Iwinski 8f53e32
PHPUNIT=$(which phpunit)
1def428
for PHP_EXEC in php php73 php74 php80; do
Shawn Iwinski 8f53e32
    if [ "php" == "$PHP_EXEC" ] || which $PHP_EXEC; then
1def428
        $PHP_EXEC -d auto_prepend_file=%{buildroot}%{phpdir}/phpDocumentor/Reflection/autoload-type-resolver.php \
1def428
            $PHPUNIT \
1def428
                 --filter '^((?!(testAddingAKeyword|testReadsAliasesFromClassReflection|testReadsAliasesFromProvidedNamespaceAndContent)).)*$' \
1def428
                 --verbose \
Shawn Iwinski 8f53e32
            || RETURN_CODE=1
Shawn Iwinski 5227b52
    fi
Shawn Iwinski 5227b52
done
Shawn Iwinski 5227b52
exit $RETURN_CODE
Shawn Iwinski 5227b52
%else
Shawn Iwinski 5227b52
: Tests skipped
Shawn Iwinski 5227b52
%endif
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
%files
Shawn Iwinski 5227b52
%license LICENSE
Shawn Iwinski 5227b52
%doc *.md
Shawn Iwinski 5227b52
%doc composer.json
Shawn Iwinski 5227b52
%doc examples
Shawn Iwinski 5227b52
%{phpdir}/phpDocumentor/Reflection/autoload-type-resolver.php
Shawn Iwinski 5227b52
%{phpdir}/phpDocumentor/Reflection/FqsenResolver.php
Shawn Iwinski 5227b52
%{phpdir}/phpDocumentor/Reflection/Type.php
Shawn Iwinski 5227b52
%{phpdir}/phpDocumentor/Reflection/TypeResolver.php
Shawn Iwinski 5227b52
%{phpdir}/phpDocumentor/Reflection/Types
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
Shawn Iwinski 5227b52
%changelog
5e5f853
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-18
5e5f853
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
5e5f853
9732a5c
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-17
9732a5c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
9732a5c
d4f11db
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-16
d4f11db
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
d4f11db
b6f9bf5
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-15
b6f9bf5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
b6f9bf5
0c012c9
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-14
0c012c9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
0c012c9
0005861
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-13
0005861
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
0005861
5a605c8
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-12
5a605c8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
5a605c8
1def428
* Tue Mar 23 2021 Remi Collet <remi@remirepo.net> - 0.4.0-11
1def428
- drop mockery/mockery usage
1def428
a5b2588
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-10
a5b2588
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
a5b2588
dfc56c5
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-9
dfc56c5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
dfc56c5
e85fc2c
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-8
e85fc2c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
e85fc2c
38220d7
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-7
38220d7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
38220d7
002c4ea
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-6
002c4ea
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
002c4ea
b49724a
* Fri Dec  7 2018 Remi Collet <remi@remirepo.net> - 0.4.0-5
b49724a
- use range dependencies
b49724a
4d6832f
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-4
4d6832f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
4d6832f
cfc3fa1
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-3
cfc3fa1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
cfc3fa1
a08229a
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-2
a08229a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
a08229a
Shawn Iwinski 8f53e32
* Mon Jul 17 2017 Shawn Iwinski <shawn@iwin.ski> - 0.4.0-1
Shawn Iwinski 8f53e32
- Update to 0.4.0 (RHBZ #1460503)
Shawn Iwinski 8f53e32
- Add "get source" script because upstream attributes removed tests from snapshot
Shawn Iwinski 8f53e32
Shawn Iwinski 5227b52
* Sat Mar 11 2017 Shawn Iwinski <shawn@iwin.ski> - 0.2.1-1
Shawn Iwinski 5227b52
- Initial package