Skip to content

Commit 6a422bc

Browse files
committed
Merge branch 'develop'
2 parents 59e61ac + eb0c608 commit 6a422bc

File tree

135 files changed

+13306
-3910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+13306
-3910
lines changed

‎.gitignore‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
1+
# IDE Shizzle; it is recommended to use a global .gitignore for this but since this is an OSS project we want to make
2+
# it easy to contribute
13
.idea
2-
vendor
4+
/nbproject/private/
5+
.buildpath
6+
.project
7+
.settings
8+
9+
# Build folder and vendor folder are generated code; no need to version this
10+
build/
11+
tools/
12+
temp/
13+
vendor/
14+
*.phar
15+
16+
# By default the phpunit.xml.dist is provided; you can override this using a local config file
17+
phpunit.xml

‎.scrutinizer.yml‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
before_commands:
2+
- "composer install --no-dev --prefer-source"
3+
4+
checks:
5+
php:
6+
excluded_dependencies:
7+
- phpstan/phpstan
8+
9+
tools:
10+
external_code_coverage:
11+
enabled: true
12+
timeout: 300
13+
filter:
14+
excluded_paths: ["docs", "tests", "vendor"]
15+
php_code_sniffer:
16+
enabled: true
17+
config:
18+
standard: PSR2
19+
filter:
20+
paths: ["src/*", "tests/*"]
21+
excluded_paths: []
22+
php_cpd:
23+
enabled: true
24+
excluded_dirs: ["docs", "tests", "vendor"]
25+
php_cs_fixer:
26+
enabled: true
27+
config:
28+
level: all
29+
filter:
30+
paths: ["src/*", "tests/*"]
31+
php_loc:
32+
enabled: true
33+
excluded_dirs: ["docs", "tests", "vendor"]
34+
php_mess_detector:
35+
enabled: true
36+
config:
37+
ruleset: phpmd.xml.dist
38+
design_rules: { eval_expression: false }
39+
filter:
40+
paths: ["src/*"]
41+
php_pdepend:
42+
enabled: true
43+
excluded_dirs: ["docs", "tests", "vendor"]
44+
php_analyzer:
45+
enabled: true
46+
filter:
47+
paths: ["src/*", "tests/*"]
48+
sensiolabs_security_checker: true

‎.travis.yml‎

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,48 @@
11
language: php
2-
php:
3-
- 5.3.3
4-
- 5.3
5-
- 5.4
6-
- 5.5
7-
- 5.6
8-
- hhvm
9-
- hhvm-nightly
2+
php: [ 7.1, 7.2, 7.3, nightly ]
3+
sudo: false
4+
5+
env:
106

117
matrix:
12-
allow_failures:
13-
- php: hhvm
14-
- php: hhvm-nightly
8+
fast_finish: true
9+
allow_failures:
10+
- php: nightly
11+
12+
install:
13+
- travis_retry composer install --no-interaction --prefer-dist --optimize-autoloader
14+
- travis_retry composer global require phpunit/phpunit "^6" # cannot use phpunit.phar or require-dev, because this package is a phpunit dep
15+
- travis_retry wget --no-verbose https://phar.io/releases/phive.phar
1516

1617
script:
17-
- vendor/bin/phpunit
18+
- /home/travis/.composer/vendor/bin/phpunit --no-coverage
19+
20+
jobs:
21+
include:
22+
- stage: coverage
23+
php: 7.1
24+
script:
25+
- /home/travis/.composer/vendor/bin/phpunit
26+
after_script:
27+
- travis_retry php phive.phar --no-progress install --trust-gpg-keys E82B2FB314E9906E php-coveralls/php-coveralls && ./tools/php-coveralls --verbose
28+
- travis_retry wget --no-verbose https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
29+
30+
- stage: lint
31+
php: 7.1
32+
before_script:
33+
- travis_retry php phive.phar --no-progress install --trust-gpg-keys 8E730BA25823D8B5 phpstan
34+
script:
35+
- ./tools/phpstan analyse src --level max --configuration phpstan.neon
1836

19-
before_script:
20-
- sudo apt-get -qq update > /dev/null
21-
- phpenv rehash > /dev/null
22-
- composer selfupdate --quiet
23-
- composer install --no-interaction --prefer-source --dev
24-
- vendor/bin/phpunit
25-
- composer update --no-interaction --prefer-source --dev
37+
cache:
38+
directories:
39+
- $HOME/.composer/cache/files
40+
- $HOME/.phive
2641

2742
notifications:
2843
irc: "irc.freenode.org#phpdocumentor"
44+
slack:
45+
secure: "fjumM0h+4w3EYM4dpgqvpiCug7m4sSIC5+HATgwga/Nrc6IjlbWvGOv3JPgD3kQUhi18VmZfUYPmCv916SIbMnv8JWcrSaJXnPCgmxidvYkuzQDIw1HDJbVppGnkmwQA/qjIrM3sIEMfnu/arLRJQLI363aStZzGPxwIa4PDKcg="
2946
email:
30-
31-
32-
47+
48+

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2010 Mike van Riel
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

‎Makefile‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ARGS ?=
2+
3+
.PHONY: install-phive
4+
install-phive:
5+
wget -O tools/phive.phar https://phar.io/releases/phive.phar; \
6+
wget -O tools/phive.phar.asc https://phar.io/releases/phive.phar.asc; \
7+
gpg --keyserver pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79; \
8+
gpg --verify tools/phive.phar.asc tools/phive.phar; \
9+
chmod +x tools/phive.phar
10+
11+
.PHONY: setup
12+
setup: install-phive
13+
docker run -it --rm -v${CURDIR}:/opt/phpdoc -w /opt/phpdoc phpdoc/dev tools/phive.phar install --force-accept-unsigned
14+
15+
.PHONY: test
16+
test:
17+
docker-compose run --rm phpunit ${ARGS}
18+
docker-compose run --entrypoint=/usr/local/bin/php --rm phpunit tests/coverage-checker.php 69
19+
20+
.PHONY: pre-commit-test
21+
pre-commit-test: test

‎README.md‎

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,75 @@
1-
Reflection [![Build Status](https://secure.travis-ci.org/phpDocumentor/Reflection.png)](http://travis-ci.org/phpDocumentor/Reflection)
1+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2+
[![Travis Status](https://img.shields.io/travis/phpDocumentor/Reflection.svg?label=Linux)](https://travis-ci.org/phpDocumentor/Reflection)
3+
[![Appveyor Status](https://img.shields.io/appveyor/ci/phpDocumentor/Reflection.svg?label=Windows)](https://ci.appveyor.com/project/phpDocumentor/Reflection/branch/master)
4+
[![Coveralls Coverage](https://img.shields.io/coveralls/github/phpDocumentor/Reflection.svg)](https://coveralls.io/github/phpDocumentor/Reflection?branch=master)
5+
[![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/phpDocumentor/Reflection.svg)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=master)
6+
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/phpDocumentor/Reflection.svg)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=master)
7+
[![Stable Version](https://img.shields.io/packagist/v/phpDocumentor/Reflection.svg)](https://packagist.org/packages/phpDocumentor/Reflection)
8+
[![Unstable Version](https://img.shields.io/packagist/vpre/phpDocumentor/Reflection.svg)](https://packagist.org/packages/phpDocumentor/Reflection)
9+
10+
11+
Reflection
212
==========
313

4-
Reflection library to do Static Analysis for PHP Projects
14+
Using this library it is possible to statically reflect one or more files and create an object graph representing
15+
your application's structure, including accompanying in-source documentation using DocBlocks.
16+
17+
The information that this library provides is similar to what the (built-in) Reflection extension of PHP provides; there
18+
are however several advantages to using this library:
19+
20+
- Due to its Static nature it does not execute procedural code in your reflected files where Dynamic Reflection does.
21+
- Because the none of the code is interpreted by PHP (and executed) Static Reflection uses less memory.
22+
- Can reflect complete files
23+
- Can reflect a whole project by reflecting multiple files.
24+
- Reflects the contents of a DocBlock instead of just mentioning there is one.
25+
- Is capable of analyzing code written for any PHP version (starting at 5.2) up to and including your installed
26+
PHP version.
27+
28+
## Features
29+
30+
* [Creates an object graph] containing the structure of your application much like a site map shows the
31+
structure of a website.
32+
* Can read and interpret code of any PHP version starting with 5.2 up to and including your currently installed version
33+
of PHP.
34+
* Due it's clean interface it can be in any application without a complex setup.
35+
36+
## Installation
37+
38+
In order to inspect a codebase you need to tell composer to include the `phpdocumentor/reflection` package. This
39+
can easily be done using the following command in your command line terminal:
40+
41+
composer require "phpdocumentor/reflection: ~4.0"
42+
43+
After the installation is complete no further configuration is necessary and you can immediately start using it.
44+
45+
## Basic Usage
46+
47+
This Reflection library uses [PSR-4] and it is recommended to use a PSR-4 compatible autoloader to load all the
48+
files containing the classes for this library.
49+
50+
An easy way to do this is by including the [composer] autoloader as shown here:
51+
52+
include 'vendor/autoload.php';
53+
54+
Once that is done you can use the `createInstance()` method of the `\phpDocumentor\Reflection\Php\ProjectFactory` class to instantiate a new project factory and
55+
pre-configure it with sensible defaults. Optional you can specify the parser version that shall be used as an argument of `createInstance()`.
56+
By default the php7 parser is prefered. And php5 is used as a fallback. See the [documentation of phpparser] for more info.
57+
58+
$projectFactory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance();
59+
60+
At this point we are ready to analyze your complete project or just one file at the time. Just pass an array of file paths to the `create` method of the project factory.
61+
62+
$projectFiles = [new \phpDocumentor\Reflection\File\LocalFile('tests/example.file.php')];
63+
$project = $projectFactory->create('My Project', $projectFiles);
64+
65+
When the process is ready a new object of type `phpDocumentor\Reflection\Php\Project` will be returned that
66+
contains a complete hierarchy of all files with their classes, traits and interfaces (and everything in there), but also
67+
all namespaces and packages as a hierarchical tree.
68+
69+
> See the [example] script for a detailed and commented example
70+
71+
[Build Status]: https://secure.travis-ci.org/phpDocumentor/Reflection.png
72+
[PSR-4]: http://php-fig.com
73+
[example]: example.php
74+
[composer]: http://getcomposer.org
75+
[documentation of phpparser]: https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-2.0.md#creating-a-parser-instance

‎appveyor.yml‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
build: false
2+
clone_folder: c:\reflection
3+
max_jobs: 3
4+
platform: x86
5+
pull_requests:
6+
do_not_increment_build_number: true
7+
version: '{build}.{branch}'
8+
skip_tags: true
9+
branches:
10+
only:
11+
- develop
12+
13+
environment:
14+
matrix:
15+
- php_ver_target: 7.1
16+
- php_ver_target: 7.2
17+
matrix:
18+
fast_finish: false
19+
20+
cache:
21+
- c:\php -> appveyor.yml
22+
- '%LOCALAPPDATA%\Composer\files'
23+
24+
init:
25+
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
26+
- SET COMPOSER_NO_INTERACTION=1
27+
- SET PHP=1
28+
- SET ANSICON=121x90 (121x90)
29+
30+
31+
install:
32+
- IF EXIST c:\tools\php (SET PHP=0)
33+
- ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
34+
- cd c:\tools\php
35+
- IF %PHP%==1 copy /Y php.ini-development php.ini
36+
- IF %PHP%==1 echo max_execution_time=1200 >> php.ini
37+
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
38+
- IF %PHP%==1 echo extension_dir=ext >> php.ini
39+
- IF %PHP%==1 echo extension=php_curl.dll >> php.ini
40+
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
41+
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
42+
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
43+
- IF %PHP%==1 echo zend.assertions=1 >> php.ini
44+
- IF %PHP%==1 echo assert.exception=On >> php.ini
45+
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
46+
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
47+
- cd c:\reflection
48+
- composer install --no-interaction --prefer-dist --no-progress
49+
- composer global require phpunit/phpunit ^6
50+
- composer global config bin-dir --absolute
51+
52+
test_script:
53+
- cd c:\reflection
54+
- c:\Users\appveyor\AppData\Roaming\Composer\vendor\bin\phpunit --no-coverage

‎composer.json‎

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,33 @@
55
"homepage": "http://www.phpdoc.org",
66
"license": "MIT",
77
"autoload": {
8-
"psr-0": {
9-
"phpDocumentor": ["src/", "tests/unit/", "tests/mocks/"]
8+
"psr-4": {
9+
"phpDocumentor\\": "src/phpDocumentor"
1010
}
1111
},
12+
"autoload-dev": {
13+
"psr-4": {
14+
"phpDocumentor\\": [
15+
"tests/component/",
16+
"tests/unit/phpDocumentor",
17+
"tests/bench/"
18+
]
19+
}
20+
},
21+
"minimum-stability": "alpha",
1222
"require": {
13-
"php": ">=5.3.3",
23+
"php": ">=7.1",
1424
"psr/log": "~1.0",
15-
"nikic/php-parser": "^1.0",
16-
"phpdocumentor/reflection-docblock": "~2.0"
17-
},
18-
"suggests": {
19-
"symfony/event-dispatcher": "~2.1"
25+
"nikic/php-parser": "^4.0",
26+
"phpdocumentor/reflection-docblock": "^5"
2027
},
2128
"require-dev": {
22-
"behat/behat": "~2.4",
23-
"phpunit/phpunit": "~4.0",
24-
"mockery/mockery": "~0.8"
29+
"mockery/mockery": "~1.0",
30+
"mikey179/vfsstream": "~1.2"
2531
},
2632
"extra": {
2733
"branch-alias": {
28-
"dev-master": "3.0.x-dev"
34+
"dev-develop": "4.0.x-dev"
2935
}
3036
}
3137
}

0 commit comments

Comments
 (0)