diff --git a/mailpoet/lib/Cron/CronWorkerRunner.php b/mailpoet/lib/Cron/CronWorkerRunner.php index 0038ba7611..12aaeecf7b 100644 --- a/mailpoet/lib/Cron/CronWorkerRunner.php +++ b/mailpoet/lib/Cron/CronWorkerRunner.php @@ -71,7 +71,7 @@ class CronWorkerRunner { $this->processTask($worker, $task); } } catch (\Exception $e) { - if ($task && $e->getCode() !== CronHelper::DAEMON_EXECUTION_LIMIT_REACHED) { + if (isset($task) && $task && $e->getCode() !== CronHelper::DAEMON_EXECUTION_LIMIT_REACHED) { $this->cronWorkerScheduler->rescheduleProgressively($task); } throw $e; diff --git a/mailpoet/tasks/phpstan/composer.json b/mailpoet/tasks/phpstan/composer.json index 49e670512a..d2f4dc228c 100644 --- a/mailpoet/tasks/phpstan/composer.json +++ b/mailpoet/tasks/phpstan/composer.json @@ -1,10 +1,10 @@ { "require": { "php-stubs/woocommerce-stubs": "^6.0", - "phpstan/phpstan": "1.4.8", + "phpstan/phpstan": "1.4.10", "phpstan/phpstan-doctrine": "1.2.11", "phpstan/phpstan-phpunit": "1.0.0", - "szepeviktor/phpstan-wordpress": "1.0.2" + "szepeviktor/phpstan-wordpress": "1.0.3" }, "autoload": { "psr-4": { diff --git a/mailpoet/tasks/phpstan/composer.lock b/mailpoet/tasks/phpstan/composer.lock index af5e15dd5c..e00b264e6e 100644 --- a/mailpoet/tasks/phpstan/composer.lock +++ b/mailpoet/tasks/phpstan/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": "6298983b6de60bbf967cde283553c278", + "content-hash": "ff830b6e9cbe937699c148d8d53b907b", "packages": [ { "name": "php-stubs/woocommerce-stubs", @@ -99,16 +99,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.4.8", + "version": "1.4.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "2a6d6704b17c4db6190cc3104056c0aad740cb15" + "reference": "898c479c39caa727bedf4311dd294a8f4e250e72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2a6d6704b17c4db6190cc3104056c0aad740cb15", - "reference": "2a6d6704b17c4db6190cc3104056c0aad740cb15", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/898c479c39caa727bedf4311dd294a8f4e250e72", + "reference": "898c479c39caa727bedf4311dd294a8f4e250e72", "shasum": "" }, "require": { @@ -122,11 +122,6 @@ "phpstan.phar" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -139,7 +134,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.4.8" + "source": "https://github.com/phpstan/phpstan/tree/1.4.10" }, "funding": [ { @@ -159,7 +154,7 @@ "type": "tidelift" } ], - "time": "2022-03-04T13:03:56+00:00" + "time": "2022-03-14T10:25:45+00:00" }, { "name": "phpstan/phpstan-doctrine", @@ -289,7 +284,7 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", @@ -348,7 +343,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" }, "funding": [ { @@ -368,16 +363,16 @@ }, { "name": "szepeviktor/phpstan-wordpress", - "version": "v1.0.2", + "version": "v1.0.3", "source": { "type": "git", "url": "https://github.com/szepeviktor/phpstan-wordpress.git", - "reference": "d44b5abcaa529698e138b2d21bc2a7cf9834039c" + "reference": "265d06b4673572fa379567d2b99df7794c0ab27a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/d44b5abcaa529698e138b2d21bc2a7cf9834039c", - "reference": "d44b5abcaa529698e138b2d21bc2a7cf9834039c", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/265d06b4673572fa379567d2b99df7794c0ab27a", + "reference": "265d06b4673572fa379567d2b99df7794c0ab27a", "shasum": "" }, "require": { @@ -387,7 +382,7 @@ "symfony/polyfill-php73": "^1.12.0" }, "require-dev": { - "composer/composer": "^1.10.23", + "composer/composer": "^2.1.12", "dealerdirect/phpcodesniffer-composer-installer": "^0.7", "php-parallel-lint/php-parallel-lint": "^1.1", "phpstan/phpstan-strict-rules": "^1.0", @@ -421,7 +416,7 @@ ], "support": { "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues", - "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.0.2" + "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v1.0.3" }, "funding": [ { @@ -429,7 +424,7 @@ "type": "custom" } ], - "time": "2021-11-19T12:47:11+00:00" + "time": "2022-03-05T07:34:50+00:00" } ], "packages-dev": [], @@ -440,5 +435,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/mailpoet/tests/integration/Newsletter/RendererTest.php b/mailpoet/tests/integration/Newsletter/RendererTest.php index 68f4a3e102..10a60e5bd6 100644 --- a/mailpoet/tests/integration/Newsletter/RendererTest.php +++ b/mailpoet/tests/integration/Newsletter/RendererTest.php @@ -19,7 +19,6 @@ use MailPoet\Newsletter\Renderer\Preprocessor; use MailPoet\Newsletter\Renderer\Renderer; use MailPoet\Util\pQuery\pQuery; use PHPUnit\Framework\MockObject\MockObject; -use WP_Error; class RendererTest extends \MailPoetTest { public $dOMParser; @@ -634,9 +633,6 @@ class RendererTest extends \MailPoetTest { 'post_status' => 'publish', ] ); - if ($postId instanceof WP_Error) { - $this->fail('Error preparing data for test: failed to create post.'); - } $filename = dirname(__DIR__) . '/../../tests/_data/600x400.jpg'; $contents = file_get_contents($filename); @@ -646,9 +642,6 @@ class RendererTest extends \MailPoetTest { $upload = wp_upload_bits(basename($filename), null, $contents); $attachmentId = $this->makeAttachment($upload); - if ($attachmentId instanceof WP_Error) { - $this->fail('Error preparing data for test: failed to create attachment.'); - } set_post_thumbnail($postId, $attachmentId); $this->newsletter->setBody(json_decode( @@ -684,9 +677,6 @@ class RendererTest extends \MailPoetTest { ]; $id = wp_insert_attachment($attachment, $upload['file'], $parentPostId); - if ($id instanceof WP_Error) { - return $id; - } $metadata = wp_generate_attachment_metadata($id, $upload['file']); wp_update_attachment_metadata($id, $metadata); diff --git a/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceSubscriptionTest.php b/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceSubscriptionTest.php index f2ffc0ad1d..4242c8c882 100644 --- a/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceSubscriptionTest.php +++ b/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceSubscriptionTest.php @@ -152,14 +152,11 @@ class WooCommerceSubscriptionTest extends \MailPoetTest { 'post_title' => $name, ]; $productId = wp_insert_post($productData); - if (is_wp_error($productId)) { - throw new \RuntimeException("Could not create product '$name': " . $productId->get_error_message()); - } $this->products[] = (int)$productId; return (int)$productId; } - private function createSubscription(array $args, int $user, int ...$productIds): ?int { + private function createSubscription(array $args, int $user, int ...$productIds): int { global $wpdb; $defaults = [ 'post_status' => 'wc-active', @@ -169,9 +166,6 @@ class WooCommerceSubscriptionTest extends \MailPoetTest { $args = wp_parse_args($args, $defaults); $orderId = wp_insert_post($args); - if (is_wp_error($orderId)) { - return null; - } $orderId = (int)$orderId; update_post_meta( $orderId, '_customer_user', $user );