Skip to content

Commit 6e9d7ed

Browse files
authored
Maintenance - Sonata 3, Sf 4, PHP 7.3 dropped (#53)
* first draft * first draft * first draft * dropped sonata 3 and sf 4.4 * dropped sonata 3 and sf 4.4 * fixes * fixes * fixes * fixes * fixes * fixes * fixes * dropped sf 6.0 and 6.1 * upgraded Dockerfile * applied rector with level php80 * rector annotations to attributes * improvements in docker * removed rector config * fixed composer dependencies * minor fixes * minor refactor --------- Co-authored-by: Alex Sánchez <alejandro@runroom.com>
1 parent 5bb597d commit 6e9d7ed

35 files changed

+279
-323
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
bin export-ignore
44
tests export-ignore
55
docs export-ignore
6+
Dockerfile export-ignore
7+
Makefile export-ignore

.github/workflows/ci.yaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,19 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
php: ['7.4', '8.0', '8.1']
14+
php: ['8.0', '8.1', '8.2']
1515
dependencies: [highest]
1616
symfony-require: [highest]
1717
include:
18-
- php: '7.4'
18+
- php: '8.0'
1919
dependencies: lowest
2020
symfony-require: highest
21-
- php: '8.1'
22-
dependencies: highest
23-
symfony-require: 4.4.*
24-
- php: '8.1'
21+
- php: '8.2'
2522
dependencies: highest
2623
symfony-require: 5.4.*
27-
- php: '8.1'
28-
dependencies: highest
29-
symfony-require: 6.0.*
30-
- php: '8.1'
24+
- php: '8.2'
3125
dependencies: highest
32-
symfony-require: 6.1.*
26+
symfony-require: 6.2.*
3327
env:
3428
SYMFONY_REQUIRE: ${{matrix.symfony-require}}
3529
steps:

.github/workflows/qa.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
php: ['8.1']
14+
php: ['8.2']
1515
steps:
1616
- uses: actions/checkout@v3
1717
- uses: shivammathur/setup-php@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ vendor
66
.php-cs-fixer.cache
77
node_modules
88
package-lock.json
9+
coverage

Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM alpine:3.17
2+
3+
ARG PHP_VERSION=81
4+
ARG UID=1000
5+
ARG USER=app
6+
7+
RUN apk add --no-cache \
8+
php${PHP_VERSION} \
9+
php${PHP_VERSION}-gd \
10+
php${PHP_VERSION}-intl \
11+
php${PHP_VERSION}-opcache \
12+
php${PHP_VERSION}-zip \
13+
php${PHP_VERSION}-phar \
14+
php${PHP_VERSION}-iconv \
15+
php${PHP_VERSION}-mbstring \
16+
php${PHP_VERSION}-openssl \
17+
php${PHP_VERSION}-curl \
18+
php${PHP_VERSION}-dom \
19+
php${PHP_VERSION}-tokenizer \
20+
php${PHP_VERSION}-xml \
21+
php${PHP_VERSION}-simplexml \
22+
php${PHP_VERSION}-xmlreader \
23+
php${PHP_VERSION}-xmlwriter \
24+
php${PHP_VERSION}-session \
25+
php${PHP_VERSION}-pdo_sqlite \
26+
php${PHP_VERSION}-pecl-pcov --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
27+
28+
RUN adduser -u $UID -D $USER
29+
30+
ENV PATH="/usr/app/vendor/bin:/usr/app/bin:${PATH}"
31+
32+
COPY --from=composer:2.5 /usr/bin/composer /usr/bin/composer
33+
34+
USER ${USER}
35+
36+
WORKDIR /usr/app

Makefile

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
UID = $(shell id -u)
2+
GID = $(shell id -g)
3+
PHP_VERSION="8.2"
4+
CONTAINER_NAME = runroom_samples_bundle
5+
docker-exec = docker run --rm -v $(PWD):/usr/app -w /usr/app $(CONTAINER_NAME) $(1)
6+
7+
up:
8+
docker build -t $(CONTAINER_NAME) .
9+
docker run -d -v $(PWD):/usr/app --name $(CONTAINER_NAME) $(CONTAINER_NAME)
10+
.PHONY: up
11+
12+
halt:
13+
@if [ `docker ps --filter name=$(CONTAINER_NAME) --format "{{.ID}}"` ]; then \
14+
docker stop $(CONTAINER_NAME); \
15+
fi
16+
.PHONY: halt
17+
18+
destroy:
19+
@if [ `docker ps --filter name=$(CONTAINER_NAME) --format "{{.ID}}"` ]; then \
20+
docker rm -f $(CONTAINER_NAME); \
21+
fi
22+
.PHONY: destroy
23+
24+
build: halt destroy
25+
docker build --build-arg UID=$(UID) --build-arg GID=$(GID) -t $(CONTAINER_NAME) .
26+
.PHONY: build
27+
28+
provision: composer-install
29+
30+
down:
31+
docker stop $(CONTAINER_NAME) && docker rm $(CONTAINER_NAME)
32+
.PHONY: down
33+
34+
ssh:
35+
docker run --rm -it -v $(PWD):/usr/app -w /usr/app $(CONTAINER_NAME) sh
36+
.PHONY: ssh
37+
38+
composer-update:
39+
$(call docker-exec,composer update --optimize-autoloader)
40+
.PHONY: composer-update
41+
42+
composer-install:
43+
$(call docker-exec,composer install --optimize-autoloader)
44+
.PHONY: composer-install
45+
46+
composer-normalize:
47+
$(call docker-exec,composer normalize)
48+
.PHONY: composer-normalize
49+
50+
phpstan:
51+
$(call docker-exec,composer phpstan)
52+
.PHONY: phpstan
53+
54+
psalm:
55+
$(call docker-exec,composer psalm -- --stats --php-version=$(PHP_VERSION))
56+
.PHONY: psalm
57+
58+
php-cs-fixer:
59+
$(call docker-exec,composer php-cs-fixer)
60+
.PHONY: php-cs-fixer
61+
62+
phpunit:
63+
$(call docker-exec,phpunit)
64+
.PHONY: phpunit
65+
66+
phpunit-coverage:
67+
$(call docker-exec,phpunit --coverage-html /usr/app/coverage)
68+
.PHONY: phpunit-coverage
69+
70+
rector:
71+
$(call docker-exec,composer rector)
72+
.PHONY: rector
73+
74+
lint-qa:
75+
$(call docker-exec,composer php-cs-fixer)
76+
$(call docker-exec,phpunit --coverage-html /usr/app/coverage)
77+
$(call docker-exec,composer phpstan)
78+
$(call docker-exec,composer psalm -- --stats --php-version=$(PHP_VERSION))
79+
$(call docker-exec,composer rector)
80+
$(call docker-exec,composer normalize)
81+
$(call docker-exec,bin/console lint:container)
82+
$(call docker-exec,bin/console lint:twig src)
83+
$(call docker-exec,bin/console lint:xliff src)
84+
$(call docker-exec,bin/console lint:yaml src)
85+
.PHONY: lint-qa

composer.json

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,55 +17,57 @@
1717
],
1818
"homepage": "https://github.com/runroom/RunroomSamplesBundle",
1919
"require": {
20-
"php": "^7.4 || ^8.0",
21-
"a2lix/translation-form-bundle": "^3.0.4",
22-
"doctrine/doctrine-bundle": "^2.4",
23-
"egulias/email-validator": "^3.0",
24-
"friendsofsymfony/ckeditor-bundle": "^2.2",
20+
"php": "^8.0",
21+
"a2lix/translation-form-bundle": "^3.2",
22+
"doctrine/dbal": "^3.4",
23+
"doctrine/doctrine-bundle": "^2.7",
24+
"doctrine/orm": "^2.14",
25+
"egulias/email-validator": "^3.0 || ^4.0",
26+
"friendsofsymfony/ckeditor-bundle": "^2.3",
2527
"gedmo/doctrine-extensions": "^3.0",
2628
"hubspot/hubspot-php": "^5.0",
27-
"knplabs/doctrine-behaviors": "^2.0.6",
29+
"knplabs/doctrine-behaviors": "^2.5",
2830
"runroom-packages/form-handler-bundle": "^0.16",
2931
"runroom-packages/render-event-bundle": "^0.16",
3032
"runroom-packages/sortable-behavior-bundle": "^0.16",
3133
"runroom-packages/translation-bundle": "^0.16",
32-
"sonata-project/admin-bundle": "^3.103 || ^4.9",
33-
"sonata-project/doctrine-extensions": "^1.13 || ^2.0",
34-
"sonata-project/doctrine-orm-admin-bundle": "^3.34 || ^4.0",
35-
"sonata-project/media-bundle": "^3.32 || ^4.0",
36-
"symfony/config": "^4.4 || ^5.4 || ^6.0",
37-
"symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0",
38-
"symfony/event-dispatcher": "^4.4 || ^5.4 || ^6.0",
34+
"sonata-project/admin-bundle": "^4.9",
35+
"sonata-project/doctrine-extensions": "^1.14 || ^2.0",
36+
"sonata-project/doctrine-orm-admin-bundle": "^4.1",
37+
"sonata-project/media-bundle": "^4.0",
38+
"symfony/config": "^5.4 || ^6.2",
39+
"symfony/dependency-injection": "^5.4 || ^6.2",
40+
"symfony/event-dispatcher": "^5.4 || ^6.2",
3941
"symfony/event-dispatcher-contracts": "^1.1 || ^2.0 || ^3.0",
40-
"symfony/form": "^4.4 || ^5.4 || ^6.0",
41-
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.0",
42-
"symfony/http-foundation": "^4.4.7 || ^5.4 || ^6.0",
43-
"symfony/http-kernel": "^4.4.13 || ^5.4 || ^6.0",
44-
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.0",
45-
"symfony/translation": "^4.4 || ^5.4 || ^6.0",
46-
"symfony/validator": "^4.4 || ^5.4 || ^6.0",
47-
"symfony/yaml": "^4.4 || ^5.4 || ^6.0",
48-
"twig/twig": "^2.12 || ^3.0"
42+
"symfony/form": "^5.4 || ^6.2",
43+
"symfony/framework-bundle": "^5.4 || ^6.2",
44+
"symfony/http-foundation": "^5.4 || ^6.2",
45+
"symfony/http-kernel": "^5.4 || ^6.2",
46+
"symfony/options-resolver": "^5.4 || ^6.2",
47+
"symfony/translation": "^5.4 || ^6.2",
48+
"symfony/validator": "^5.4 || ^6.2",
49+
"symfony/yaml": "^5.4 || ^6.2",
50+
"twig/twig": "^3.0"
4951
},
5052
"require-dev": {
5153
"a2lix/auto-form-bundle": "^0.4",
52-
"ergebnis/composer-normalize": "^2.2",
54+
"ergebnis/composer-normalize": "^2.6",
5355
"friendsofphp/php-cs-fixer": "^3.0",
5456
"matthiasnoback/symfony-config-test": "^4.2",
5557
"matthiasnoback/symfony-dependency-injection-test": "^4.1",
56-
"phpstan/phpstan": "^1.0",
58+
"phpstan/phpstan": "^1.9",
5759
"phpstan/phpstan-doctrine": "^1.0",
5860
"phpstan/phpstan-phpunit": "^1.0",
5961
"phpstan/phpstan-strict-rules": "^1.0",
6062
"phpstan/phpstan-symfony": "^1.0",
61-
"phpunit/phpunit": "^9.3",
62-
"psalm/plugin-phpunit": "^0.17",
63-
"psalm/plugin-symfony": "^3.0",
64-
"rector/rector": "^0.14",
63+
"phpunit/phpunit": "^9.6",
64+
"psalm/plugin-phpunit": "^0.18",
65+
"psalm/plugin-symfony": "^5.0",
66+
"rector/rector": "^0.15",
6567
"runroom-packages/testing": "^0.16",
66-
"symfony/phpunit-bridge": "^6.0",
67-
"vimeo/psalm": "^4.0",
68-
"weirdan/doctrine-psalm-plugin": "^2.0",
68+
"symfony/phpunit-bridge": "^6.2",
69+
"vimeo/psalm": "^5.5",
70+
"weirdan/doctrine-psalm-plugin": "^2.6",
6971
"zenstruck/foundry": "^1.10"
7072
},
7173
"autoload": {

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,3 @@ parameters:
33
-
44
message: "#^Call to an undefined method Knp\\\\DoctrineBehaviors\\\\Contract\\\\Entity\\\\TranslationInterface\\:\\:#"
55
path: .
6-
7-
-
8-
message: "#^Method Symfony\\\\Component\\\\Validator\\\\ValidatorBuilder\\:\\:enableAnnotationMapping\\(\\) invoked with 1 parameter, 0 required\\.$#"
9-
count: 1
10-
path: tests/Forms/Unit/ContactHubspotFormTypeTest.php

psalm.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<psalm
33
errorLevel="2"
44
findUnusedPsalmSuppress="true"
5+
findUnusedBaselineEntry="true"
6+
findUnusedCode="false"
57
resolveFromConfigFile="true"
68
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
79
xmlns="https://getpsalm.org/schema/config"

rector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
]);
2424

2525
$rectorConfig->sets([
26-
LevelSetList::UP_TO_PHP_74,
26+
LevelSetList::UP_TO_PHP_80,
2727
]);
2828

2929
$rectorConfig->importNames();
30-
$rectorConfig->disableImportShortClasses();
30+
$rectorConfig->importShortClasses(false);
3131
$rectorConfig->skip([
3232
__DIR__ . '/tests/App/var',
3333
CountOnNullRector::class,

0 commit comments

Comments
 (0)