Skip to content

Commit 7dde04b

Browse files
TatevikGrtatevikg1
andauthored
Update to php8.1 symfony 6.4 (#331)
* ISSUE-337: update dependencies * ISSUE-337: fix cache clear * ISSUE-337: typehint + style * ISSUE-337: local version * ISSUE-337: test fix * ISSUE-337: fixture test fix * ISSUE-337: move test related staff to test folder + bring back author * ISSUE-337: test * ISSUE-337: fix cache:clear * ISSUE-337: use symfony 6.4 * ISSUE-337: test fix * ISSUE-337: more test fix * ISSUE-337: move support back * ISSUE-337: test fix * ISSUE-337: fix fixtures * ISSUE-337: fix the rest of tests * ISSUE-337: install symfony * ISSUE-337: fix phpstan * ISSUE-337: fix phpmd * ISSUE-337: fix phpcs * ISSUE-337: phpdoc * ISSUE-337: check * ISSUE-337: set env test * ISSUE-337: fix pipeline * ISSUE-337: force push --------- Co-authored-by: Tatevik <[email protected]>
1 parent ca43fca commit 7dde04b

File tree

100 files changed

+2576
-4261
lines changed

Some content is hidden

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

100 files changed

+2576
-4261
lines changed

.github/workflows/ci.yml

+10-16
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
DB_DATABASE: phplist
99
DB_USERNAME: root
1010
DB_PASSWORD: phplist
11-
BROADCAST_DRIVER: log
11+
BROADCAST_DRIVER: log
1212
services:
1313
mysql:
1414
image: mysql:5.7
@@ -22,16 +22,21 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
php-versions: ['7.2', '7.3', '7.4', '8.0']
25+
php-versions: ['8.1']
2626
steps:
2727
- name: Checkout
2828
uses: actions/checkout@v2
2929
- name: Setup PHP, with composer and extensions
30-
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
30+
uses: shivammathur/setup-php@v2
3131
with:
3232
php-version: ${{ matrix.php-versions }}
3333
extensions: mbstring, dom, fileinfo, mysql
3434
coverage: xdebug #optional
35+
- name: Install Symfony CLI
36+
run: |
37+
curl -sS https://get.symfony.com/cli/installer | bash
38+
mv $HOME/.symfony*/bin/symfony /usr/local/bin/symfony
39+
symfony version
3540
- name: Start mysql service
3641
run: sudo /etc/init.d/mysql start
3742
- name: Verify MySQL connection on host
@@ -45,40 +50,29 @@ jobs:
4550
uses: actions/cache@v2
4651
with:
4752
path: ${{ steps.composer-cache.outputs.dir }}
48-
# Use composer.json for key, if composer.lock is not committed.
49-
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
5053
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
5154
restore-keys: ${{ runner.os }}-composer-
5255
- name: Install Composer dependencies
5356
run: composer install --no-progress --prefer-dist --optimize-autoloader
54-
continue-on-error: ${{matrix.php-versions == '8.0' }} # Temporal until full support for php8 === [temp-php8]
5557
- name: Validating composer.json
5658
run: composer validate --no-check-all --no-check-lock --strict;
57-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
5859
- name: Linting all php files
5960
run: find src/ tests/ public/ -name ''*.php'' -print0 | xargs -0 -n 1 -P 4 php -l; php -l bin/*;
60-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
6161
- name: Run units tests with phpunit
62-
run: vendor/bin/phpunit tests/Unit/
63-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
62+
run: vendor/bin/phpunit tests/Unit/
6463
- name: Run integration tests with phpunit
65-
run: |
64+
run: |
6665
export PHPLIST_DATABASE_NAME=${{ env.DB_DATABASE }}
6766
export PHPLIST_DATABASE_USER=${{ env.DB_USERNAME }}
6867
export PHPLIST_DATABASE_PASSWORD=${{ env.DB_PASSWORD }}
6968
export PHPLIST_DATABASE_PORT=${{ job.services.mysql.ports['3306'] }}
7069
export PHPLIST_DATABASE_HOST=127.0.0.1
7170
vendor/bin/phpunit tests/Integration/
72-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
7371
- name: Running the system tests
7472
run: vendor/bin/phpunit tests/System/;
75-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
7673
- name: Running static analysis
7774
run: vendor/bin/phpstan analyse -c phpstan.neon;
78-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
7975
- name: Running PHPMD
8076
run: vendor/bin/phpmd src/ text config/PHPMD/rules.xml;
81-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
8277
- name: Running PHP_CodeSniffer
8378
run: vendor/bin/phpcs --standard=config/PhpCodeSniffer/ bin/ src/ tests/ public/;
84-
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]

.github/workflows/core-docs.yml

+56-50
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,89 @@
1-
name: Publish Core Docs
1+
name: Publish Core Docs
22
on: [push, pull_request]
33
jobs:
44
make-restapi-docs:
55
name: Checkout phpList core and generate docs using `phpDocumentor`
66
runs-on: ubuntu-20.04
77
steps:
88
- name: Checkout
9-
uses: actions/checkout@v2
9+
uses: actions/checkout@v3
1010
- name: Setup PHP, with composer and extensions
11-
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
11+
uses: shivammathur/setup-php@v2
1212
with:
13-
php-version: 7.4
13+
php-version: 8.1
1414
extensions: mbstring, dom, fileinfo, mysql
1515
- name: Get composer cache directory
1616
id: composer-cache
17-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
17+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_ENV
1818
- name: Cache composer dependencies
19-
uses: actions/cache@v2
19+
uses: actions/cache@v3
2020
with:
21-
path: ${{ steps.composer-cache.outputs.dir }}
22-
# Use composer.json for key, if composer.lock is not committed.
23-
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
21+
path: ${{ env.dir }}
2422
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
2523
restore-keys: ${{ runner.os }}-composer-
2624
- name: Install current dependencies from composer.lock
2725
run: composer install
28-
- name: Install phpDocumentor
26+
- name: Install phpDocumentor
2927
run: |
3028
wget https://phpdoc.org/phpDocumentor.phar
3129
chmod +x phpDocumentor.phar
3230
mv phpDocumentor.phar /usr/local/bin/phpDocumentor
31+
- name: Verify phpDocumentor version
32+
run: phpDocumentor --version
3333
- name: Generate documentation
3434
run: composer run-php-documentor
35-
- name: zip phpdocumentor dir
35+
- name: Zip phpDocumentor directory
3636
run: zip -r phpdocumentor.zip docs/phpdocumentor
3737
- name: Upload generated doc files
38-
uses: actions/upload-artifact@v2
38+
uses: actions/upload-artifact@v4
3939
with:
4040
name: doc-files
4141
path: phpdocumentor.zip
4242
deploy-docs:
43-
name: Deploy Core Docs.
43+
name: Deploy Core Docs
4444
runs-on: ubuntu-20.04
4545
needs: make-restapi-docs
4646
steps:
47-
- name: Checkout phplist/core-docs
48-
uses: actions/checkout@v2
49-
with:
50-
repository: phpList/core-docs
51-
fetch-depth: 0
52-
token: ${{ secrets.PUSH_CORE_DOCS }}
53-
- name: Restore REST API Spec
54-
uses: actions/download-artifact@v2
55-
with:
56-
name: doc-files
57-
- name: unzip phpdocumentor
58-
run: |
59-
unzip phpdocumentor.zip
60-
rm phpdocumentor.zip
61-
- name: List Files
62-
run: ls
63-
- name: Sync old files with newly generated ones.
64-
run: rsync -av docs/phpdocumentor/* .
65-
- name: Removed temp dirs
66-
run: rm -rf docs
67-
- name: Check if updates/changes.
68-
run: git status --porcelain > repo-changes.txt
69-
- name: Check changes file
70-
run: cat repo-changes.txt
71-
- name: Verify updates.
72-
id: allow-deploy
73-
run: |
74-
if [ -s repo-changes.txt ]; then echo "Updates made to documentation"; echo '::set-output name=DEPLOY::true'; else echo "No updates made to documentation deployment would be skipped."; echo '::set-output name=DEPLOY::false'; fi
75-
- name: Commit changes and deply
76-
if: ${{ steps.allow-deploy.outputs.DEPLOY == 'true' }}
77-
run: |
78-
rm repo-changes.txt
79-
git config user.name "github-actions"
80-
git config user.email "[email protected]"
81-
git add .
82-
git commit -s -m "phplist/core docs deployment `date`"
83-
git push
47+
- name: Checkout phplist/core-docs
48+
uses: actions/checkout@v3
49+
with:
50+
repository: phpList/core-docs
51+
fetch-depth: 0
52+
token: ${{ secrets.PUSH_CORE_DOCS }}
53+
- name: Restore REST API Spec
54+
uses: actions/download-artifact@v4
55+
with:
56+
name: doc-files
57+
- name: Unzip phpDocumentor
58+
run: |
59+
unzip phpdocumentor.zip
60+
rm phpdocumentor.zip
61+
- name: List Files
62+
run: ls
63+
- name: Sync old files with newly generated ones
64+
run: rsync -av docs/phpdocumentor/* .
65+
- name: Remove temporary directories
66+
run: rm -rf docs
67+
- name: Check if updates/changes
68+
run: git status --porcelain > repo-changes.txt
69+
- name: Check changes file
70+
run: cat repo-changes.txt
71+
- name: Verify updates
72+
id: allow-deploy
73+
run: |
74+
if [ -s repo-changes.txt ]; then
75+
echo "Updates made to documentation";
76+
echo 'DEPLOY=true' >> $GITHUB_ENV;
77+
else
78+
echo "No updates made to documentation. Deployment would be skipped.";
79+
echo 'DEPLOY=false' >> $GITHUB_ENV;
80+
fi
81+
- name: Commit changes and deploy
82+
if: ${{ env.DEPLOY == 'true' }}
83+
run: |
84+
rm repo-changes.txt
85+
git config user.name "github-actions"
86+
git config user.email "[email protected]"
87+
git add .
88+
git commit -s -m "phplist/core docs deployment `date`"
89+
git push origin main --force

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
/vendor/
1515
/docs/phpdocumentor
1616
.vagrant
17-
.phpdoc/
17+
.phpdoc/
18+
.phpunit.result.cache

bin/console

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use PhpList\Core\Core\Bootstrap;
77
use PhpList\Core\Core\Environment;
88
use Symfony\Bundle\FrameworkBundle\Console\Application;
99
use Symfony\Component\Console\Input\ArgvInput;
10-
use Symfony\Component\Debug\Debug;
10+
use Symfony\Component\ErrorHandler\ErrorHandler;
1111

1212
set_time_limit(0);
1313

@@ -19,7 +19,7 @@ $debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-d
1919
&& $environment !== Environment::PRODUCTION;
2020

2121
if ($debug) {
22-
Debug::enable();
22+
ErrorHandler::register();
2323
}
2424

2525
Bootstrap::getInstance()->setEnvironment($environment)->configure();

composer.json

+38-29
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,45 @@
3434
"source": "https://github.com/phpList/core"
3535
},
3636
"require": {
37-
"php": "^7.2|^8.0",
38-
"doctrine/orm": "^2.5.0",
39-
"doctrine/common": "^2.6.0",
40-
"doctrine/doctrine-bundle": "^1.8.0",
41-
"symfony/symfony": "^3.4.37",
42-
"symfony/monolog-bundle": "^3.1.0",
43-
"symfony/dependency-injection": "^3.4.37",
44-
"symfony/config": "^3.4.37",
45-
"symfony/yaml": "^3.4.37",
46-
"jms/serializer-bundle": "^3.8.0",
47-
"sensio/framework-extra-bundle": "^5.1.0",
48-
"sensio/distribution-bundle": "^5.0.6"
37+
"php": "^8.1",
38+
"symfony/dependency-injection": "^6.4",
39+
"symfony/config": "^6.4",
40+
"symfony/yaml": "^6.4",
41+
"symfony/error-handler": "^6.4",
42+
"symfony/serializer": "^6.4",
43+
"symfony/monolog-bundle": "^3.10",
44+
"symfony/serializer-pack": "^1.3",
45+
"symfony/orm-pack": "^2.4",
46+
"doctrine/orm": "^3.3",
47+
"doctrine/cache": "^2.2",
48+
"symfony/asset": "^6.4",
49+
"symfony/security-csrf": "^6.4",
50+
"symfony/form": "^6.4",
51+
"symfony/validator": "^6.4",
52+
"doctrine/doctrine-fixtures-bundle": "^3.7",
53+
"doctrine/instantiator": "^2.0",
54+
"masterminds/html5": "^2.9"
4955
},
5056
"require-dev": {
51-
"phpunit/phpunit": "^6.5.6",
52-
"phpunit/phpunit-mock-objects": "^5.0.6",
53-
"phpunit/dbunit": "^3.0.0",
57+
"phpunit/phpunit": "^9.5",
5458
"guzzlehttp/guzzle": "^6.3.0",
5559
"squizlabs/php_codesniffer": "^3.2.0",
56-
"phpstan/phpstan": "^0.7.0|0.12.57",
57-
"nette/caching": "^2.5.0|^3.0.0",
58-
"nikic/php-parser": "^3.1.0",
60+
"phpstan/phpstan": "^1.10",
61+
"nette/caching": "^3.0.0",
62+
"nikic/php-parser": "^4.19.1",
5963
"phpmd/phpmd": "^2.6.0",
60-
"composer/composer": "^1.6.0",
61-
"doctrine/instantiator": "^1.0.5"
64+
"symfony/test-pack": "^1.1",
65+
"symfony/process": "^6.4",
66+
"composer/composer": "^2.7",
67+
"symfony/framework-bundle": "^6.4",
68+
"symfony/http-kernel": "^6.4",
69+
"symfony/http-foundation": "^6.4",
70+
"symfony/routing": "^6.4",
71+
"symfony/console": "^6.4"
6272
},
6373
"suggest": {
64-
"phplist/web-frontend": "4.0.x-dev",
65-
"phplist/rest-api": "4.0.x-dev"
74+
"phplist/web-frontend": "5.0.x-dev",
75+
"phplist/rest-api": "5.0.x-dev"
6676
},
6777
"autoload": {
6878
"psr-4": {
@@ -83,7 +93,8 @@
8393
"PhpList\\Core\\Composer\\ScriptHandler::createBundleConfiguration",
8494
"PhpList\\Core\\Composer\\ScriptHandler::createRoutesConfiguration",
8595
"PhpList\\Core\\Composer\\ScriptHandler::createParametersConfiguration",
86-
"PhpList\\Core\\Composer\\ScriptHandler::clearAllCaches"
96+
"php bin/console cache:clear",
97+
"php bin/console cache:warmup"
8798
],
8899
"post-install-cmd": [
89100
"@update-configuration"
@@ -97,7 +108,7 @@
97108
},
98109
"extra": {
99110
"branch-alias": {
100-
"dev-master": "4.0.x-dev"
111+
"dev-ISSUE-337": "5.0.x-dev"
101112
},
102113
"symfony-app-dir": "",
103114
"symfony-bin-dir": "bin",
@@ -107,16 +118,14 @@
107118
"phplist/core": {
108119
"bundles": [
109120
"Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle",
110-
"Sensio\\Bundle\\FrameworkExtraBundle\\SensioFrameworkExtraBundle",
111121
"Symfony\\Bundle\\MonologBundle\\MonologBundle",
112-
"JMS\\SerializerBundle\\JMSSerializerBundle",
113122
"Doctrine\\Bundle\\DoctrineBundle\\DoctrineBundle",
114-
"PhpList\\Core\\EmptyStartPageBundle\\PhpListEmptyStartPageBundle"
123+
"PhpList\\Core\\EmptyStartPageBundle\\EmptyStartPageBundle"
115124
],
116125
"routes": {
117126
"homepage": {
118-
"resource": "@PhpListEmptyStartPageBundle/Controller/",
119-
"type": "annotation"
127+
"resource": "@EmptyStartPageBundle/Controller/",
128+
"type": "attribute"
120129
}
121130
}
122131
}

0 commit comments

Comments
 (0)