From 53984de60d9a2535f0f9f63bfc70e839311dcc8b Mon Sep 17 00:00:00 2001 From: Ali Hesari Date: Sat, 7 Mar 2026 18:13:24 +0100 Subject: [PATCH] fix: add PHPCS inline directives for WordPress Plugin Check compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added phpcs:disable comments to all source, example, and test files so the library passes WordPress coding standards when bundled as a vendor dependency inside WordPress plugins. No functional code changes — only inline PHPCS comment directives. --- CHANGELOG.md | 13 +++++++++++++ composer.json | 9 +++++++-- examples/mock/01_creating_posts.php | 1 + examples/mock/02_media_handling.php | 1 + examples/mock/03_formatting.php | 1 + examples/mock/04_platform_config.php | 1 + examples/mock/05_platform_registry.php | 1 + examples/mock/06_publishing.php | 1 + examples/mock/07_error_handling.php | 1 + examples/mock/08_events.php | 1 + examples/mock/09_support_utilities.php | 1 + examples/mock/10_auth_oauth.php | 1 + examples/mock/11_delivery_status.php | 1 + examples/mock/12_full_workflow.php | 1 + examples/mock/platform_discord.php | 1 + examples/mock/platform_instagram.php | 1 + examples/mock/platform_pinterest.php | 1 + examples/mock/platform_reddit.php | 1 + examples/mock/platform_slack.php | 1 + examples/mock/platform_tumblr.php | 1 + examples/mock/platform_whatsapp.php | 1 + examples/real/helpers.php | 1 + examples/real/platform_discord.php | 1 + examples/real/platform_facebook.php | 1 + examples/real/platform_instagram.php | 1 + examples/real/platform_linkedin.php | 1 + examples/real/platform_pinterest.php | 1 + examples/real/platform_reddit.php | 1 + examples/real/platform_slack.php | 1 + examples/real/platform_telegram.php | 1 + examples/real/platform_tumblr.php | 1 + examples/real/platform_twitter.php | 1 + examples/real/platform_whatsapp.php | 1 + src/Auth/OAuthHandler.php | 2 ++ src/Config/ConfigValidator.php | 2 ++ src/Config/PlatformCredentials.php | 2 ++ src/Http/HttpClient.php | 4 ++++ src/Platforms/Discord/DiscordPlatform.php | 2 ++ src/Platforms/Facebook/FacebookPlatform.php | 3 +++ src/Platforms/Instagram/InstagramPlatform.php | 4 ++++ src/Platforms/LinkedIn/LinkedInPlatform.php | 4 ++++ src/Platforms/Pinterest/PinterestPlatform.php | 3 +++ src/Platforms/PlatformRegistry.php | 2 ++ src/Platforms/Reddit/RedditPlatform.php | 2 ++ src/Platforms/Slack/SlackPlatform.php | 3 +++ src/Platforms/Telegram/TelegramPlatform.php | 4 ++++ src/Platforms/Tumblr/TumblrPlatform.php | 3 +++ src/Platforms/Twitter/TwitterPlatform.php | 4 ++++ src/Platforms/WhatsApp/WhatsAppPlatform.php | 3 +++ .../Unit/Platforms/Discord/DiscordFormatterTest.php | 1 + .../Unit/Platforms/Discord/DiscordPlatformTest.php | 1 + .../Platforms/Facebook/FacebookFormatterTest.php | 1 + .../Platforms/Facebook/FacebookPlatformTest.php | 1 + .../Platforms/Instagram/InstagramFormatterTest.php | 1 + .../Platforms/Instagram/InstagramPlatformTest.php | 1 + .../Platforms/LinkedIn/LinkedInFormatterTest.php | 1 + .../Platforms/LinkedIn/LinkedInPlatformTest.php | 1 + .../Platforms/Pinterest/PinterestFormatterTest.php | 1 + .../Platforms/Pinterest/PinterestPlatformTest.php | 1 + tests/Unit/Platforms/Reddit/RedditFormatterTest.php | 1 + tests/Unit/Platforms/Reddit/RedditPlatformTest.php | 1 + tests/Unit/Platforms/Slack/SlackFormatterTest.php | 1 + tests/Unit/Platforms/Slack/SlackPlatformTest.php | 1 + .../Platforms/Telegram/TelegramFormatterTest.php | 1 + .../Platforms/Telegram/TelegramPlatformTest.php | 1 + tests/Unit/Platforms/Tumblr/TumblrFormatterTest.php | 1 + tests/Unit/Platforms/Tumblr/TumblrPlatformTest.php | 1 + .../Unit/Platforms/Twitter/TwitterFormatterTest.php | 1 + .../Unit/Platforms/Twitter/TwitterPlatformTest.php | 1 + .../Platforms/WhatsApp/WhatsAppFormatterTest.php | 1 + .../Platforms/WhatsApp/WhatsAppPlatformTest.php | 1 + 71 files changed, 120 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3b161a..61c9865 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.1] - 2025-07-25 + +### Fixed +- Added PHPCS inline directives (`phpcs:disable`) to all source, example, and test files for WordPress Plugin Check compatibility +- Framework-agnostic library files now pass WordPress coding standards when bundled as a vendor dependency in WordPress plugins +- Suppressed `WordPress.Security.EscapeOutput.ExceptionNotEscaped` — exceptions are not WordPress output in this library +- Suppressed `WordPress.WP.AlternativeFunctions` — native PHP functions (cURL, json_encode, file_get_contents) are required for framework independence +- Suppressed `WordPress.PHP.DiscouragedPHPFunctions` — base64_encode/urlencode required for OAuth and API operations +- Suppressed `WordPress.PHP.NoSilencedErrors` — @unlink used for temporary file cleanup in HttpClient +- Suppressed `Universal.Operators.DisallowShortTernary` — short ternary intentionally used for concise null/empty handling + +## [1.0.0] + ### Added - Framework-agnostic PHP core for social media publishing - Platform abstractions with `PlatformInterface` and `PlatformResponseInterface` diff --git a/composer.json b/composer.json index b8a5fbe..d5d49be 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,9 @@ "ext-json": "*" }, "require-dev": { - "phpunit/phpunit": "^10.0|^11.0" + "dealerdirect/phpcodesniffer-composer-installer": "^1.2", + "phpunit/phpunit": "^10.0|^11.0", + "wp-coding-standards/wpcs": "^3.3" }, "autoload": { "psr-4": { @@ -42,6 +44,9 @@ "minimum-stability": "stable", "prefer-stable": true, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/examples/mock/01_creating_posts.php b/examples/mock/01_creating_posts.php index 4eed302..42fcf1b 100644 --- a/examples/mock/01_creating_posts.php +++ b/examples/mock/01_creating_posts.php @@ -1,4 +1,5 @@