File tree Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Expand file tree Collapse file tree 3 files changed +68
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ before_install:
18
18
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
19
19
- export PATH="$PATH:$HOME/.composer/vendor/bin"
20
20
- wget https://phar.phpunit.de/phpunit-6.3.phar
21
+ - composer global require humbug/php-scoper:^1.0@dev
21
22
- if [[ $coverage = 1 ]]; then mkdir -p build/logs; fi
22
23
- if [[ $coverage = 1 ]]; then wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; fi
23
24
- if [[ $lint = 1 ]]; then wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.4.0/php-cs-fixer.phar; fi
@@ -36,6 +37,8 @@ script:
36
37
- |
37
38
if [[ ! $deps && $TRAVIS_PHP_VERSION = "7.1" ]]; then
38
39
composer install --no-dev --prefer-dist --classmap-authoritative --no-progress --no-suggest --ansi;
40
+ ~/.composer/vendor/bin/php-scoper add-prefix --output-dir=build/schema-generator;
41
+ composer -d=build/schema-generator dump-autoload --classmap-authoritative --no-dev;
39
42
php -d phar.readonly=0 box.phar build;
40
43
php schema.phar generate-types tmp/ tests/e2e/schema.yml;
41
44
diff tests/e2e/src/AppBundle/Entity/Person.php tmp/AppBundle/Entity/Person.php;
Original file line number Diff line number Diff line change 1
1
{
2
+ "base-path" : " build/schema-generator" ,
2
3
"directories" : [
3
4
" data/" ,
4
5
" src/" ,
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the API Platform project.
5
+ *
6
+ * (c) Kévin Dunglas <[email protected] >
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ declare (strict_types=1 );
13
+
14
+ use Isolated \Symfony \Component \Finder \Finder ;
15
+
16
+ return [
17
+ 'finders ' => [
18
+ Finder::create ()->files ()
19
+ ->in ('src ' )
20
+ ->in ('data ' )
21
+ ->in ('templates ' ),
22
+ Finder::create ()
23
+ ->files ()
24
+ ->ignoreVCS (true )
25
+ ->notName ('/LICENSE|.* \\.md|.* \\.dist|Makefile|composer \\.json|composer \\.lock/ ' )
26
+ ->exclude ([
27
+ 'doc ' ,
28
+ 'test ' ,
29
+ 'test_old ' ,
30
+ 'tests ' ,
31
+ 'Test ' ,
32
+ 'Tests ' ,
33
+ ])
34
+ ->in ('vendor ' ),
35
+ Finder::create ()->append ([
36
+ 'bin/schema ' ,
37
+ 'composer.json ' ,
38
+ ]),
39
+ Finder::create ()->append ([
40
+ 'vendor/friendsofphp/php-cs-fixer/tests/Test ' ,
41
+ ]),
42
+ ],
43
+ 'whitelist ' => [
44
+ 'ApiPlatform\Core\Annotation\ApiProperty ' ,
45
+ 'ApiPlatform\Core\Annotation\ApiResource ' ,
46
+ ],
47
+ 'patchers ' => [
48
+ function (string $ filePath , string $ prefix , string $ content ): string {
49
+ //
50
+ // PHP-CS-Fixer patch
51
+ //
52
+
53
+ if ($ filePath === __DIR__ .'/vendor/friendsofphp/php-cs-fixer/src/FixerFactory.php ' ) {
54
+ return preg_replace (
55
+ '/\$fixerClass = \'PhpCsFixer(.*?\;)/ ' ,
56
+ sprintf ('$fixerClass = \'%s \\PhpCsFixer$1 ' , $ prefix ),
57
+ $ content
58
+ );
59
+ }
60
+
61
+ return $ content ;
62
+ },
63
+ ],
64
+ ];
You can’t perform that action at this time.
0 commit comments