Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up PHP 8.0 and 8.1 deprecations. Add support for PHP 8.2 and 8.3. Drop PHP 7.4. #8

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@ jobs:
env:
DB: mysql
DB_USER: root
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php:
- '7.4'
# - '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
composer:
- ''
- '--prefer-lowest'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Use PHP
uses: shivammathur/setup-php@v2
Expand All @@ -39,7 +41,7 @@ jobs:

- name: cache dependencies
id: cache-dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.composer }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -54,7 +56,7 @@ jobs:
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
COMPOSER_FLAGS: ${{ matrix.composer }}
run: composer update ${COMPOSER_FLAGS} --prefer-source
run: composer update ${COMPOSER_FLAGS}
working-directory: ./

- name: Start MySQL
Expand All @@ -66,6 +68,10 @@ jobs:
run: |
echo "SET GLOBAL sql_mode = ''" | mysql -u root -proot mysql

- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 db" | sudo tee -a /etc/hosts

- name: setup database
run: |
sh -c "if [ '$DB' = 'mysql' ]; then mysql -u root -proot mysql -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS test; DROP SCHEMA IF EXISTS second_hand_books; DROP SCHEMA IF EXISTS contest; DROP DATABASE IF EXISTS reverse_bookstore; DROP SCHEMA IF EXISTS bookstore_schemas; SET FOREIGN_KEY_CHECKS = 1;'; fi"
Expand All @@ -76,3 +82,5 @@ jobs:
- name: Run Tests
run: vendor/bin/phpunit
working-directory: ./
env:
SYMFONY_DEPRECATIONS_HELPER: weak
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ composer.lock
composer.phar
generator/pear/build/
runtime/pear/build/

.phpunit.result.cache
18 changes: 18 additions & 0 deletions .idea/codeception.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/phing.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/phpspec.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/phpunit.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 76 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@
},
"include-path": ["runtime/lib", "generator/lib"],
"require": {
"php": "^8.0|^7.4",
"php": ">=8.0",
"phing/phing": "^2.17",
"ext-pdo": "*"
"ext-pdo": "*",
"symfony/deprecation-contracts": "^2.5|^3.0"
},
"require-dev": {
"phpunit/phpunit": "^9.0.0",
"phpcompatibility/php-compatibility": "^9.3",
"squizlabs/php_codesniffer": "^3.5",
"ext-simplexml": "*",
"ext-dom": "*"
"ext-dom": "*",
"rector/rector": "^1.0",
"symfony/phpunit-bridge": "^5.4|^6.0"
},
"replace": {
"propel/propel1": "^1.8"
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM thecodingmachine/php:8.0-v4-cli
FROM thecodingmachine/php:8.1-v4-cli
USER root
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales

Expand Down
11 changes: 7 additions & 4 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@ services:
dockerfile: Dockerfile
working_dir: /usr/src/app
command: phpunit
links:
- db
volumes:
- ../:/usr/src/app
environment:
- PHP_EXTENSIONS=intl pdo_sqlite sqlite3 xdebug
- STARTUP_COMMAND_1=composer install
- STARTUP_COMMAND_2=bash test/reset_tests.sh
- PHP_IDE_CONFIG="serverName=propel"
- XDEBUG_MODE=debug
- XDEBUG_SESSION=1
# - XDEBUG_MODE=debug
# - XDEBUG_SESSION=1

db:
image: percona
image: mysql:8.0
command: >
mysqld
--sql-mode="NO_ENGINE_SUBSTITUTION"
Expand All @@ -26,4 +28,5 @@ services:
--default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
# MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_ROOT_PASSWORD: 'root'
4 changes: 2 additions & 2 deletions docker/reset.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash

mysql -u root -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS test; DROP SCHEMA IF EXISTS second_hand_books; DROP SCHEMA IF EXISTS contest; DROP DATABASE IF EXISTS reverse_bookstore; DROP SCHEMA IF EXISTS bookstore_schemas; SET FOREIGN_KEY_CHECKS = 1;'
mysql -u root -e 'CREATE DATABASE test; CREATE SCHEMA bookstore_schemas; CREATE SCHEMA contest; CREATE SCHEMA second_hand_books; CREATE DATABASE reverse_bookstore;'
mysql -u root -proot -e 'SET FOREIGN_KEY_CHECKS = 0; DROP DATABASE IF EXISTS test; DROP SCHEMA IF EXISTS second_hand_books; DROP SCHEMA IF EXISTS contest; DROP DATABASE IF EXISTS reverse_bookstore; DROP SCHEMA IF EXISTS bookstore_schemas; SET FOREIGN_KEY_CHECKS = 1;'
mysql -u root -proot -e 'CREATE DATABASE test; CREATE SCHEMA bookstore_schemas; CREATE SCHEMA contest; CREATE SCHEMA second_hand_books; CREATE DATABASE reverse_bookstore;'
2 changes: 1 addition & 1 deletion docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ docker-compose up -d db
sleep 20
docker-compose exec -T db bash < reset.sh
docker-compose build
docker-compose run php
docker-compose run --rm php
4 changes: 2 additions & 2 deletions generator/default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ propel.disableIdentifierQuoting = false
# it is nice to change the defaults.

propel.defaultTimeStampFormat = Y-m-d H:i:s
propel.defaultTimeFormat = %X
propel.defaultDateFormat = %x
propel.defaultTimeFormat = H:i:s
propel.defaultDateFormat = m/d/Y

propel.defaultKeyType = phpName

Expand Down
2 changes: 1 addition & 1 deletion generator/lib/behavior/DelegateBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function getDelegateTable($delegateTableName)
return $this->getTable()->getDatabase()->getTable($delegateTableName);
}

public function objectCall($builder)
public function objectCall($builder): string
{
$script = '';
foreach ($this->delegates as $delegate => $type) {
Expand Down
Loading
Loading