Skip to content

Commit d83c48b

Browse files
Merge branch 'phpro:master' into master
2 parents b65f4a2 + 533e454 commit d83c48b

28 files changed

+789
-31
lines changed

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/depsreview.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: 'Dependency Review'
2+
on: [pull_request]
3+
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
dependency-review:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: 'Checkout Repository'
12+
uses: actions/checkout@v3
13+
- name: 'Dependency Review'
14+
uses: actions/dependency-review-action@v3

.github/workflows/grumphp.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
name: GrumPHP
22

33
on: [push, pull_request]
4+
permissions:
5+
contents: read
6+
47
jobs:
58
run:
69
runs-on: ${{ matrix.operating-system }}
710
strategy:
811
matrix:
912
operating-system: [ubuntu-latest, macos-latest] #windows-latest currently not working
10-
php-versions: ['7.4', '8.0', '8.1']
13+
php-versions: ['8.0', '8.1', '8.2']
1114
composer-options: ['', '--prefer-lowest']
1215
composer-versions: ['composer:v2']
1316
fail-fast: false
@@ -30,20 +33,22 @@ jobs:
3033
id: composercache
3134
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
3235
- name: Cache dependencies
33-
uses: actions/cache@v2
36+
uses: actions/cache@v3
3437
with:
3538
path: ${{ steps.composercache.outputs.dir }}
3639
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
3740
restore-keys: ${{ runner.os }}-composer-
3841
- name: Install dependencies
42+
if: matrix.php-versions != '8.2'
3943
run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }}
40-
# - name: Install dependencies (Ignore platform)
41-
# if: matrix.php-versions == '8.1'
42-
# run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }} --ignore-platform-req=php
44+
- name: Install dependencies (Ignore platform)
45+
if: matrix.php-versions == '8.2'
46+
run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }} --ignore-platform-req=php+
4347
- name: Set git variables
4448
run: |
4549
git config --global user.email "[email protected]"
4650
git config --global user.name "Your Name"
51+
git config --global protocol.file.allow always
4752
- name: Run the tests on Windows
4853
if: runner.os == 'Windows'
4954
run: php vendor/bin/grumphp run --no-interaction --testsuite=windows

appveyor.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ platform:
77

88
#matrix:
99
# allow_failures:
10-
# - php_version: 8.1
10+
# - php_version: 8.2
1111

1212
environment:
1313
matrix:
14+
# TODO : NOT AVAILABLE YET !
15+
# - dependencies: highest
16+
# php_version: 8.2
1417
- dependencies: highest
1518
php_version: 8.1
1619
- dependencies: highest
1720
php_version: 8.0
18-
- dependencies: highest
19-
php_version: 7.4
2021

2122
project_directory: c:\projects\grumphp
2223
composer_directory: c:\tools\composer
@@ -71,6 +72,7 @@ install:
7172
- IF %dependencies%==highest composer update --prefer-dist --no-progress --no-scripts --no-suggest --profile
7273
- git config --global user.email "[email protected]"
7374
- git config --global user.name "GrumPHP"
75+
- git config --global protocol.file.allow always
7476

7577
test_script:
7678
- ps: cd $Env:project_directory

composer.json

+15-13
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@
1414
}
1515
],
1616
"require": {
17-
"php": "^7.4 || ^8.0",
17+
"php": "^8.0",
1818
"ext-json": "*",
1919
"composer-plugin-api": "~2.0",
2020
"amphp/amp": "^2.6",
2121
"amphp/parallel": "^1.4",
2222
"amphp/parallel-functions": "^1.1",
23-
"doctrine/collections": "^1.6.8",
23+
"doctrine/collections": "^1.6.8 || ^2.0",
2424
"gitonomy/gitlib": "^1.3",
2525
"laravel/serializable-closure": "^1.1",
26-
"monolog/monolog": "^2.0",
26+
"monolog/monolog": "^2.0 || ^3.0",
2727
"ondram/ci-detector": "^4.0",
2828
"psr/container": "^1.1 || ^2.0",
2929
"seld/jsonlint": "~1.8",
30-
"symfony/config": "~5.3 || ~6.0",
31-
"symfony/console": "~5.3 || ~6.0",
32-
"symfony/dependency-injection": "~5.3 || ~6.0",
33-
"symfony/dotenv": "~5.3 || ~6.0",
34-
"symfony/event-dispatcher": "~5.3 || ~6.0",
35-
"symfony/filesystem": "~5.3 || ~6.0",
36-
"symfony/finder": "~5.3 || ~6.0",
37-
"symfony/options-resolver": "~5.3 || ~6.0",
38-
"symfony/process": "~5.3 || ~6.0",
39-
"symfony/yaml": "~5.3 || ~6.0"
30+
"symfony/config": "~5.4 || ~6.0",
31+
"symfony/console": "~5.4 || ~6.0",
32+
"symfony/dependency-injection": "~5.4 || ~6.0",
33+
"symfony/dotenv": "~5.4 || ~6.0",
34+
"symfony/event-dispatcher": "~5.4 || ~6.0",
35+
"symfony/filesystem": "~5.4 || ~6.0",
36+
"symfony/finder": "~5.4 || ~6.0",
37+
"symfony/options-resolver": "~5.4 || ~6.0",
38+
"symfony/process": "~5.4 || ~6.0",
39+
"symfony/yaml": "~5.4 || ~6.0"
4040
},
4141
"require-dev": {
4242
"amphp/sync": "^v1.4",
@@ -69,11 +69,13 @@
6969
"phan/phan": "Lets GrumPHP unleash a static analyzer on your code",
7070
"phing/phing": "Lets GrumPHP run your automated PHP tasks.",
7171
"php-parallel-lint/php-parallel-lint": "Lets GrumPHP quickly lint your entire code base.",
72+
"phparkitect/phparkitect": "Let GrumPHP keep your codebase coherent and solid, by permitting to add some architectural constraint check to your workflow.",
7273
"phpmd/phpmd": "Lets GrumPHP sort out the mess in your code",
7374
"phpspec/phpspec": "Lets GrumPHP spec your code.",
7475
"phpstan/phpstan": "Lets GrumPHP discover bugs in your code without running it.",
7576
"phpunit/phpunit": "Lets GrumPHP run your unit tests.",
7677
"povils/phpmnd": "Lets GrumPHP help you detect magic numbers in PHP code.",
78+
"rector/rector ": "Lets GrumPHP instantly upgrade and automatically refactor your PHP code.",
7779
"roave/security-advisories": "Lets GrumPHP be sure that there are no known security issues.",
7880
"sebastian/phpcpd": "Lets GrumPHP find duplicated code.",
7981
"squizlabs/php_codesniffer": "Lets GrumPHP sniff on your code.",

doc/tasks.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ grumphp:
5151
phpunitbridge: ~
5252
phpversion: ~
5353
progpilot: ~
54-
psalm: ~
54+
psalm: ~
55+
rector: ~
5556
robo: ~
5657
securitychecker_enlightn: ~
5758
securitychecker_local: ~
@@ -100,6 +101,7 @@ Every task has its own default configuration. It is possible to overwrite the pa
100101
- [Phan](tasks/phan.md)
101102
- [Phing](tasks/phing.md)
102103
- [Php7cc](tasks/php7cc.md)
104+
- [PhpArkitect](tasks/phparkitect.md)
103105
- [PhpCpd](tasks/phpcpd.md)
104106
- [Phpcs](tasks/phpcs.md)
105107
- [PHP-CS-Fixer](tasks/phpcsfixer.md)
@@ -114,6 +116,7 @@ Every task has its own default configuration. It is possible to overwrite the pa
114116
- [PhpVersion](tasks/phpversion.md)
115117
- [Progpilot](tasks/progpilot.md)
116118
- [Psalm](tasks/psalm.md)
119+
- [Rector](tasks/rector.md)
117120
- [Robo](tasks/robo.md)
118121
- [Security Checker](tasks/securitychecker.md)
119122
- [Enlightn](tasks/securitychecker/enlightn.md)

doc/tasks/deptrac.md

+7
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,18 @@ namespace and has following configurable parameters:
1212
grumphp:
1313
tasks:
1414
deptrac:
15+
cache_file: ~
1516
depfile: ~
1617
formatter: ~
1718
output: ~
1819
```
1920
21+
**cache_file**
22+
23+
*Default: null*
24+
25+
Set location where cache file will be stored. Example: `/var/www/src/.deptrac.cache`
26+
2027
**depfile**
2128

2229
*Default: null*

doc/tasks/paratest.md

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ grumphp:
2424
phpunit: null
2525
configuration: null
2626
runner: null
27-
debugger: null
2827
coverage-clover: null
2928
coverage-html: null
3029
coverage-php: null

doc/tasks/phparkitect.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# PHPArkitect
2+
3+
PHPArkitect helps you to keep your PHP codebase coherent and solid, by permitting to add some architectural constraint check to your workflow.
4+
It lives under the `phparkitect` namespace and has following configurable parameters:
5+
6+
PhpArkitect doesn't support checking only the changed files.
7+
It will always run on the directory specified in your config file.
8+
9+
## Composer
10+
```bash
11+
composer require --dev phparkitect/phparkitect
12+
```
13+
14+
## Config
15+
```yaml
16+
# grumphp.yml
17+
grumphp:
18+
tasks:
19+
phparkitect:
20+
config: ~
21+
target_php_version: ~
22+
stop_on_failure: ~
23+
```
24+
25+
**config**
26+
27+
*Default: null*
28+
29+
With this parameter you can specify the path your project's configuration file.
30+
By default PHPArkitect will search all rules in phparkitect.php located in the root of your project.
31+
32+
**target_php_version**
33+
34+
*Default: null*
35+
36+
With this parameter, you can specify which PHP version should use the parser.
37+
This can be useful to debug problems and to understand if there are problems with a different PHP version.
38+
39+
**stop_on_failure**
40+
41+
*Default: false*
42+
43+
With this option the process will end immediately after the first violation.

doc/tasks/phpcs.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ grumphp:
3030
sniffs: []
3131
triggered_by: [php]
3232
exclude: []
33-
33+
show_sniffs_error_path: true
3434
```
3535
3636
**standard**
@@ -130,6 +130,12 @@ This is a list of extensions to be sniffed. This list is also passed to phpcs us
130130

131131
A list of rules that should not be checked. Leave this option blank to run all configured rules for the selected standard.
132132

133+
**show_sniffs_error_path**
134+
135+
*Default: true*
136+
137+
Displays the sniff that triggered the error, allowing you to more easily find the specific rules with their namespaces.
138+
133139
## Framework presets
134140

135141
### Symfony 2

doc/tasks/rector.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Rector
2+
3+
Rector is a tool to instantly upgrade and automatically refactor your PHP 5.3+ code.
4+
It lives under the `rector` namespace and has following configurable parameters:
5+
6+
## Composer
7+
```bash
8+
composer require --dev rector/rector
9+
```
10+
11+
## Config
12+
```yaml
13+
# grumphp.yml
14+
grumphp:
15+
tasks:
16+
rector:
17+
config: null
18+
triggered_by: ['php']
19+
ignore_patterns: []
20+
clear_cache: true
21+
no_diffs: false
22+
```
23+
24+
**config**
25+
26+
*Default: null*
27+
28+
With this parameter you can specify the path your project's configuration file. When 'null' rector will run with the default file: rector.php
29+
30+
**triggered_by**
31+
32+
*Default: [php]*
33+
34+
This is a list of extensions to be sniffed.
35+
36+
37+
**ignore_patterns**
38+
39+
*Default: []*
40+
41+
This is a list of patterns that will be ignored by Rector. With this option you can skip files like
42+
tests. Leave this option blank to run Rector for every php file/directory specified in your
43+
configuration.
44+
45+
46+
**clear_cache**
47+
48+
*Default: true*
49+
50+
With this parameter you can run Rector without using the cache.
51+
52+
**no_diffs**
53+
54+
*Default: false*
55+
56+
With this parameter you can run Rector without showing file diffs.
57+

doc/tasks/securitychecker.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ You can use one of following tasks as a replacement:
66

77
- [securitychecker_enlightn](securitychecker/enlightn.md)
88
- [securitychecker_local](securitychecker/local.md)
9+
- [securitychecker_roave](securitychecker/roave.md)
910
- [securitychecker_symfony](securitychecker/symfony.md)

resources/config/tasks.yml

+14
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ services:
211211
tags:
212212
- {name: grumphp.task, task: php7cc}
213213

214+
GrumPHP\Task\PhpArkitect:
215+
arguments:
216+
- '@process_builder'
217+
- '@formatter.raw_process'
218+
tags:
219+
- {name: grumphp.task, task: phparkitect}
220+
214221
GrumPHP\Task\PhpCpd:
215222
arguments:
216223
- '@process_builder'
@@ -308,6 +315,13 @@ services:
308315
tags:
309316
- {name: grumphp.task, task: psalm}
310317

318+
GrumPHP\Task\Rector:
319+
arguments:
320+
- '@process_builder'
321+
- '@formatter.raw_process'
322+
tags:
323+
- { name: grumphp.task, task: rector }
324+
311325
GrumPHP\Task\Robo:
312326
arguments:
313327
- '@process_builder'

resources/config/util.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ services:
2121
'7.4': '2022-11-28 23:59:59'
2222
'8.0': '2023-11-26 23:59:59'
2323
'8.1': '2024-11-25 23:59:59'
24+
'8.2': '2025-12-08 23:59:59'

src/Configuration/Configuration.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ public function getConfigTreeBuilder(): TreeBuilder
6363
$rootNode->children()->arrayNode('extensions')->scalarPrototype();
6464

6565
// ascii
66-
$ascii = $rootNode->children()->arrayNode('ascii')->addDefaultsIfNotSet();
66+
$ascii = $rootNode->children()->arrayNode('ascii')->addDefaultsIfNotSet()->treatNullLike([
67+
'failed' => null,
68+
'succeeded' => null,
69+
]);
6770
$ascii->children()->variableNode('failed')->defaultValue('grumphp-grumpy.txt');
6871
$ascii->children()->variableNode('succeeded')->defaultValue('grumphp-happy.txt');
6972

src/Console/ApplicationConfigurator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class ApplicationConfigurator
1111
{
1212
const APP_NAME = 'GrumPHP';
13-
const APP_VERSION = '1.12.0';
13+
const APP_VERSION = '1.15.0';
1414

1515
public function configure(Application $application): void
1616
{

src/Parser/Php/Visitor/AbstractVisitor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function setContext(ParserContext $context): void
2727
protected function addError(string $message, int $line = -1, string $type = ParseError::TYPE_ERROR): void
2828
{
2929
$errors = $this->context->getErrors();
30-
$fileName = $this->context->getFile()->getPath();
30+
$fileName = $this->context->getFile()->getPathname();
3131
$errors->add(new PhpParserError($type, $message, $fileName, $line));
3232
}
3333
}

0 commit comments

Comments
 (0)