Skip to content

Commit b7712a1

Browse files
committed
Merge branch 'release/2.2.0'
2 parents 1897091 + 699da6f commit b7712a1

File tree

4 files changed

+36
-19
lines changed

4 files changed

+36
-19
lines changed

CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,28 @@
22

33
All Notable changes to the **Quality Assurance - PHP** package.
44

5-
## [Unreleased]
5+
## [2.2.0]
6+
7+
### Added
8+
9+
- Add phpunit 10, 11 and 12 support.
10+
- Add phpstan 2.x support.
11+
- Add systemsdk/phpcpd.
12+
13+
### Updated
14+
15+
- Updated grumphp config.
16+
17+
### Removed
18+
19+
- Removed sebiastian/phpcpd.
20+
21+
## [2.1.0]
622

723
### Added
824

925
- Add Unused use statement rule to PHPCS checks.
26+
- 'Revert' is now a valid start of a commit message.
1027

1128
## [2.0.0]
1229

@@ -52,6 +69,7 @@ Initial setup of the qa-php package:
5269
- Add support for PHP 7.3+
5370
- Add support for PHP 8.0+
5471

72+
[2.2.0]: https://github.com/district09/php_package_qa-php/compare/2.1.0...2.2.0
5573
[2.1.0]: https://github.com/district09/php_package_qa-php/compare/2.0.0...2.1.0
5674
[2.0.0]: https://github.com/district09/php_package_qa-php/compare/1.1.0...2.0.0
5775
[1.1.0]: https://github.com/district09/php_package_qa-php/compare/1.0.1...1.1.0

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@
5151
"phpro/grumphp-shim": "^2.0",
5252
"phpspec/prophecy": "^1.10",
5353
"phpspec/prophecy-phpunit": "^2.0",
54-
"phpstan/phpstan": "^1.0",
54+
"phpstan/phpstan": "^1.0 || ^2.0",
5555
"phpstan/phpstan-deprecation-rules": "^1.0",
56-
"phpunit/phpunit": "^9",
57-
"sebastian/phpcpd": "^6.0",
56+
"phpunit/phpunit": "^9 || ^10 || ^11 || ^12",
5857
"slevomat/coding-standard": "^8.15",
5958
"squizlabs/php_codesniffer": "^3.5.6",
60-
"symfony/filesystem": "^5.2|^6.0|^7.0"
59+
"symfony/filesystem": "^5.2|^6.0|^7.0",
60+
"systemsdk/phpcpd": "^7.0 || ^8.0"
6161
}
6262
}

configs/grumphp.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ grumphp:
5151
- "#^main|^master|^develop|^\\d+(\\.\\d+)?\\.x|^(release|hotfix)/\\d+\\.\\d+\\.\\d+|^feature/([A-Z][A-Z\\d]+-\\d+|[a-z][a-z\\d]*(-[a-z\\d]+)*)$#"
5252
git_commit_message:
5353
matchers:
54-
- "/^([A-Z][A-Z\\d]+-\\d+(, [A-Z][A-Z\\d]+-\\d+)*: )?(Add|Change|Fix|Update|Remove|Refactor|Merge|RELEASE) /"
54+
- "/^([A-Z][A-Z\\d]+-\\d+(, [A-Z][A-Z\\d]+-\\d+)*: )?(Add|Change|Fix|Update|Remove|Refactor|Revert|Merge|RELEASE) /"
5555
case_insensitive: false
5656
phpcpd:
5757
exclude:
5858
- build
59+
- var
5960
- examples
6061
- tests
6162
- vendor
@@ -79,8 +80,6 @@ grumphp:
7980
- inc
8081
- js
8182
- php
82-
- twig
83-
- yml
8483
phpmd:
8584
ruleset:
8685
- phpmd.qa-php.xml

src/GrumPHP/EventListener/TaskEventListener.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ final class TaskEventListener
2626
private const FILETYPE_YAML = 'yaml';
2727
private const FILETYPE_NEON = 'neon';
2828

29+
/**
30+
* Blockmode for Neon::encode()
31+
* Neon::BLOCK is deprecated, we need to use the `$blockMode` parameter.
32+
*/
33+
private const BLOCK_MODE = true;
34+
2935
/**
3036
* Mapping of task types and their configuration files.
3137
*
@@ -102,7 +108,7 @@ public function createTaskConfig(TaskEvent $event): void
102108

103109
// Search for the candidates and merge or copy them.
104110
$filesystem = new Filesystem();
105-
$dataMerged = null;
111+
$dataMerged = [];
106112

107113
foreach ($candidates as $env_var => $file) {
108114
// Ignore if configured to skip or if the file is missing.
@@ -119,13 +125,7 @@ public function createTaskConfig(TaskEvent $event): void
119125
return;
120126
}
121127

122-
// Merge the data.
123-
if ($dataMerged === null) {
124-
$dataMerged = $data;
125-
} elseif ($data) {
126-
$beforeMerged = $dataMerged;
127-
$dataMerged = $this->arrayMergeRecursiveDistinct($data, $dataMerged);
128-
}
128+
$dataMerged = $this->arrayMergeRecursiveDistinct($data, $dataMerged);
129129
}
130130

131131
// Save the configuration file.
@@ -170,7 +170,7 @@ private function getTaskConfigFileInfo(TaskInterface $task): ?array
170170
* @return array|false
171171
* The configuration data or false if not supported.
172172
*/
173-
private function readTaskConfigFile(string $type, string $file)
173+
private function readTaskConfigFile(string $type, string $file): array|bool
174174
{
175175
switch ($type) {
176176
case self::FILETYPE_YAML:
@@ -201,7 +201,7 @@ private function writeTaskConfigFile(string $type, string $file, array $data): v
201201
break;
202202

203203
case self::FILETYPE_NEON:
204-
$rawData = Neon::encode($data, Neon::BLOCK);
204+
$rawData = Neon::encode($data, self::BLOCK_MODE);
205205
break;
206206

207207
default:
@@ -233,7 +233,7 @@ private function writeTaskConfigFile(string $type, string $file, array $data): v
233233
*/
234234
private function arrayMergeRecursiveDistinct(array $array1, array $array2): array
235235
{
236-
foreach ($array2 as $key => $value ) {
236+
foreach ($array2 as $key => $value) {
237237
if (is_array($value) && isset($array1[$key]) && is_array($array1[$key])) {
238238
$array1[$key] = $this->arrayMergeRecursiveDistinct($array1[$key], $value);
239239
continue;

0 commit comments

Comments
 (0)