From 348fe09ccfe41bea9774db0372dda104b63797a8 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 20 May 2025 11:13:19 +0200 Subject: [PATCH 1/4] PHPStan level 9 --- composer.json | 7 +++-- features/fetch.feature | 55 ----------------------------------- phpstan.neon.dist | 20 +++++++++++++ src/Cache_Command.php | 6 +--- src/Fetch_Command.php | 63 +++++++++++++++++----------------------- src/Provider_Command.php | 10 ++----- src/oEmbed.php | 59 ------------------------------------- 7 files changed, 55 insertions(+), 165 deletions(-) create mode 100644 phpstan.neon.dist delete mode 100644 src/oEmbed.php diff --git a/composer.json b/composer.json index 1f8f7b6..66ebb0b 100644 --- a/composer.json +++ b/composer.json @@ -15,14 +15,15 @@ }, "require-dev": { "wp-cli/entity-command": "^1.3 || ^2", - "wp-cli/wp-cli-tests": "^4" + "wp-cli/wp-cli-tests": "dev-main" }, "config": { "process-timeout": 7200, "sort-packages": true, "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, - "johnpbloch/wordpress-core-installer": true + "johnpbloch/wordpress-core-installer": true, + "phpstan/extension-installer": true }, "lock": false }, @@ -60,12 +61,14 @@ "behat-rerun": "rerun-behat-tests", "lint": "run-linter-tests", "phpcs": "run-phpcs-tests", + "phpstan": "run-phpstan-tests", "phpcbf": "run-phpcbf-cleanup", "phpunit": "run-php-unit-tests", "prepare-tests": "install-package-tests", "test": [ "@lint", "@phpcs", + "@phpstan", "@phpunit", "@behat" ] diff --git a/features/fetch.feature b/features/fetch.feature index d3ac3ea..68ef353 100644 --- a/features/fetch.feature +++ b/features/fetch.feature @@ -90,32 +90,6 @@ Feature: Manage oEmbed fetch. https://foo.example.com """ - # WP prior to 4.9 does not return clickable link. - @less-than-wp-4.9 @require-wp-4.0 - Scenario: Doesn't make unknown URLs clickable - When I try `wp embed fetch https://foo.example.com` - Then the return code should be 1 - # Old versions of WP_oEmbed can trigger PHP "Only variables should be passed by reference" notices on discover so use "contain" to cater for these. - And STDERR should contain: - """ - Error: There was an error fetching the oEmbed data. - """ - And STDOUT should be empty - @require-wp-4.0 Scenario: Caches oEmbed response data for a given post # Note need post author for 'unfiltered_html' check to work for WP < 4.4. @@ -410,23 +372,6 @@ Feature: Manage oEmbed fetch.