Skip to content

Commit 4766907

Browse files
authored
Merge pull request #9 from mattiabasone/update
Update dependencies and code cleanup
2 parents 084ed19 + e42bfc0 commit 4766907

Some content is hidden

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

48 files changed

+868
-3942
lines changed

.github/workflows/php.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
8+
name: Test PHP ${{ matrix.php-versions }}
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
php-versions: ['7.4', '8.0', '8.1']
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: ${{ matrix.php-versions }}
21+
extensions: curl, mbstring, intl, libxml, simplexml
22+
coverage: xdebug
23+
- name: Get composer cache directory
24+
id: composer-cache-dir
25+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
26+
- name: Cache Composer packages
27+
id: composer-cache-restore
28+
uses: actions/cache@v2
29+
with:
30+
path: ${{ steps.composer-cache-dir.outputs.dir }}
31+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
32+
restore-keys: ${{ runner.os }}-composer-
33+
- name: Install dependencies
34+
run: (test -d vendor && echo vendor directory exists) || composer install --prefer-dist --no-progress --no-suggest
35+
- name: Run PHPUnit
36+
run: ./bin/phpunit --coverage-text --coverage-clover clover.xml
37+
- name: "[Code Coverage Report] Extract branch name"
38+
if: matrix.php-versions == '8.0'
39+
shell: bash
40+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
41+
id: extract_branch
42+
- name: "[Code Coverage Report] Checkout branch"
43+
if: matrix.php-versions == '8.0'
44+
shell: bash
45+
run: git fetch --depth 1 && git checkout ${{ steps.extract_branch.outputs.branch }}
46+
# - name: "[Code Coverage Report] Upload coverage"
47+
# if: matrix.php-versions == '8.0'
48+
# run: ./bin/ocular code-coverage:upload --format=php-clover clover.xml
49+
# - name: "[Coveralls] Send report"
50+
# if: matrix.php-versions == '8.0'
51+
# run: ./bin/php-coveralls -v -x clover.xml -o coveralls-upload.json
52+
# env:
53+
# COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@ vendor
22
node_modules
33
bin
44
phpunit.xml
5+
.php-cs-fixer.cache
6+
.phpunit.result.cache
7+
composer.lock
8+
/.coveralls.yml
9+
/clover.xml
10+
/coveralls-upload.json

.php-cs-fixer.dist.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
# https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/3.0/doc/rules/index.rst
3+
4+
$finder = PhpCsFixer\Finder::create()
5+
->in(['src', 'tests'])
6+
->exclude(['vendor'])
7+
;
8+
9+
return (new PhpCsFixer\Config())
10+
->setRules([
11+
'@Symfony' => true,
12+
'@PHP80Migration' => true,
13+
'blank_line_after_namespace' => true,
14+
'blank_line_after_opening_tag' => true,
15+
'blank_line_before_statement' => true,
16+
'constant_case' => true,
17+
'increment_style' => false,
18+
'lowercase_keywords' => true,
19+
'normalize_index_brace' => true,
20+
'no_closing_tag' => true,
21+
'no_extra_blank_lines' => true,
22+
'no_singleline_whitespace_before_semicolons' => true,
23+
'no_spaces_after_function_name' => true,
24+
'no_spaces_around_offset' => true,
25+
'no_superfluous_phpdoc_tags' => false,
26+
'no_unused_imports' => true,
27+
'no_useless_else' => true,
28+
'no_whitespace_before_comma_in_array' => true,
29+
'no_whitespace_in_blank_line' => true,
30+
'ordered_class_elements' => true,
31+
'ordered_imports' => true,
32+
'phpdoc_add_missing_param_annotation' => true,
33+
'phpdoc_align' => false,
34+
'phpdoc_order' => true,
35+
'phpdoc_separation' => false,
36+
'phpdoc_summary' => false,
37+
'phpdoc_to_comment' => false,
38+
'phpdoc_types_order' => ['null_adjustment' => 'always_first'],
39+
'protected_to_private' => true,
40+
'single_blank_line_at_eof' => true,
41+
'single_blank_line_before_namespace' => true,
42+
'single_line_comment_style' => false,
43+
'single_line_throw' => false,
44+
'single_quote' => false,
45+
'single_trait_insert_per_statement' => true,
46+
'yoda_style' => true,
47+
'whitespace_after_comma_in_array' => true,
48+
])
49+
->setFinder($finder)
50+
;

.travis.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

Gulpfile.coffee

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Install with composer
1818
``` json
1919
{
2020
"require": {
21-
"cypresslab/patch-manager": "1.0.*@dev"
21+
"cypresslab/patch-manager": "^2.0"
2222
}
2323
}
2424
```
@@ -43,3 +43,8 @@ And let you **patch entire collections** with multiple operations
4343
4444
Still interested? [Head over to the wiki...](https://github.com/matteosister/patch-manager/wiki) for documentation
4545

46+
## Useful commands for development
47+
48+
- `composer format`: runs php-cs-fixer
49+
- `composer analyse`: runs phpstan for static analysis
50+
- `composer test`: runs phpunit

composer.json

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
11
{
22
"name": "cypresslab/patch-manager",
33
"description": "A library to manage patch requests",
4-
"keywords": ["rest", "patch", "api", "symfony2", "bundle"],
4+
"keywords": ["rest", "patch", "api", "symfony", "bundle"],
55
"require": {
6-
"php": ">=5.4",
7-
"symfony/property-access": ">=3.0-stable",
8-
"symfony/http-foundation": ">=3.0-stable",
9-
"symfony/options-resolver": ">=3.0-stable",
10-
"symfony/dependency-injection": ">=3.0-stable",
11-
"symfony/http-kernel": ">=3.0-stable",
12-
"symfony/config": ">=3.0-stable",
13-
"symfony/event-dispatcher": ">=3.0-stable",
14-
"phpcollection/phpcollection": "~0.4"
6+
"php": "^7.4 || ^8.0",
7+
"ext-json": "*",
8+
"symfony/property-access": "^4.0 || ^5.0",
9+
"symfony/http-foundation": "^4.0 || ^5.0",
10+
"symfony/options-resolver": "^4.0 || ^5.0",
11+
"symfony/dependency-injection": "^4.0 || ^5.0",
12+
"symfony/http-kernel": "^4.0 || ^5.0",
13+
"symfony/config": "^4.0 || ^5.0",
14+
"symfony/event-dispatcher": "^4.0 || ^5.0",
15+
"phpcollection/phpcollection": "^0.5"
1516
},
1617
"require-dev": {
17-
"phpunit/phpunit": "~6.5",
18-
"mockery/mockery": "~1.0",
19-
"yohang/finite": "~1.1.0",
20-
"doctrine/orm": "~2.4.6"
18+
"friendsofphp/php-cs-fixer": "^3.1",
19+
"phpunit/phpunit": "^9.5",
20+
"mockery/mockery": "^1.4",
21+
"yohang/finite": "^1.2",
22+
"doctrine/orm": "^2.9",
23+
"phpspec/prophecy-phpunit": "^2.0",
24+
"phpstan/phpstan": "^0.12.99",
25+
"phpstan/phpstan-doctrine": "^0.12.44",
26+
"phpstan/phpstan-mockery": "^0.12.14",
27+
"php-coveralls/php-coveralls": "^2.4",
28+
"scrutinizer/ocular": "^1.8"
2129
},
2230
"autoload": {
2331
"psr-4": {
2432
"Cypress\\PatchManager\\": "src/PatchManager/",
2533
"Cypress\\PatchManager\\Tests\\": "tests/PatchManager/"
2634
}
2735
},
28-
"license": "LGPL-3.0+",
36+
"license": "LGPL-3.0-or-later",
2937
"authors": [
3038
{
3139
"name": "Matteo Giachino",
@@ -38,11 +46,16 @@
3846
"minimum-stability": "stable",
3947
"extra": {
4048
"branch-alias": {
41-
"dev-master": "1.0.x-dev"
49+
"dev-master": "2.0.x-dev"
4250
}
4351
},
4452
"suggest": {
4553
"yohang/finite": "PatchManager with op 'state_machine'",
4654
"doctrine/orm": "PatchManager with op 'data' and doctrine integration"
55+
},
56+
"scripts": {
57+
"analyse": "bin/phpstan analyse -c phpstan.neon -vvv --ansi",
58+
"format": "bin/php-cs-fixer fix --show-progress=dots --verbose --diff",
59+
"test": "@php bin/phpunit"
4760
}
4861
}

0 commit comments

Comments
 (0)