Skip to content

Commit d2fb4d4

Browse files
authored
Allow to whitelist specific classes (#88)
1 parent dcddf73 commit d2fb4d4

File tree

56 files changed

+1722
-1269
lines changed

Some content is hidden

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

56 files changed

+1722
-1269
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cache:
1212

1313
matrix:
1414
include:
15-
- php: '7.0'
15+
- php: '7.1'
1616
env: COVERAGE='true'
1717
- php: '7.1'
1818
- php: nightly
@@ -30,7 +30,8 @@ script:
3030
- |
3131
if [ "$COVERAGE" == "true" ]; then
3232
make tc
33-
make e2e
33+
#TODO: skipped for now
34+
#make e2e
3435
else
3536
make tu
3637
fi

Makefile

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ help:
1515
##---------------------------------------------------------------------------
1616

1717
build: ## Build the PHAR
18-
build: vendor vendor-bin/box/vendor
18+
build: src vendor vendor-bin/box/vendor
1919
# Cleanup existing artefacts
2020
rm -f bin/php-scoper.phar
2121
rm -rf build
@@ -46,7 +46,8 @@ tc: vendor
4646
phpdbg -qrr -d zend.enable_gc=0 $(PHPUNIT) --coverage-html=dist/coverage --coverage-text
4747

4848
e2e: ## Run end-to-end tests
49-
e2e: bin/scoper.phar fixtures/set005/vendor
49+
e2e: bin/scoper.phar fixtures/set005/vendor fixtures/set011/vendor
50+
# Set004
5051
php -d zend.enable_gc=0 $(PHPSCOPER) add-prefix fixtures/set004 -o build/set004 -f
5152
composer -d=build/set004 dump-autoload
5253
php -d zend.enable_gc=0 -d phar.readonly=0 $(BOX) build -c build/set004/box.json.dist
@@ -55,13 +56,28 @@ e2e: bin/scoper.phar fixtures/set005/vendor
5556
diff fixtures/set004/expected-output build/output
5657

5758

59+
# Set005
5860
php -d zend.enable_gc=0 $(PHPSCOPER) add-prefix fixtures/set005 -o build/set005 -f
5961
composer -d=build/set005 dump-autoload
6062
php -d zend.enable_gc=0 -d phar.readonly=0 $(BOX) build -c build/set005/box.json.dist
6163

6264
php build/set005/bin/greet.phar > build/output
6365
diff fixtures/set005/expected-output build/output
6466

67+
68+
# Set0011
69+
# Skipped for now
70+
# # TMP: replace bin/php-scoper by $(PHPSCOPER)
71+
# php -d zend.enable_gc=0 bin/php-scoper add-prefix -o build/set011 -f -c fixtures/set011/scoper.inc.php -p PhpScoper598627d709dd4
72+
# # Leave the `tests` autoloading of the `composer.json` intact
73+
# cp -f build/set011/composer.json.dist build/set011/composer.json
74+
# composer -d=build/set011 dump-autoload
75+
# php -d zend.enable_gc=0 -d phar.readonly=0 $(BOX) build -c build/set011/box.json.dist
76+
# cp -R fixtures/set011/tests build/set011
77+
#
78+
# php build/set011/bin/greet.phar > build/output
79+
# diff fixtures/set011/expected-output build/output
80+
6581
tb: ## Run Blackfire profiling
6682
tb: vendor
6783
rm -rf build
@@ -84,6 +100,9 @@ vendor-bin/box/vendor: vendor-bin/box/composer.lock
84100
fixtures/set005/vendor: fixtures/set005/composer.lock
85101
composer -d=fixtures/set005 install
86102

103+
fixtures/set011/vendor: fixtures/set011/composer.lock
104+
composer -d=fixtures/set011 install
105+
87106
composer.lock: composer.json
88107
@echo compose.lock is not up to date.
89108

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ branches:
1010
environment:
1111
matrix:
1212
- dependencies: highest
13-
php_ver_target: 7.0
13+
php_ver_target: 7.1
1414
- dependencies: highest
1515
php_ver_target: 7.1
1616

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
],
1919

2020
"require": {
21-
"php": "^7.0",
21+
"php": "^7.1",
22+
"myclabs/deep-copy": "^1.6",
2223
"nikic/php-parser": "^3.0",
2324
"ocramius/package-versions": "^1.1",
2425
"padraic/phar-updater": "^1.0",

composer.lock

Lines changed: 43 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fixtures/set011/bin/greet.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
require_once __DIR__.'/../vendor/autoload.php';
6+
7+
use Set011\DirectionaryLocator;
8+
use Set011\Greeter;
9+
use Set011\Dictionary;
10+
11+
$dir = Phar::running(false);
12+
if ('' === $dir) {
13+
// Running outside of a PHAR
14+
$dir = __DIR__.DIRECTORY_SEPARATOR.'bin';
15+
}
16+
17+
$testDir = dirname($dir).'/../tests';
18+
19+
$dictionaries = DirectionaryLocator::locateDictionaries($testDir);
20+
21+
$words = array_reduce(
22+
$dictionaries,
23+
function (array $words, Dictionary $dictionary): array {
24+
$words = array_merge($words, $dictionary->provideWords());
25+
26+
return $words;
27+
},
28+
[]
29+
);
30+
31+
$greeter = new Greeter($words);
32+
33+
foreach ($greeter->greet() as $greeting) {
34+
echo $greeting.PHP_EOL;
35+
}

fixtures/set011/box.json.dist

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"output": "build/set011/bin/greet.phar",
3+
"main": "bin/greet.php",
4+
"base-path": "build/set011",
5+
"directories": [
6+
"src",
7+
"vendor"
8+
],
9+
"compression": "GZ",
10+
"compactors": [
11+
"Herrera\\Box\\Compactor\\Json",
12+
"Herrera\\Box\\Compactor\\Php"
13+
],
14+
"stub": true
15+
}

fixtures/set011/composer.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"bin": [
3+
"bin/greet"
4+
],
5+
"autoload": {
6+
"psr-4": {
7+
"Set011\\": "src/"
8+
}
9+
},
10+
"autoload-dev": {
11+
"psr-4": {
12+
"Set011\\": "tests/"
13+
}
14+
}
15+
}

fixtures/set011/composer.json.dist

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"bin": [
3+
"bin/greet"
4+
],
5+
"autoload": {
6+
"psr-4": {
7+
"PhpScoper598627d709dd4\\Set011\\": "src/",
8+
"Set011\\": "src/"
9+
}
10+
},
11+
"autoload-dev": {
12+
"psr-4": {
13+
"Set011\\": "tests/"
14+
}
15+
}
16+
}

fixtures/set011/expected-output

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Hello world!
2+
Hi world!
3+
Salut world!
4+
Bonjour world!

0 commit comments

Comments
 (0)