Skip to content

Commit bf5224e

Browse files
authored
Merge pull request #10 from eclipxe13/main
Review 2021-09-03
2 parents 99bea9a + 9f52d9b commit bf5224e

31 files changed

+437
-274
lines changed

Diff for: .gitattributes

+13-12
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
* text=auto
33

44
# Do not put this files on a distribution package (by .gitignore)
5-
/vendor export-ignore
6-
/composer.lock export-ignore
5+
/tools/ export-ignore
6+
/vendor/ export-ignore
7+
/composer.lock export-ignore
78

89
# Do not put this files on a distribution package
9-
/build/ export-ignore
10-
/tests/ export-ignore
11-
/.gitattributes export-ignore
12-
/.gitignore export-ignore
13-
/.php_cs.dist export-ignore
14-
/.scrutinizer.yml export-ignore
15-
/.travis.yml export-ignore
16-
/phpcs.xml.dist export-ignore
17-
/phpstan.neon.dist export-ignore
18-
/phpunit.xml.dist export-ignore
10+
/.github/ export-ignore
11+
/build/ export-ignore
12+
/tests/ export-ignore
13+
/.gitattributes export-ignore
14+
/.gitignore export-ignore
15+
/.php-cs-fixer.dist.php export-ignore
16+
/.scrutinizer.yml export-ignore
17+
/phpcs.xml.dist export-ignore
18+
/phpstan.xml.dist export-ignore
19+
/phpunit.xml.dist export-ignore

Diff for: .github/CODEOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# see https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
2+
/.github/* @phpcfdi/core-mantainers

Diff for: .github/workflows/build.yml

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: build
2+
on:
3+
pull_request:
4+
branches: [ main ]
5+
push:
6+
branches: [ main ]
7+
schedule:
8+
- cron: '0 16 * * 0' # sunday 16:00
9+
10+
jobs:
11+
12+
ci: # this job runs all the development tools and upload code coverage to scrutinizer
13+
14+
name: PHP 8.0 (full)
15+
runs-on: "ubuntu-latest"
16+
17+
steps:
18+
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
# see https://github.com/marketplace/actions/setup-php-action
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: '8.0'
27+
extensions: mbstring, openssl
28+
coverage: xdebug
29+
tools: composer:v2, phpcs, php-cs-fixer, phpstan, cs2pr
30+
env:
31+
fail-fast: true
32+
33+
- name: Get composer cache directory
34+
id: composer-cache
35+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
36+
37+
- name: Cache dependencies
38+
uses: actions/cache@v2
39+
with:
40+
path: ${{ steps.composer-cache.outputs.dir }}
41+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
42+
restore-keys: ${{ runner.os }}-composer-
43+
44+
- name: Install project dependencies
45+
run: composer upgrade --no-interaction --no-progress --prefer-dist
46+
47+
- name: Code style (phpcs)
48+
run: phpcs -q --report=checkstyle | cs2pr
49+
50+
- name: Code style (php-cs-fixer)
51+
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr
52+
53+
- name: Tests (phpunit with code coverage)
54+
run: vendor/bin/phpunit --testdox --verbose --coverage-clover=build/coverage-clover.xml --coverage-xml=build/coverage --log-junit=build/coverage/junit.xml
55+
56+
- name: Code analysis (phpstan)
57+
run: phpstan analyse --no-progress --verbose
58+
59+
# see https://github.com/marketplace/actions/action-scrutinizer
60+
- name: Upload code coverage to scrutinizer
61+
uses: sudo-bot/action-scrutinizer@latest
62+
with:
63+
cli-args: "--format=php-clover build/coverage-clover.xml"
64+
continue-on-error: true
65+
66+
build: # this job runs tests on all php supported versions
67+
68+
name: PHP ${{ matrix.php-versions }} (tests)
69+
runs-on: "ubuntu-latest"
70+
71+
strategy:
72+
matrix:
73+
php-versions: ['7.3', '7.4']
74+
75+
steps:
76+
77+
- name: Checkout
78+
uses: actions/checkout@v2
79+
80+
# see https://github.com/marketplace/actions/setup-php-action
81+
- name: Setup PHP
82+
uses: shivammathur/setup-php@v2
83+
with:
84+
php-version: ${{ matrix.php-versions }}
85+
extensions: mbstring, openssl
86+
coverage: none
87+
tools: composer:v2, cs2pr
88+
env:
89+
fail-fast: true
90+
91+
- name: Get composer cache directory
92+
id: composer-cache
93+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
94+
95+
- name: Cache dependencies
96+
uses: actions/cache@v2
97+
with:
98+
path: ${{ steps.composer-cache.outputs.dir }}
99+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
100+
restore-keys: ${{ runner.os }}-composer-
101+
102+
- name: Install project dependencies
103+
run: composer upgrade --no-interaction --no-progress --prefer-dist
104+
105+
- name: Tests
106+
run: vendor/bin/phpunit --testdox --verbose

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# do not include this files on git
2-
/vendor
2+
/tools/
3+
/vendor/
34
/composer.lock

Diff for: .phive/phars.xml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phive xmlns="https://phar.io/phive">
3+
<phar name="php-cs-fixer" version="^3.1.0" installed="3.1.0" location="./tools/php-cs-fixer" copy="false"/>
4+
<phar name="phpcs" version="^3.6.0" installed="3.6.0" location="./tools/phpcs" copy="false"/>
5+
<phar name="phpcbf" version="^3.6.0" installed="3.6.0" location="./tools/phpcbf" copy="false"/>
6+
<phar name="phpstan" version="^0.12.98" installed="0.12.98" location="./tools/phpstan" copy="false"/>
7+
</phive>

Diff for: .php_cs.dist renamed to .php-cs-fixer.dist.php

+21-19
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
11
<?php
22

3+
/**
4+
* @noinspection PhpUndefinedClassInspection
5+
* @noinspection PhpUndefinedNamespaceInspection
6+
* @see https://cs.symfony.com/doc/ruleSets/
7+
* @see https://cs.symfony.com/doc/rules/
8+
*/
9+
310
declare(strict_types=1);
411

5-
return PhpCsFixer\Config::create()
12+
return (new PhpCsFixer\Config())
613
->setRiskyAllowed(true)
7-
->setCacheFile(__DIR__ . '/build/.php_cs.cache')
14+
->setCacheFile(__DIR__ . '/build/php_cs.cache')
815
->setRules([
9-
'@PSR2' => true,
10-
'@PHP70Migration' => true,
11-
'@PHP70Migration:risky' => true,
12-
'@PHP71Migration' => true,
16+
'@PSR12' => true,
17+
'@PSR12:risky' => true,
1318
'@PHP71Migration:risky' => true,
19+
'@PHP73Migration' => true,
20+
// PSR12 (remove when php-cs-fixer reaches ^3.1.1)
21+
'class_definition' => ['space_before_parenthesis' => true],
1422
// symfony
15-
'class_attributes_separation' => true,
23+
// 'class_attributes_separation' => true, // conflict with PSR12
1624
'whitespace_after_comma_in_array' => true,
1725
'no_empty_statement' => true,
1826
'no_extra_blank_lines' => true,
1927
'function_typehint_space' => true,
20-
'no_alias_functions' => true,
21-
'trailing_comma_in_multiline_array' => true,
22-
'new_with_braces' => true,
23-
'no_blank_lines_after_class_opening' => true,
2428
'no_blank_lines_after_phpdoc' => true,
2529
'object_operator_without_whitespace' => true,
2630
'binary_operator_spaces' => true,
2731
'phpdoc_scalar' => true,
28-
'self_accessor' => true,
2932
'no_trailing_comma_in_singleline_array' => true,
3033
'single_quote' => true,
3134
'no_singleline_whitespace_before_semicolons' => true,
3235
'no_unused_imports' => true,
33-
'no_whitespace_in_blank_line' => true,
3436
'yoda_style' => ['equal' => true, 'identical' => true, 'less_and_greater' => null],
3537
'standardize_not_equals' => true,
36-
// contrib
3738
'concat_space' => ['spacing' => 'one'],
38-
'not_operator_with_successor_space' => true,
39-
'single_blank_line_before_namespace' => true,
4039
'linebreak_after_opening_tag' => true,
41-
'blank_line_after_opening_tag' => true,
42-
'ordered_imports' => true,
43-
'array_syntax' => ['syntax' => 'short'],
40+
// symfony:risky
41+
'no_alias_functions' => true,
42+
'self_accessor' => true,
43+
// contrib
44+
'not_operator_with_successor_space' => true,
4445
])
4546
->setFinder(
4647
PhpCsFixer\Finder::create()
4748
->in(__DIR__)
49+
->append([__FILE__])
4850
->exclude(['vendor', 'build'])
4951
)
5052
;

Diff for: .scrutinizer.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
filter:
22
excluded_paths:
33
- 'tests/'
4+
dependency_paths:
5+
- 'tools/'
46
- 'vendor/'
57

68
build:
79
dependencies:
810
override:
9-
- composer self-update --no-interaction --no-progress
10-
- composer remove squizlabs/php_codesniffer friendsofphp/php-cs-fixer phpstan/phpstan --dev --no-interaction --no-progress --no-update
11-
- composer install --no-interaction
11+
- composer update --no-interaction --prefer-dist
1212
nodes:
13-
php:
13+
analysis: # see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/
14+
project_setup: {override: true}
1415
tests:
1516
override:
1617
- php-scrutinizer-run --enable-security-analysis
17-
- command: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
18-
coverage:
19-
file: coverage.clover
20-
format: clover
18+
19+
tools:
20+
external_code_coverage: true

Diff for: .travis.yml

-25
This file was deleted.

0 commit comments

Comments
 (0)