Skip to content

Commit eec8f67

Browse files
author
BackEndTea
committed
Initial commit
0 parents  commit eec8f67

21 files changed

+687
-0
lines changed

.build/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset=utf-8
5+
end_of_line=lf
6+
trim_trailing_whitespace=true
7+
insert_final_newline=true
8+
indent_style=space
9+
indent_size=4
10+
11+
[Makefile]
12+
indent_style=tab

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/vendor/
2+
composer.lock
3+
4+
*.swp
5+
.idea/

LICENSE

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

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# PHP Depend resolver
2+
3+
## What is this
4+
5+
This library allows you to find the dependencies of a php file.
6+
7+
It was created to help with another libary, that allows you to run tests for only changes files (and their dependencies)
8+
9+
## Usage
10+
```php
11+
<?php
12+
require_once __DIR__.'/vendor/autoload.php';
13+
14+
use Depend\DependencyFinder;
15+
16+
17+
$finder = new DependencyFinder([__DIR__.'/src/', './vendor/psr/container/src', __DIR__.'/tests']);
18+
19+
$finder->build();
20+
21+
$deps = $finder->getAllFilesDependingOn('./tests/Fixtures/Circular/A.php');
22+
23+
foreach ($deps as $dep) {
24+
var_dump($dep);
25+
}
26+
27+
$finder->reBuild(['./src/Domain/User.php', './tests/Domain/User.php', './src/functions.php']);
28+
```

composer.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "backendtea/dependency-finder",
3+
"description": "Find out exactly what classes depend on what other classes",
4+
"type": "library",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Gert de Pagter",
9+
"email": "BackEndTea@gmail.com"
10+
}
11+
],
12+
"require": {
13+
"php": "^7.2",
14+
"nikic/php-parser": "^4.2",
15+
"symfony/finder": "^4.3"
16+
},
17+
"require-dev": {
18+
"doctrine/coding-standard": "^6.0",
19+
"infection/infection": "^0.13.3",
20+
"phpstan/phpstan": "^0.11",
21+
"phpunit/phpunit": "^8.2"
22+
},
23+
"config": {
24+
"preferred-install": "dist",
25+
"sort-packages": true
26+
},
27+
"autoload": {
28+
"psr-4": {
29+
"Depend\\": "src/"
30+
}
31+
},
32+
"autoload-dev": {
33+
"psr-4": {
34+
"Depend\\Test\\": "tests/"
35+
}
36+
}
37+
}

infection.json.dist

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"timeout": 5,
3+
"source": {
4+
"directories": [
5+
"src"
6+
]
7+
},
8+
"logs": {
9+
"text": ".build/infection.log"
10+
},
11+
"mutators": {
12+
"@default": true
13+
}
14+
}

phpcs.xml.dist

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<arg name="basepath" value="."/>
4+
<arg name="extensions" value="php"/>
5+
<arg name="parallel" value="80"/>
6+
<arg name="cache" value=".build/phpcs-cache.cache" />
7+
<arg name="colors"/>
8+
9+
<!-- Ignore warnings, show progress of the run and show sniff names -->
10+
<arg value="nps"/>
11+
12+
<!-- Directories to be checked -->
13+
<file>src</file>
14+
<file>tests</file>
15+
16+
<!-- Include full Doctrine Coding Standard -->
17+
<rule ref="Doctrine"/>
18+
</ruleset>

phpstan.neon

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
includes:
2+
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
3+
- vendor/phpstan/phpstan/conf/config.levelmax.neon
4+
5+
parameters:
6+
paths:
7+
- src
8+
- tests
9+
tmpDir: %currentWorkingDirectory%/.build

phpunit.xml.dist

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="./vendor/autoload.php"
5+
colors="true"
6+
executionOrder="random"
7+
verbose="true"
8+
cacheResultFile="./.build/.phpunit.cache"
9+
>
10+
<testsuites>
11+
<testsuite name="Application Test Suite">
12+
<directory>./tests/</directory>
13+
<exclude>./tests/Fixtures</exclude>
14+
</testsuite>
15+
</testsuites>
16+
17+
<filter>
18+
<whitelist>
19+
<directory>./src/</directory>
20+
</whitelist>
21+
</filter>
22+
</phpunit>

0 commit comments

Comments
 (0)