Skip to content

Commit 613fc87

Browse files
authored
Merge pull request #9 from mike4git/feature/update-php-and-pimcore
Update PHP 8.2 & Pimcore 11
2 parents c24b5f0 + c27da6c commit 613fc87

12 files changed

+77
-48
lines changed

.github/workflows/php.yml

+53-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PHP Composer
1+
name: test-and-qa
22

33
on:
44
push:
@@ -10,41 +10,70 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
build:
14-
name: Build
15-
13+
TestsCompatibilityJobs:
1614
runs-on: ubuntu-latest
1715

16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- php-version: "8.0"
21+
dependencies: "lowest"
22+
1823
steps:
19-
- uses: actions/checkout@v3
24+
- name: Git Checkout
25+
uses: actions/checkout@v3
26+
27+
- name: PHP Setup
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php-version }}
2031

2132
- name: Validate composer.json and composer.lock
22-
run: bin/composer validate --strict
33+
run: composer validate --strict
2334

24-
- name: Cache Composer packages
25-
id: composer-cache
26-
uses: actions/cache@v3
35+
- name: Install dependencies
36+
uses: ramsey/composer-install@v2
2737
with:
28-
path: vendor
29-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
30-
restore-keys: |
31-
${{ runner.os }}-php-
38+
dependency-versions: ${{ matrix.dependencies }}
3239

33-
- name: Install dependencies
34-
run: bin/composer install --prefer-dist --no-progress
40+
- name: Execute tests
41+
run: composer tests
42+
43+
TestsAndQaJobs:
44+
runs-on: ubuntu-latest
3545

36-
- name: Run tests with phpunit
37-
run: bin/composer tests
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
include:
50+
- php-version: "8.1"
51+
dependencies: "highest"
52+
- php-version: "8.2"
53+
dependencies: "highest"
3854

39-
- name: Send code coverage report to Codecov.io
40-
uses: codecov/codecov-action@v2
55+
steps:
56+
- name: Git Checkout
57+
uses: actions/checkout@v3
58+
59+
- name: PHP Setup
60+
uses: shivammathur/setup-php@v2
4161
with:
42-
token: 56f489e7-c92b-4851-bfc6-5fa9a93f0426
43-
files: reports/clover.xml
62+
php-version: ${{ matrix.php-version }}
4463

45-
- name: Check CS-Fixer
46-
run: bin/composer fix-cs:check
64+
- name: Validate composer.json and composer.lock
65+
run: composer validate --strict
66+
67+
- name: Install dependencies
68+
uses: ramsey/composer-install@v2
69+
with:
70+
dependency-versions: ${{ matrix.dependencies }}
4771

72+
- name: Check CS-Fixer
73+
run: composer cs:check
4874

4975
- name: Check PHPStan
50-
run: bin/composer phpstan-gitlab
76+
run: composer phpstan
77+
78+
- name: Execute tests
79+
run: composer tests

compose.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
php:
3+
image: pimcore/pimcore:php8.2.8-v2.0
4+
volumes:
5+
- ./:/var/www/html/
6+
environment:
7+
XDEBUG_MODE: coverage
8+
expose:
9+
- 9003 # xdebug 3 port!

composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
}
3434
},
3535
"require": {
36-
"php": "^8.0",
37-
"pimcore/pimcore": "^10.0"
36+
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
37+
"pimcore/pimcore": "^10.0 || ^11.0"
3838
},
3939
"require-dev": {
4040
"friendsofphp/php-cs-fixer": "^3.8",
@@ -52,8 +52,8 @@
5252
}
5353
},
5454
"scripts": {
55-
"fix-cs:fix": "php-cs-fixer fix",
56-
"fix-cs:check": "php-cs-fixer fix --dry-run --diff",
55+
"cs:fix": "php-cs-fixer fix",
56+
"cs:check": "php-cs-fixer fix --dry-run --diff",
5757
"phpstan": "phpstan analyse --level=${PHPSTAN_LEVEL:-8} -c phpstan.neon",
5858
"phpstan-gitlab": "phpstan analyse -c phpstan.neon --memory-limit=1G --no-progress --level=${PHPSTAN_LEVEL:-8} --error-format=gitlab > reports/codeclimate.json",
5959
"tests": "phpunit --coverage-text --colors=never --log-junit=reports/junit.xml --coverage-clover=reports/clover.xml --coverage-html=reports/coverage tests"

docker-compose.yml

-13
This file was deleted.

src/Service/ClassDefinition2UMLService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function generateClassBox(ClassDefinition $classDefinition): void
4444
/** @var ClassDefinition\Data $definition */
4545
foreach ($locFieldDef->getChildren() as $definition) {
4646
$attribute = new Attribute();
47-
$attribute->setName($definition->getName())
47+
$attribute->setName($definition->getName() ?? self::UNKNOWN)
4848
->setType($definition->getPhpdocReturnType() ?? self::UNKNOWN)
4949
->setModifier('protected')
5050
->setAdditionalInfo('localized');

src/UMLGenerationBundle.php

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
class UMLGenerationBundle extends AbstractPimcoreBundle
99
{
10+
/**
11+
* @return array<string>
12+
*/
1013
public function getJsPaths(): array
1114
{
1215
return [

tests/Unit/Formatter/AttributeFormatterTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function sampleAttribute(): iterable
6161

6262
/**
6363
* @test
64+
*
6465
* @dataProvider sampleAttribute
6566
*/
6667
public function format_regular_case(

tests/Unit/Formatter/ClassFormatterTest.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,8 @@ public function sampleClass(): iterable
4343

4444
/**
4545
* @test
46-
* @dataProvider sampleClass
4746
*
48-
* @param $className
49-
* @param $classId
50-
* @param $stereotype
47+
* @dataProvider sampleClass
5148
*/
5249
public function format_regular_case(
5350
string $className,

tests/Unit/Formatter/RelationsFormatterTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function sampleRelations(): iterable
6161

6262
/**
6363
* @test
64+
*
6465
* @dataProvider sampleRelations
6566
*/
6667
public function format_regular_case(

tests/Unit/Handler/Relation/ManyToManyRelationHandlerTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function sampleScenarios(): iterable //@phpstan-ignore-line
2828

2929
/**
3030
* @test
31+
*
3132
* @dataProvider sampleScenarios
3233
*
3334
* @param class-string<mixed> $class

tests/Unit/Service/Class2UMLServiceTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function sampleAttributes(): iterable
6868

6969
/**
7070
* @test
71+
*
7172
* @dataProvider sampleAttributes
7273
*/
7374
public function generateClassBoxForClass(int $attributeIndex, string $name, string $type, string $modifier, bool $static): void
@@ -108,6 +109,7 @@ public function sampleRelations(): iterable //@phpstan-ignore-line
108109

109110
/**
110111
* @test
112+
*
111113
* @dataProvider sampleRelations
112114
*/
113115
public function generateRelationsForClasses(

tests/Unit/Service/ClassDefinition2UMLServiceTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,8 @@ public function combinationsOfFieldDefs(): iterable
141141

142142
/**
143143
* @test
144-
* @dataProvider combinationsOfFieldDefs
145144
*
146-
* @param $mandatory
145+
* @dataProvider combinationsOfFieldDefs
147146
*/
148147
public function generateClassBox_classdefinition_with_manytomany_relation_field(bool $mandatory, ?int $maxItems, string $cardinality): void
149148
{

0 commit comments

Comments
 (0)