From 630079bdc10158e3072d85509a54f71c73b72c4a Mon Sep 17 00:00:00 2001 From: Leonardo-Atalla Date: Thu, 8 Feb 2024 15:27:50 +0200 Subject: [PATCH 1/5] allow symfony 7 --- composer.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 04ce929d8..7b0f6b10d 100644 --- a/composer.json +++ b/composer.json @@ -18,13 +18,13 @@ "require": { "php": ">=7.4", "psr/log": "^1.0 || ^2.0 || ^3.0", - "symfony/yaml": "^4.4.0 || ^5.0.0 || ^6.0.0", - "symfony/config": "^4.4.0 || ^5.0.0 || ^6.0.0", - "symfony/console": "^4.4.0 || ^5.0.0 || ^6.0.0", - "symfony/filesystem": "^4.4.0 || ^5.0.0 || ^6.0.0", - "symfony/finder": "^4.4.0 || ^5.0.0 || ^6.0.0", - "symfony/translation": "^4.4.0 || ^5.0.0 || ^6.0.0", - "symfony/validator": "^4.4.0 || ^5.0.0 || ^6.0.0" + "symfony/yaml": "^4.4.0 || ^5.0.0 || ^6.0.0 || ^7.0.0", + "symfony/config": "^4.4.0 || ^5.0.0 || ^6.0.0 || ^7.0.0", + "symfony/console": "^4.4.0 || ^5.0.0 || ^6.0.0 || ^7.0.0", + "symfony/filesystem": "^4.4.0 || ^5.0.0 || ^6.0.0 || ^7.0.0", + "symfony/finder": "^4.4.0 || ^5.0.0 || ^6.0.0 || ^7.0.0", + "symfony/translation": "^4.4.0 || ^5.0.0 || ^6.0.0 || ^7.0.0", + "symfony/validator": "^4.4.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" }, "require-dev": { "ext-pdo": "*", From c3af9e9b425f6413c678b283ca2e19193a68c677 Mon Sep 17 00:00:00 2001 From: Leonardo-Atalla Date: Thu, 8 Feb 2024 15:43:14 +0200 Subject: [PATCH 2/5] match parent type --- src/Propel/Runtime/Validator/Constraints/Date.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propel/Runtime/Validator/Constraints/Date.php b/src/Propel/Runtime/Validator/Constraints/Date.php index 35c78fc31..59e0f8280 100644 --- a/src/Propel/Runtime/Validator/Constraints/Date.php +++ b/src/Propel/Runtime/Validator/Constraints/Date.php @@ -15,7 +15,7 @@ class Date extends SymfonyDateConstraint /** * @var string */ - public $message = 'This value is not a valid date.'; + public string $message = 'This value is not a valid date.'; /** * @var string From a7167711ea5d5bb4476f8d3055d03ab992d3db53 Mon Sep 17 00:00:00 2001 From: Leonardo-Atalla Date: Thu, 8 Feb 2024 16:11:19 +0200 Subject: [PATCH 3/5] match parent type --- tests/Propel/Tests/Common/Config/Loader/FileLoaderTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Propel/Tests/Common/Config/Loader/FileLoaderTest.php b/tests/Propel/Tests/Common/Config/Loader/FileLoaderTest.php index 309c2ff92..de7466194 100644 --- a/tests/Propel/Tests/Common/Config/Loader/FileLoaderTest.php +++ b/tests/Propel/Tests/Common/Config/Loader/FileLoaderTest.php @@ -365,14 +365,14 @@ class TestableFileLoader extends BaseFileLoader /** * @return void */ - public function load($resource, $type = null) + public function load($resource, $type = null): mixed { } /** * @return void */ - public function supports($resource, $type = null) + public function supports($resource, $type = null): bool { } From 9e8f4fc331edd373a40b885d43c9ac789b8d32c8 Mon Sep 17 00:00:00 2001 From: Leonardo-Atalla Date: Thu, 8 Feb 2024 16:56:52 +0200 Subject: [PATCH 4/5] add test composer.json files --- tests/composer/composer-symfony7-max.json | 66 +++++++++++++++++++++++ tests/composer/composer-symfony7-min.json | 66 +++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 tests/composer/composer-symfony7-max.json create mode 100644 tests/composer/composer-symfony7-min.json diff --git a/tests/composer/composer-symfony7-max.json b/tests/composer/composer-symfony7-max.json new file mode 100644 index 000000000..3aef25cc1 --- /dev/null +++ b/tests/composer/composer-symfony7-max.json @@ -0,0 +1,66 @@ +{ + "name": "propel/propel", + "type": "library", + "description": "Propel2 is an open-source Object-Relational Mapping (ORM) for PHP 5.5 and up.", + "keywords": [ + "ORM", + "persistence", + "Active Record" + ], + "homepage": "http://www.propelorm.org/", + "license": "MIT", + "authors": [ + { + "name": "William Durand", + "email": "william.durand1@gmail.com" + } + ], + "require": { + "php": ">=8.2", + "symfony/yaml": "^7.0.0", + "symfony/config": "^7.0.0", + "symfony/console": "^7.0.0", + "symfony/filesystem": "^7.0.0", + "symfony/finder": "^7.0.0", + "symfony/translation": "^7.0.0", + "symfony/validator": "^7.0.0", + "psr/log": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "ext-pdo": "*", + "ext-json": "*", + "ext-xml": "*", + "monolog/monolog": "^1.3 || ^2.3 || ^3.0", + "phpstan/phpstan": "^1.2", + "phpunit/phpunit": "^9.5.0", + "spryker/code-sniffer": "^0.17.2", + "psalm/phar": "^4.23", + "mikey179/vfsstream": "^1.6" + }, + "suggest": { + "monolog/monolog": "The recommended logging library to use with Propel." + }, + "autoload": { + "psr-4": { + "Propel\\": "src/Propel/" + } + }, + "bin": [ + "bin/propel" + ], + "scripts": { + "stan": [ + "vendor/bin/phpstan analyze -l 1 -c tests/phpstan.neon src/" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} diff --git a/tests/composer/composer-symfony7-min.json b/tests/composer/composer-symfony7-min.json new file mode 100644 index 000000000..400da1df2 --- /dev/null +++ b/tests/composer/composer-symfony7-min.json @@ -0,0 +1,66 @@ +{ + "name": "propel/propel", + "type": "library", + "description": "Propel2 is an open-source Object-Relational Mapping (ORM) for PHP 5.5 and up.", + "keywords": [ + "ORM", + "persistence", + "Active Record" + ], + "homepage": "http://www.propelorm.org/", + "license": "MIT", + "authors": [ + { + "name": "William Durand", + "email": "william.durand1@gmail.com" + } + ], + "require": { + "php": ">=8.2", + "symfony/yaml": "~7.0.0", + "symfony/config": "~7.0.0", + "symfony/console": "~7.0.0", + "symfony/filesystem": "~7.0.0", + "symfony/finder": "~7.0.0", + "symfony/translation": "~7.0.0", + "symfony/validator": "~7.0.0", + "psr/log": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "ext-pdo": "*", + "ext-json": "*", + "ext-xml": "*", + "monolog/monolog": "^1.3 || ^2.3 || ^3.0", + "phpstan/phpstan": "^1.2", + "phpunit/phpunit": "^9.5.0", + "spryker/code-sniffer": "^0.17.2", + "psalm/phar": "^4.23", + "mikey179/vfsstream": "^1.6" + }, + "suggest": { + "monolog/monolog": "The recommended logging library to use with Propel." + }, + "autoload": { + "psr-4": { + "Propel\\": "src/Propel/" + } + }, + "bin": [ + "bin/propel" + ], + "scripts": { + "stan": [ + "vendor/bin/phpstan analyze -l 1 -c tests/phpstan.neon src/" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} From 5407ebd4c8c66666845405ac99c88cea2b6a4a48 Mon Sep 17 00:00:00 2001 From: Leonardo-Atalla Date: Thu, 8 Feb 2024 16:56:52 +0200 Subject: [PATCH 5/5] test fixes, add test composer.json files --- .github/workflows/ci.yml | 10 ++- .../Generator/Command/MigrationUpCommand.php | 2 +- .../Runtime/Validator/Constraints/Date.php | 5 -- .../Common/Config/Loader/FileLoaderTest.php | 12 ++-- .../Runtime/Connection/PropelPDOTest.php | 2 +- tests/composer/composer-symfony7-max.json | 66 +++++++++++++++++++ tests/composer/composer-symfony7-min.json | 66 +++++++++++++++++++ 7 files changed, 147 insertions(+), 16 deletions(-) create mode 100644 tests/composer/composer-symfony7-max.json create mode 100644 tests/composer/composer-symfony7-min.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0a563d37..880a4ec8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: matrix: php-version: [ '7.4', '8.2' ] db-type: [ sqlite, mysql, pgsql, agnostic ] - symfony-version: [ '4-min', '4-max', '5-min', '5-max', '6-min', '6-max' ] + symfony-version: [ '4-min', '4-max', '5-min', '5-max', '6-min', '6-max', '7-min', '7-max'] exclude: - symfony-version: '4-min' php-version: '8.2' @@ -24,6 +24,10 @@ jobs: php-version: '7.4' - symfony-version: '6-max' php-version: '7.4' + - symfony-version: '7-min' + php-version: '7.4' + - symfony-version: '7-max' + php-version: '7.4' env: DB_NAME: 'propel_tests' DB_USER: 'propel' @@ -125,6 +129,8 @@ jobs: else vendor/bin/phpunit -c tests/${{ matrix.db-type }}.phpunit.xml fi + env: + SYMFONY_VERSION: ${{ matrix.symfony-version }} - name: Code Coverage Report if: success() && matrix.php-version == '7.4' && matrix.symfony-version == '5-max' @@ -166,6 +172,8 @@ jobs: run: composer install --prefer-dist --no-interaction - name: PHPStan + env: + PHPSTAN: 1 run: composer stan - name: Psalm diff --git a/src/Propel/Generator/Command/MigrationUpCommand.php b/src/Propel/Generator/Command/MigrationUpCommand.php index cc79558bd..daea8a44e 100644 --- a/src/Propel/Generator/Command/MigrationUpCommand.php +++ b/src/Propel/Generator/Command/MigrationUpCommand.php @@ -44,7 +44,7 @@ protected function configure() * * @throws \Propel\Runtime\Exception\RuntimeException */ - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $configOptions = []; diff --git a/src/Propel/Runtime/Validator/Constraints/Date.php b/src/Propel/Runtime/Validator/Constraints/Date.php index 35c78fc31..5c1da3714 100644 --- a/src/Propel/Runtime/Validator/Constraints/Date.php +++ b/src/Propel/Runtime/Validator/Constraints/Date.php @@ -12,11 +12,6 @@ class Date extends SymfonyDateConstraint { - /** - * @var string - */ - public $message = 'This value is not a valid date.'; - /** * @var string */ diff --git a/tests/Propel/Tests/Common/Config/Loader/FileLoaderTest.php b/tests/Propel/Tests/Common/Config/Loader/FileLoaderTest.php index 309c2ff92..efeaba7ba 100644 --- a/tests/Propel/Tests/Common/Config/Loader/FileLoaderTest.php +++ b/tests/Propel/Tests/Common/Config/Loader/FileLoaderTest.php @@ -362,18 +362,14 @@ public function testCallResolveParamTwiceReturnsEmpty() class TestableFileLoader extends BaseFileLoader { - /** - * @return void - */ - public function load($resource, $type = null) + public function load($resource, $type = null): ?array { + return null; } - /** - * @return void - */ - public function supports($resource, $type = null) + public function supports($resource, $type = null): bool { + return false; } /** diff --git a/tests/Propel/Tests/Runtime/Connection/PropelPDOTest.php b/tests/Propel/Tests/Runtime/Connection/PropelPDOTest.php index 4ec4ec52d..31d299753 100644 --- a/tests/Propel/Tests/Runtime/Connection/PropelPDOTest.php +++ b/tests/Propel/Tests/Runtime/Connection/PropelPDOTest.php @@ -564,7 +564,7 @@ class LastMessageHandler extends AbstractHandler * * @return bool */ - public function handle(array $record): bool + public function handle($record): bool { $this->latestMessage = (string)$record['message']; diff --git a/tests/composer/composer-symfony7-max.json b/tests/composer/composer-symfony7-max.json new file mode 100644 index 000000000..3aef25cc1 --- /dev/null +++ b/tests/composer/composer-symfony7-max.json @@ -0,0 +1,66 @@ +{ + "name": "propel/propel", + "type": "library", + "description": "Propel2 is an open-source Object-Relational Mapping (ORM) for PHP 5.5 and up.", + "keywords": [ + "ORM", + "persistence", + "Active Record" + ], + "homepage": "http://www.propelorm.org/", + "license": "MIT", + "authors": [ + { + "name": "William Durand", + "email": "william.durand1@gmail.com" + } + ], + "require": { + "php": ">=8.2", + "symfony/yaml": "^7.0.0", + "symfony/config": "^7.0.0", + "symfony/console": "^7.0.0", + "symfony/filesystem": "^7.0.0", + "symfony/finder": "^7.0.0", + "symfony/translation": "^7.0.0", + "symfony/validator": "^7.0.0", + "psr/log": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "ext-pdo": "*", + "ext-json": "*", + "ext-xml": "*", + "monolog/monolog": "^1.3 || ^2.3 || ^3.0", + "phpstan/phpstan": "^1.2", + "phpunit/phpunit": "^9.5.0", + "spryker/code-sniffer": "^0.17.2", + "psalm/phar": "^4.23", + "mikey179/vfsstream": "^1.6" + }, + "suggest": { + "monolog/monolog": "The recommended logging library to use with Propel." + }, + "autoload": { + "psr-4": { + "Propel\\": "src/Propel/" + } + }, + "bin": [ + "bin/propel" + ], + "scripts": { + "stan": [ + "vendor/bin/phpstan analyze -l 1 -c tests/phpstan.neon src/" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} diff --git a/tests/composer/composer-symfony7-min.json b/tests/composer/composer-symfony7-min.json new file mode 100644 index 000000000..400da1df2 --- /dev/null +++ b/tests/composer/composer-symfony7-min.json @@ -0,0 +1,66 @@ +{ + "name": "propel/propel", + "type": "library", + "description": "Propel2 is an open-source Object-Relational Mapping (ORM) for PHP 5.5 and up.", + "keywords": [ + "ORM", + "persistence", + "Active Record" + ], + "homepage": "http://www.propelorm.org/", + "license": "MIT", + "authors": [ + { + "name": "William Durand", + "email": "william.durand1@gmail.com" + } + ], + "require": { + "php": ">=8.2", + "symfony/yaml": "~7.0.0", + "symfony/config": "~7.0.0", + "symfony/console": "~7.0.0", + "symfony/filesystem": "~7.0.0", + "symfony/finder": "~7.0.0", + "symfony/translation": "~7.0.0", + "symfony/validator": "~7.0.0", + "psr/log": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "ext-pdo": "*", + "ext-json": "*", + "ext-xml": "*", + "monolog/monolog": "^1.3 || ^2.3 || ^3.0", + "phpstan/phpstan": "^1.2", + "phpunit/phpunit": "^9.5.0", + "spryker/code-sniffer": "^0.17.2", + "psalm/phar": "^4.23", + "mikey179/vfsstream": "^1.6" + }, + "suggest": { + "monolog/monolog": "The recommended logging library to use with Propel." + }, + "autoload": { + "psr-4": { + "Propel\\": "src/Propel/" + } + }, + "bin": [ + "bin/propel" + ], + "scripts": { + "stan": [ + "vendor/bin/phpstan analyze -l 1 -c tests/phpstan.neon src/" + ] + }, + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +}