diff --git a/mailpoet/lib/Newsletter/Scheduler/ReEngagementScheduler.php b/mailpoet/lib/Newsletter/Scheduler/ReEngagementScheduler.php index 3661f75191..a3c1c0f801 100644 --- a/mailpoet/lib/Newsletter/Scheduler/ReEngagementScheduler.php +++ b/mailpoet/lib/Newsletter/Scheduler/ReEngagementScheduler.php @@ -170,6 +170,6 @@ class ReEngagementScheduler { $statement->bindParam('segmentId', $segmentId, ParameterType::INTEGER); $statement->executeQuery(); - return $statement->rowCount(); + return (int)$statement->rowCount(); } } diff --git a/mailpoet/lib/Segments/SubscribersFinder.php b/mailpoet/lib/Segments/SubscribersFinder.php index 9eaef44012..afa6e40f4a 100644 --- a/mailpoet/lib/Segments/SubscribersFinder.php +++ b/mailpoet/lib/Segments/SubscribersFinder.php @@ -125,7 +125,7 @@ class SubscribersFinder { ] ); - return $result->rowCount(); + return (int)$result->rowCount(); } /** diff --git a/mailpoet/lib/Subscribers/ImportExport/ImportExportRepository.php b/mailpoet/lib/Subscribers/ImportExport/ImportExportRepository.php index 45a391172f..e17d1eb6d7 100644 --- a/mailpoet/lib/Subscribers/ImportExport/ImportExportRepository.php +++ b/mailpoet/lib/Subscribers/ImportExport/ImportExportRepository.php @@ -96,7 +96,7 @@ class ImportExportRepository { $rows[] = "(" . implode(', ', $paramNames) . ")"; } - return $this->entityManager->getConnection()->executeStatement(" + return (int)$this->entityManager->getConnection()->executeStatement(" INSERT IGNORE INTO {$tableName} (`" . implode("`, `", $columns) . "`) VALUES " . implode(", \n", $rows) . " ", $parameters); @@ -156,7 +156,7 @@ class ImportExportRepository { $updateColumns[] = 'deleted_at = NULL'; } - return $this->entityManager->getConnection()->executeStatement(" + return (int)$this->entityManager->getConnection()->executeStatement(" UPDATE {$tableName} SET " . implode(", \n", $updateColumns) . " WHERE diff --git a/mailpoet/lib/Subscribers/SubscribersRepository.php b/mailpoet/lib/Subscribers/SubscribersRepository.php index dfdceeb829..8c1b141988 100644 --- a/mailpoet/lib/Subscribers/SubscribersRepository.php +++ b/mailpoet/lib/Subscribers/SubscribersRepository.php @@ -165,7 +165,7 @@ class SubscribersRepository extends Repository { } $subscriberSegmentsTable = $this->entityManager->getClassMetadata(SubscriberSegmentEntity::class)->getTableName(); - $count = $this->entityManager->getConnection()->executeStatement(" + $count = (int)$this->entityManager->getConnection()->executeStatement(" DELETE ss FROM $subscriberSegmentsTable ss WHERE ss.`subscriber_id` IN (:ids) AND ss.`segment_id` = :segment_id @@ -184,7 +184,7 @@ class SubscribersRepository extends Repository { $subscriberSegmentsTable = $this->entityManager->getClassMetadata(SubscriberSegmentEntity::class)->getTableName(); $segmentsTable = $this->entityManager->getClassMetadata(SegmentEntity::class)->getTableName(); - $count = $this->entityManager->getConnection()->executeStatement(" + $count = (int)$this->entityManager->getConnection()->executeStatement(" DELETE ss FROM $subscriberSegmentsTable ss JOIN $segmentsTable s ON s.id = ss.segment_id AND s.`type` = :typeDefault WHERE ss.`subscriber_id` IN (:ids) diff --git a/mailpoet/prefixer/composer.json b/mailpoet/prefixer/composer.json index bca1323e50..2632752ff5 100644 --- a/mailpoet/prefixer/composer.json +++ b/mailpoet/prefixer/composer.json @@ -2,9 +2,9 @@ "require": { "php": ">=7.2", "cerdic/css-tidy": "2.0.1", - "doctrine/common": "3.2.1", - "doctrine/dbal": "2.13.6", - "doctrine/orm": "2.10.4", + "doctrine/common": "3.2.2", + "doctrine/dbal": "2.13.8", + "doctrine/orm": "2.11.2", "gregwar/captcha": "^1.1", "monolog/monolog": "^1.23", "nesbot/carbon": "2.55.2", diff --git a/mailpoet/prefixer/composer.lock b/mailpoet/prefixer/composer.lock index 3b62fa6976..4b18222ab9 100644 --- a/mailpoet/prefixer/composer.lock +++ b/mailpoet/prefixer/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "876e14ddd5a5cbcec39016e43e7adfa1", + "content-hash": "80704ca7c8e8f3e62e1243b68494c374", "packages": [ { "name": "cerdic/css-tidy", @@ -55,79 +55,6 @@ }, "time": "2022-02-21T15:33:09+00:00" }, - { - "name": "composer/package-versions-deprecated", - "version": "1.11.99.4", - "source": { - "type": "git", - "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "b174585d1fe49ceed21928a945138948cb394600" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600", - "reference": "b174585d1fe49ceed21928a945138948cb394600", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7 || ^8" - }, - "replace": { - "ocramius/package-versions": "1.11.99" - }, - "require-dev": { - "composer/composer": "^1.9.3 || ^2.0@dev", - "ext-zip": "^1.13", - "phpunit/phpunit": "^6.5 || ^7" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "support": { - "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.4" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2021-09-13T08:41:34+00:00" - }, { "name": "doctrine/annotations", "version": "1.13.2", @@ -370,16 +297,16 @@ }, { "name": "doctrine/common", - "version": "3.2.1", + "version": "3.2.2", "source": { "type": "git", "url": "https://github.com/doctrine/common.git", - "reference": "e927fc2410c8723d053b8032e591cdff76587cdb" + "reference": "295082d3750987065912816a9d536c2df735f637" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/e927fc2410c8723d053b8032e591cdff76587cdb", - "reference": "e927fc2410c8723d053b8032e591cdff76587cdb", + "url": "https://api.github.com/repos/doctrine/common/zipball/295082d3750987065912816a9d536c2df735f637", + "reference": "295082d3750987065912816a9d536c2df735f637", "shasum": "" }, "require": { @@ -388,7 +315,7 @@ }, "require-dev": { "doctrine/coding-standard": "^9.0", - "phpstan/phpstan": "^1.2.0", + "phpstan/phpstan": "^1.4.1", "phpstan/phpstan-phpunit": "^1", "phpunit/phpunit": "^7.5.20 || ^8.5 || ^9.0", "squizlabs/php_codesniffer": "^3.0", @@ -440,7 +367,7 @@ ], "support": { "issues": "https://github.com/doctrine/common/issues", - "source": "https://github.com/doctrine/common/tree/3.2.1" + "source": "https://github.com/doctrine/common/tree/3.2.2" }, "funding": [ { @@ -456,20 +383,20 @@ "type": "tidelift" } ], - "time": "2021-12-26T22:39:45+00:00" + "time": "2022-02-02T09:15:57+00:00" }, { "name": "doctrine/dbal", - "version": "2.13.6", + "version": "2.13.8", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "67ef6d0327ccbab1202b39e0222977a47ed3ef2f" + "reference": "dc9b3c3c8592c935a6e590441f9abc0f9eba335b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/67ef6d0327ccbab1202b39e0222977a47ed3ef2f", - "reference": "67ef6d0327ccbab1202b39e0222977a47ed3ef2f", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/dc9b3c3c8592c935a6e590441f9abc0f9eba335b", + "reference": "dc9b3c3c8592c935a6e590441f9abc0f9eba335b", "shasum": "" }, "require": { @@ -482,13 +409,13 @@ "require-dev": { "doctrine/coding-standard": "9.0.0", "jetbrains/phpstorm-stubs": "2021.1", - "phpstan/phpstan": "1.2.0", - "phpunit/phpunit": "^7.5.20|^8.5|9.5.10", + "phpstan/phpstan": "1.4.6", + "phpunit/phpunit": "^7.5.20|^8.5|9.5.16", "psalm/plugin-phpunit": "0.16.1", - "squizlabs/php_codesniffer": "3.6.1", + "squizlabs/php_codesniffer": "3.6.2", "symfony/cache": "^4.4", "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", - "vimeo/psalm": "4.13.0" + "vimeo/psalm": "4.22.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -549,7 +476,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/2.13.6" + "source": "https://github.com/doctrine/dbal/tree/2.13.8" }, "funding": [ { @@ -565,7 +492,7 @@ "type": "tidelift" } ], - "time": "2021-11-26T20:11:05+00:00" + "time": "2022-03-09T15:25:46+00:00" }, { "name": "doctrine/deprecations", @@ -946,24 +873,24 @@ }, { "name": "doctrine/orm", - "version": "2.10.4", + "version": "2.11.2", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "cccb2e2fdfed2969afb3d65c5ea82bafdefbe1a7" + "reference": "9c351e044478135aec1755e2c0c0493a4b6309db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/cccb2e2fdfed2969afb3d65c5ea82bafdefbe1a7", - "reference": "cccb2e2fdfed2969afb3d65c5ea82bafdefbe1a7", + "url": "https://api.github.com/repos/doctrine/orm/zipball/9c351e044478135aec1755e2c0c0493a4b6309db", + "reference": "9c351e044478135aec1755e2c0c0493a4b6309db", "shasum": "" }, "require": { - "composer/package-versions-deprecated": "^1.8", + "composer-runtime-api": "^2", "doctrine/cache": "^1.12.1 || ^2.1.1", "doctrine/collections": "^1.5", "doctrine/common": "^3.0.3", - "doctrine/dbal": "^2.13.1 || ^3.1.1", + "doctrine/dbal": "^2.13.1 || ^3.2", "doctrine/deprecations": "^0.5.3", "doctrine/event-manager": "^1.1", "doctrine/inflector": "^1.4 || ^2.0", @@ -971,8 +898,7 @@ "doctrine/lexer": "^1.0", "doctrine/persistence": "^2.2", "ext-ctype": "*", - "ext-pdo": "*", - "php": "^7.1 ||^8.0", + "php": "^7.1 || ^8.0", "psr/cache": "^1 || ^2 || ^3", "symfony/console": "^3.0 || ^4.0 || ^5.0 || ^6.0", "symfony/polyfill-php72": "^1.23", @@ -985,12 +911,12 @@ "doctrine/annotations": "^1.13", "doctrine/coding-standard": "^9.0", "phpbench/phpbench": "^0.16.10 || ^1.0", - "phpstan/phpstan": "1.2.0", + "phpstan/phpstan": "1.4.6", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.4", "squizlabs/php_codesniffer": "3.6.2", - "symfony/cache": "^4.4 || ^5.2", + "symfony/cache": "^4.4 || ^5.4 || ^6.0", "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0", - "vimeo/psalm": "4.15.0" + "vimeo/psalm": "4.22.0" }, "suggest": { "symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0", @@ -1039,9 +965,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.10.4" + "source": "https://github.com/doctrine/orm/tree/2.11.2" }, - "time": "2021-12-20T21:23:47+00:00" + "time": "2022-03-09T15:23:58+00:00" }, { "name": "doctrine/persistence", diff --git a/mailpoet/prefixer/fix-doctrine.php b/mailpoet/prefixer/fix-doctrine.php index 42506ffde7..346d18198f 100755 --- a/mailpoet/prefixer/fix-doctrine.php +++ b/mailpoet/prefixer/fix-doctrine.php @@ -25,6 +25,23 @@ $php7CachedItem = file_get_contents(__DIR__ . "/../vendor-prefixed/doctrine/cach $php7CachedItem = str_replace('final class CacheItem', 'final class TypedCacheItem', $php7CachedItem); file_put_contents(__DIR__ . "/../vendor-prefixed/doctrine/cache/lib/Doctrine/Common/Cache/Psr6/TypedCacheItem.php", $php7CachedItem); +// Replace PHP8 syntax in ReflectionReadonlyProperty. +// The class is used only in PHP8.1 but it fail to pass pre-commit checks in the plugin repository +// See https://github.com/doctrine/orm/commit/580b9196e65adaacc05b9f7a50654739ad995597#diff-732e324167dd49e48b221477c3e0f6d7934f3eb5ec0970dbf1c06f6c7df15398R3790-R3793 +$readonlyProxy = file_get_contents(__DIR__ . "/../vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Mapping/ReflectionReadonlyProperty.php"); +$readonlyProxy = str_replace( + [ + 'public function __construct(private ReflectionProperty $wrappedProperty)', + 'parent::__construct($wrappedProperty->class, $wrappedProperty->name);', + ], + [ + "/** @var ReflectionProperty */\n private \$wrappedProperty;\n\n public function __construct(ReflectionProperty \$wrappedProperty)", + "\$this->wrappedProperty = \$wrappedProperty;\n parent::__construct(\$wrappedProperty->class, \$wrappedProperty->name);", + ], + $readonlyProxy +); +file_put_contents(__DIR__ . "/../vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Mapping/ReflectionReadonlyProperty.php", $readonlyProxy); + // cleanup file types by extension exec('find ' . __DIR__ . "/../vendor-prefixed/doctrine -type f -name '*.xsd' -delete"); exec('find ' . __DIR__ . "/../vendor-prefixed/doctrine -type f -name 'phpstan.neon' -delete"); @@ -110,6 +127,7 @@ exec('rm ' . __DIR__ . '/../vendor-prefixed/doctrine/dbal/lib/Doctrine/DBAL/Plat // cleanup Doctrine ORM exec('rm -r ' . __DIR__ . '/../vendor-prefixed/doctrine/orm/bin'); exec('rm -r ' . __DIR__ . '/../vendor-prefixed/doctrine/orm/ci'); +exec('rm -r ' . __DIR__ . '/../vendor-prefixed/doctrine/orm/phpstan*.neon'); exec('rm -r ' . __DIR__ . '/../vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php'); exec('rm -r ' . __DIR__ . '/../vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/SimplifiedXmlDriver.php'); exec('rm -r ' . __DIR__ . '/../vendor-prefixed/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/SimplifiedYamlDriver.php');