From 5597b3541ca50d5a370681d5a27a5de052ed7a92 Mon Sep 17 00:00:00 2001 From: David Stone Date: Tue, 22 Sep 2026 20:17:57 -0600 Subject: [PATCH 1/2] chore: add code quality checks --- .eslintrc | 17 - .eslintrc.json | 214 ++-------- .github/workflows/code-quality.yml | 71 ++++ .gitignore | 1 + composer.json | 21 +- composer.lock | 644 ++++++++++++++++++++++++++++- includes/WooCommerce.php | 2 +- js/simple-comment-editing.js | 8 +- package-lock.json | 39 +- package.json | 7 +- phpcs.xml.dist | 36 +- simple-comment-editing.php | 2 +- 12 files changed, 836 insertions(+), 226 deletions(-) delete mode 100644 .eslintrc create mode 100644 .github/workflows/code-quality.yml diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 73280b0..0000000 --- a/.eslintrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": [ "plugin:@wordpress/eslint-plugin/recommended" ], - "parserOptions": { - "ecmaVersion": 2017 - }, - - "globals": { - "$": true, - "wp":true, - "console":true, - "$uifm":true - }, - "rules": { - "camelcase": "off", - "no-console": "off" - } - } \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json index bce415c..2df3698 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,185 +1,51 @@ { + "extends": "plugin:@wordpress/eslint-plugin/recommended", "parser": "@babel/eslint-parser", - "globals": { - "wp": true, - "wpApiSettings": true, - "window": true, - "document": true, - "simple_comment_editing": true - }, - "env": { - "browser": true, - "node": true, - "es6": true, - "jest/globals": true - }, "parserOptions": { - "ecmaVersion": 6, + "ecmaVersion": 2021, "sourceType": "module", "ecmaFeatures": { - "jsx": true, - "experimentalObjectRestSpread": true + "jsx": true }, "requireConfigFile": false }, - "extends": ["plugin:@wordpress/eslint-plugin/recommended-with-formatting"], - "plugins": ["react", "jsx-a11y", "jest"], - "settings": { - "react": { - "pragma": "wp" - } + "env": { + "browser": true, + "node": true, + "es2021": true + }, + "globals": { + "$": "readonly", + "jQuery": "readonly", + "sceIntegrations": "readonly", + "simple_comment_editing": "readonly", + "wp": "readonly", + "wpApiSettings": "readonly", + "wpAjax": "readonly" }, "rules": { - "array-bracket-spacing": ["error", "always"], - "brace-style": ["error", "1tbs"], - "camelcase": 0, - "comma-dangle": ["error", "always-multiline"], - "comma-spacing": "error", - "comma-style": "error", - "computed-property-spacing": ["error", "always"], - "constructor-super": "error", - "dot-notation": "error", - "eol-last": "error", - "eqeqeq": "error", - "func-call-spacing": "error", - "indent": ["error", "tab", { "SwitchCase": 1 }], - "jsx-a11y/label-has-for": [ - "error", - { - "required": "id" - } - ], - "jsx-a11y/media-has-caption": "off", - "jsx-a11y/no-noninteractive-tabindex": "off", - "jsx-a11y/role-has-required-aria-props": "off", - "jsx-quotes": "error", - "key-spacing": "error", - "keyword-spacing": "error", - "lines-around-comment": "off", - "no-alert": "error", - "no-bitwise": "error", - "no-caller": "error", - "no-console": "error", - "no-const-assign": "error", - "no-debugger": "error", - "no-dupe-args": "error", - "no-dupe-class-members": "error", - "no-dupe-keys": "error", - "no-duplicate-case": "error", - "no-duplicate-imports": "error", - "no-else-return": "error", - "no-eval": "error", - "no-extra-semi": "error", - "no-fallthrough": "error", - "no-lonely-if": "error", - "no-mixed-operators": "error", - "no-mixed-spaces-and-tabs": "error", - "no-multiple-empty-lines": ["error", { "max": 1 }], - "no-multi-spaces": "error", - "no-multi-str": "off", - "no-negated-in-lhs": "error", - "no-nested-ternary": "error", - "no-redeclare": "error", - "no-restricted-syntax": [ - "error", - { - "selector": "ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]", - "message": "Path access on WordPress dependencies is not allowed." - }, - { - "selector": "ImportDeclaration[source.value=/^blocks$/]", - "message": "Use @wordpress/blocks as import path instead." - }, - { - "selector": "ImportDeclaration[source.value=/^components$/]", - "message": "Use @wordpress/components as import path instead." - }, - { - "selector": "ImportDeclaration[source.value=/^date$/]", - "message": "Use @wordpress/date as import path instead." - }, - { - "selector": "ImportDeclaration[source.value=/^editor$/]", - "message": "Use @wordpress/editor as import path instead." - }, - { - "selector": "ImportDeclaration[source.value=/^element$/]", - "message": "Use @wordpress/element as import path instead." - }, - { - "selector": "ImportDeclaration[source.value=/^i18n$/]", - "message": "Use @wordpress/i18n as import path instead." - }, - { - "selector": "ImportDeclaration[source.value=/^data$/]", - "message": "Use @wordpress/data as import path instead." - }, - { - "selector": "ImportDeclaration[source.value=/^utils$/]", - "message": "Use @wordpress/utils as import path instead." - }, - { - "selector": "CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])", - "message": "Translate function arguments must be string literals." - }, - { - "selector": "CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])", - "message": "Translate function arguments must be string literals." - }, - { - "selector": "CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])", - "message": "Translate function arguments must be string literals." - } - ], - "no-shadow": "error", - "no-undef": "error", - "no-undef-init": "error", - "no-unreachable": "error", - "no-unsafe-negation": "error", - "no-unused-expressions": "error", - "no-unused-vars": "error", - "no-useless-computed-key": "error", - "no-useless-constructor": "error", - "no-useless-return": "error", - "no-var": "error", - "no-whitespace-before-property": "error", - "object-curly-spacing": ["error", "always"], - "padded-blocks": ["error", "never"], - "prefer-const": "error", - "quote-props": ["error", "as-needed"], - "react/display-name": "off", - "react/jsx-curly-spacing": [ - "error", - { - "when": "always", - "children": true - } - ], - "react/jsx-equals-spacing": "error", - "react/jsx-indent": ["error", "tab"], - "react/jsx-indent-props": ["error", "tab"], - "react/jsx-key": "error", - "react/jsx-tag-spacing": "error", - "react/no-children-prop": "off", - "react/no-find-dom-node": "warn", - "react/prop-types": "off", - "semi": "error", - "semi-spacing": "error", - "space-before-blocks": ["error", "always"], - "space-before-function-paren": ["error", "never"], - "space-in-parens": ["error", "always"], - "space-infix-ops": ["error", { "int32Hint": false }], - "space-unary-ops": [ - "error", - { - "overrides": { - "!": true - } - } - ], - "template-curly-spacing": ["error", "always"], - "valid-jsdoc": ["error", { "requireReturn": false }], - "valid-typeof": "error", - "yoda": "off" - } + "@wordpress/no-unsafe-wp-apis": "warn", + "@wordpress/no-unused-vars-before-return": "warn", + "camelcase": "off", + "eqeqeq": "warn", + "import/no-unresolved": "warn", + "jsdoc/check-line-alignment": "warn", + "jsdoc/require-param": "warn", + "jsdoc/require-param-description": "warn", + "jsdoc/require-param-type": "warn", + "jsdoc/require-returns": "warn", + "no-alert": "warn", + "no-console": "warn", + "no-multi-str": "warn", + "no-shadow": "warn", + "no-unused-vars": "warn", + "no-var": "warn", + "object-shorthand": "warn", + "prettier/prettier": "off" + }, + "ignorePatterns": [ + "dist/", + "lib/", + "node_modules/" + ] } diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 0000000..ced0ea1 --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,71 @@ +name: Code Quality + +on: + push: + branches: [master] + pull_request: + branches: [master] + workflow_dispatch: + +concurrency: + group: code-quality-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + eslint: + name: ESLint and build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Run ESLint + run: npm run lint:js + + - name: Build assets + run: npm run build + + phpcs: + name: PHPCS + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "8.2" + tools: composer:v2 + coverage: none + + - name: Get Composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache Composer dependencies + uses: actions/cache@v5 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install Composer dependencies + run: composer install --prefer-dist --no-progress + + - name: Run PHPCS + run: composer phpcs diff --git a/.gitignore b/.gitignore index 5ef9ad6..712fefc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules +vendor .DS_Store simple-comment-editing\.zip simple-comment-editing diff --git a/composer.json b/composer.json index 44a9b7e..3256ee2 100644 --- a/composer.json +++ b/composer.json @@ -2,19 +2,34 @@ "name": "ronalfy/simple-comment-editing", "description": "Allow users to edit comments for a period of time.", "type": "project", - "license": "GPL", + "license": "GPL-2.0-or-later", "authors": [ { "name": "Ronald Huereca" } ], "minimum-stability": "dev", + "prefer-stable": true, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "phpcompatibility/phpcompatibility-wp": "^2.1", + "squizlabs/php_codesniffer": "^3.7", + "wp-coding-standards/wpcs": "^3.0" + }, "config": { - "vendor-dir": "lib" + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "sort-packages": true }, - "autoload": { + "autoload": { "psr-4": { "DLXPlugins\\CommentEditLite\\": "includes/" } + }, + "scripts": { + "phpcs": "vendor/bin/phpcs", + "phpcbf": "vendor/bin/phpcbf", + "lint": "@phpcs" } } diff --git a/composer.lock b/composer.lock index a41b359..f50f407 100644 --- a/composer.lock +++ b/composer.lock @@ -4,15 +4,645 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d3992612104ed37783fcca6f7d21c2b4", + "content-hash": "38ca719cf177f1b476473798eccdc613", "packages": [], - "packages-dev": [], + "packages-dev": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v1.2.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "963f0c67bffde0eac41b56be71ac0e8ba132f0bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/963f0c67bffde0eac41b56be71ac0e8ba132f0bd", + "reference": "963f0c67bffde0eac41b56be71ac0e8ba132f0bd", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.2", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "^2.2", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcompatibility/php-compatibility": "^9.0 || ^10.0.0@dev", + "yoast/phpunit-polyfills": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "opensource@frenck.dev", + "homepage": "https://frenck.dev", + "role": "Open source developer" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "security": "https://github.com/PHPCSStandards/composer-installer/security/policy", + "source": "https://github.com/PHPCSStandards/composer-installer" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2026-05-06T08:26:05+00:00" + }, + { + "name": "phpcompatibility/php-compatibility", + "version": "9.3.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "homepage": "https://github.com/wimg", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibility" + }, + "time": "2019-12-27T09:44:58+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-paragonie", + "version": "1.3.4", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", + "reference": "244d7b04fc4bc2117c15f5abe23eb933b5f02bbf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/244d7b04fc4bc2117c15f5abe23eb933b5f02bbf", + "reference": "244d7b04fc4bc2117c15f5abe23eb933b5f02bbf", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "paragonie/random_compat": "dev-master", + "paragonie/sodium_compat": "dev-master" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "paragonie", + "phpcs", + "polyfill", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/security/policy", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" + }, + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcompatibility", + "type": "thanks_dev" + } + ], + "time": "2025-09-19T17:43:28+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-wp", + "version": "2.1.8", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", + "reference": "7c8d18b4d90dac9e86b0869a608fa09158e168fa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/7c8d18b4d90dac9e86b0869a608fa09158e168fa", + "reference": "7c8d18b4d90dac9e86b0869a608fa09158e168fa", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0", + "phpcompatibility/phpcompatibility-paragonie": "^1.0", + "squizlabs/php_codesniffer": "^3.3" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "phpcs", + "standards", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "security": "https://github.com/PHPCompatibility/PHPCompatibilityWP/security/policy", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" + }, + "funding": [ + { + "url": "https://github.com/PHPCompatibility", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcompatibility", + "type": "thanks_dev" + } + ], + "time": "2025-10-18T00:05:59+00:00" + }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.5.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "39467533fdb742446d68c1d10ac33d625ee0311c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/39467533fdb742446d68c1d10ac33d625ee0311c", + "reference": "39467533fdb742446d68c1d10ac33d625ee0311c", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.2.3", + "squizlabs/php_codesniffer": "^3.13.5 || ^4.0.1" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcsstandards/phpcsdevcs": "^1.2.0", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2026-07-27T11:13:17+00:00" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "5f35d9408c54d7b529501f3c688b6eae562aea1f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/5f35d9408c54d7b529501f3c688b6eae562aea1f", + "reference": "5f35d9408c54d7b529501f3c688b6eae562aea1f", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.13.5 || ^4.0.1" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcsstandards/phpcsdevcs": "^1.2.0", + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0 || ^3.0.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "phpcs4", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "security": "https://github.com/PHPCSStandards/PHPCSUtils/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2026-07-27T10:28:41+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.13.6", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "4c378e1a528ea066890fc2397cbdd2f94eb2fc91" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/4c378e1a528ea066890fc2397cbdd2f94eb2fc91", + "reference": "4c378e1a528ea066890fc2397cbdd2f94eb2fc91", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2026-08-06T00:17:32+00:00" + }, + { + "name": "wp-coding-standards/wpcs", + "version": "3.4.1", + "source": { + "type": "git", + "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", + "reference": "ec2ff942335f33683a5957a85d138753876a05cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/ec2ff942335f33683a5957a85d138753876a05cf", + "reference": "ec2ff942335f33683a5957a85d138753876a05cf", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", + "php": ">=7.2", + "phpcsstandards/phpcsextra": "^1.5.1", + "phpcsstandards/phpcsutils": "^1.2.3", + "squizlabs/php_codesniffer": "^3.13.5" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpcompatibility/php-compatibility": "^10.0.0@dev", + "phpcsstandards/phpcsdevtools": "^1.2.0", + "phpunit/phpunit": "^8.0 || ^9.0" + }, + "suggest": { + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Contributors", + "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", + "keywords": [ + "phpcs", + "standards", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues", + "source": "https://github.com/WordPress/WordPress-Coding-Standards", + "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" + }, + "funding": [ + { + "url": "https://opencollective.com/php_codesniffer", + "type": "custom" + } + ], + "time": "2026-07-27T11:53:23+00:00" + } + ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], - "prefer-stable": false, + "stability-flags": {}, + "prefer-stable": true, "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.0.0" + "platform": {}, + "platform-dev": {}, + "plugin-api-version": "2.9.0" } diff --git a/includes/WooCommerce.php b/includes/WooCommerce.php index 6bf604b..781f9cd 100644 --- a/includes/WooCommerce.php +++ b/includes/WooCommerce.php @@ -32,7 +32,7 @@ public static function run() { /** * Add the WooCommerce rating field. * - * @param array $fields Fields. + * @param array $return Return data. * @param WP_Comment $comment Comment. * @param int $post_id Post ID. * @param int $comment_id Comment ID. diff --git a/js/simple-comment-editing.js b/js/simple-comment-editing.js index 986ec87..6052ffe 100644 --- a/js/simple-comment-editing.js +++ b/js/simple-comment-editing.js @@ -361,10 +361,10 @@ jQuery( document ).ready( function( $ ) { } // Get minutes - var minutes = Math.floor( minute_to_seconds / 60 ) % 60; - minute_to_seconds -= minutes; - if ( minutes > 0 ) { - text += minutes + ' ' + _n( 'minute', 'minutes', minutes, 'simple-comment-editing' ); + var remaining_minutes = Math.floor( minute_to_seconds / 60 ) % 60; + minute_to_seconds -= remaining_minutes; + if ( remaining_minutes > 0 ) { + text += remaining_minutes + ' ' + _n( 'minute', 'minutes', remaining_minutes, 'simple-comment-editing' ); } // Get seconds diff --git a/package-lock.json b/package-lock.json index d63efc8..e83fc73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,7 @@ "grunt-cli": "^1.4.2", "grunt-contrib-compress": "^1.6.0", "mini-css-extract-plugin": "^1.5.0", + "prettier": "2.8.8", "prop-types": "^15.8.1", "qs": "^6.11.0", "react": "^18.2.0", @@ -41,6 +42,7 @@ "react-hook-form": "^7.33.1", "sass": "^1.32.11", "sass-loader": "^11.0.1", + "typescript": "5.0.4", "use-async-resource": "^2.2.2", "webpack": "^5.87.0", "webpack-cli": "^4.6.0", @@ -8340,8 +8342,7 @@ "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "node_modules/js-yaml": { "version": "4.1.0", @@ -8580,7 +8581,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dev": true, "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, @@ -9695,6 +9695,22 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", @@ -9845,7 +9861,6 @@ "version": "18.2.0", "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", - "dev": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -9894,7 +9909,6 @@ "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", - "dev": true, "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.0" @@ -9907,7 +9921,6 @@ "version": "0.23.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", - "dev": true, "dependencies": { "loose-envify": "^1.1.0" } @@ -11118,6 +11131,20 @@ "node": ">= 0.4" } }, + "node_modules/typescript": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=12.20" + } + }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", diff --git a/package.json b/package.json index a8aa8fd..b532db0 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,10 @@ "start": "webpack --watch --env mode=development", "dev": "webpack --mode development --env mode=development", "build": "webpack --mode production --env mode=production", - "lint": "eslint ." + "lint": "npm run lint:js", + "lint:js": "eslint src/js js gruntfile.js webpack.config.js", + "lint:js:fix": "npm run lint:js -- --fix", + "lint:php": "composer phpcs" }, "repository": { "type": "git", @@ -48,6 +51,7 @@ "grunt-cli": "^1.4.2", "grunt-contrib-compress": "^1.6.0", "mini-css-extract-plugin": "^1.5.0", + "prettier": "2.8.8", "prop-types": "^15.8.1", "qs": "^6.11.0", "react": "^18.2.0", @@ -55,6 +59,7 @@ "react-hook-form": "^7.33.1", "sass": "^1.32.11", "sass-loader": "^11.0.1", + "typescript": "5.0.4", "use-async-resource": "^2.2.2", "webpack": "^5.87.0", "webpack-cli": "^4.6.0", diff --git a/phpcs.xml.dist b/phpcs.xml.dist index c49246f..b2e9598 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,20 +1,32 @@ - + + PHP_CodeSniffer rules for the Simple Comment Editing WordPress plugin. + + . + + */dist/* + */lib/* + */node_modules/* + */vendor/* + + - + + + + + + + - - + + + + - - - - . - - - /node_modules/ - /vendor/ + + diff --git a/simple-comment-editing.php b/simple-comment-editing.php index fe1e4bb..4f5bda9 100644 --- a/simple-comment-editing.php +++ b/simple-comment-editing.php @@ -938,7 +938,7 @@ public static function remove_comment_cookie( $comment ) { return; } - $this->generate_cookie_data( $comment['comment_post_ID'], $comment['comment_ID'], 'removecookie' ); + self::get_instance()->generate_cookie_data( $comment['comment_post_ID'], $comment['comment_ID'], 'removecookie' ); } /** From c6e957b5b2dc0c11665db5535868402d9f2f99bb Mon Sep 17 00:00:00 2001 From: David Stone Date: Tue, 22 Sep 2026 21:33:15 -0600 Subject: [PATCH 2/2] chore: add phpstan analysis --- .github/workflows/code-quality.yml | 5 +- composer.json | 10 +- composer.lock | 235 ++++++++++++++++++++++++++- includes/Admin/Admin_Settings.php | 22 +-- includes/Admin/Tabs/Integrations.php | 4 +- includes/Admin/Tabs/Settings.php | 4 +- includes/Admin/Tabs/Support.php | 4 +- includes/Admin/Tabs/Tabs.php | 2 +- includes/Ajax.php | 18 +- includes/Functions.php | 54 +++--- includes/Mailchimp.php | 6 +- includes/WooCommerce.php | 24 +-- phpcs.xml.dist | 1 + phpstan-stubs.php | 22 +++ phpstan.neon | 16 ++ simple-comment-editing.php | 74 +++++---- 16 files changed, 391 insertions(+), 110 deletions(-) create mode 100644 phpstan-stubs.php create mode 100644 phpstan.neon diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index ced0ea1..d2844f5 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -39,7 +39,7 @@ jobs: run: npm run build phpcs: - name: PHPCS + name: PHPCS and PHPStan runs-on: ubuntu-latest steps: @@ -69,3 +69,6 @@ jobs: - name: Run PHPCS run: composer phpcs + + - name: Run PHPStan + run: vendor/bin/phpstan analyse --error-format=github --memory-limit=1G diff --git a/composer.json b/composer.json index 3256ee2..4b8892d 100644 --- a/composer.json +++ b/composer.json @@ -12,8 +12,12 @@ "prefer-stable": true, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "php-stubs/woocommerce-stubs": "^3.0", + "php-stubs/wordpress-stubs": "^6.0", "phpcompatibility/phpcompatibility-wp": "^2.1", + "phpstan/phpstan": "^2.0", "squizlabs/php_codesniffer": "^3.7", + "szepeviktor/phpstan-wordpress": "^2.0", "wp-coding-standards/wpcs": "^3.0" }, "config": { @@ -30,6 +34,10 @@ "scripts": { "phpcs": "vendor/bin/phpcs", "phpcbf": "vendor/bin/phpcbf", - "lint": "@phpcs" + "phpstan": "php -d memory_limit=1G vendor/bin/phpstan analyse --memory-limit=1G", + "lint": [ + "@phpcs", + "@phpstan" + ] } } diff --git a/composer.lock b/composer.lock index f50f407..f2920c0 100644 --- a/composer.lock +++ b/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": "38ca719cf177f1b476473798eccdc613", + "content-hash": "d4e246de27646b0d637e8ff3982d2952", "packages": [], "packages-dev": [ { @@ -103,6 +103,112 @@ ], "time": "2026-05-06T08:26:05+00:00" }, + { + "name": "php-stubs/woocommerce-stubs", + "version": "v3.8.0", + "source": { + "type": "git", + "url": "https://github.com/php-stubs/woocommerce-stubs.git", + "reference": "74583d44d4510c431dd548190bfdbd7592aab57e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-stubs/woocommerce-stubs/zipball/74583d44d4510c431dd548190bfdbd7592aab57e", + "reference": "74583d44d4510c431dd548190bfdbd7592aab57e", + "shasum": "" + }, + "require-dev": { + "ext-gettext": "*", + "ext-hash": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "giacocorsiglia/stubs-generator": "^0.5.0", + "php": "~7.1", + "woocommerce/woocommerce": "3.8.0" + }, + "suggest": { + "symfony/polyfill-php73": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan" + }, + "type": "library", + "extra": { + "installer-paths": { + "{$name}/": [ + "type:wordpress-plugin" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WooCommerce function and class declaration stubs for static analysis.", + "homepage": "https://github.com/php-stubs/woocommerce-stubs", + "keywords": [ + "PHPStan", + "static analysis", + "woocommerce", + "wordpress" + ], + "support": { + "issues": "https://github.com/php-stubs/woocommerce-stubs/issues", + "source": "https://github.com/php-stubs/woocommerce-stubs/tree/v3.8.0" + }, + "time": "2019-11-21T22:17:45+00:00" + }, + { + "name": "php-stubs/wordpress-stubs", + "version": "v6.9.4", + "source": { + "type": "git", + "url": "https://github.com/php-stubs/wordpress-stubs.git", + "reference": "90a9412826b9944f93b10bf41d795b5fe68abcd5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/90a9412826b9944f93b10bf41d795b5fe68abcd5", + "reference": "90a9412826b9944f93b10bf41d795b5fe68abcd5", + "shasum": "" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "5.6.1" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "nikic/php-parser": "^5.5", + "php": "^7.4 || ^8.0", + "php-stubs/generator": "^0.8.6", + "phpdocumentor/reflection-docblock": "^6.0", + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^9.5", + "symfony/polyfill-php80": "*", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.1.1", + "wp-coding-standards/wpcs": "3.1.0 as 2.3.0" + }, + "suggest": { + "paragonie/sodium_compat": "Pure PHP implementation of libsodium", + "symfony/polyfill-php80": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "szepeviktor/phpstan-wordpress": "WordPress extensions for PHPStan" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WordPress function and class declaration stubs for static analysis.", + "homepage": "https://github.com/php-stubs/wordpress-stubs", + "keywords": [ + "PHPStan", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/php-stubs/wordpress-stubs/issues", + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.9.4" + }, + "time": "2026-05-01T20:36:01+00:00" + }, { "name": "phpcompatibility/php-compatibility", "version": "9.3.5", @@ -491,6 +597,70 @@ ], "time": "2026-07-27T10:28:41+00:00" }, + { + "name": "phpstan/phpstan", + "version": "2.2.14", + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9c672e7a8e791dfc3d30e55f683e73fc0b63a3ac", + "reference": "9c672e7a8e791dfc3d30e55f683e73fc0b63a3ac", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ondřej Mirtes" + }, + { + "name": "Markus Staab" + }, + { + "name": "Vincent Langlet" + } + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2026-09-12T21:39:33+00:00" + }, { "name": "squizlabs/php_codesniffer", "version": "3.13.6", @@ -570,6 +740,69 @@ ], "time": "2026-08-06T00:17:32+00:00" }, + { + "name": "szepeviktor/phpstan-wordpress", + "version": "v2.0.4", + "source": { + "type": "git", + "url": "https://github.com/szepeviktor/phpstan-wordpress.git", + "reference": "84577e2ea1e4c2a95537fe5ea2ac8e18f4ceab1a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/84577e2ea1e4c2a95537fe5ea2ac8e18f4ceab1a", + "reference": "84577e2ea1e4c2a95537fe5ea2ac8e18f4ceab1a", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "php-stubs/wordpress-stubs": ">=6.6.2", + "phpstan/phpstan": "^2.0" + }, + "require-dev": { + "composer/composer": "^2.1.14", + "composer/semver": "^3.4", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.1", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.0", + "szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^1.0", + "wp-coding-standards/wpcs": "3.1.0 as 2.3.0" + }, + "suggest": { + "swissspidy/phpstan-no-private": "Detect usage of internal core functions, classes and methods" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "SzepeViktor\\PHPStan\\WordPress\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "WordPress extensions for PHPStan", + "keywords": [ + "PHPStan", + "code analyse", + "code analysis", + "static analysis", + "wordpress" + ], + "support": { + "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues", + "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v2.0.4" + }, + "time": "2026-05-22T16:22:09+00:00" + }, { "name": "wp-coding-standards/wpcs", "version": "3.4.1", diff --git a/includes/Admin/Admin_Settings.php b/includes/Admin/Admin_Settings.php index 22c0661..55509ed 100644 --- a/includes/Admin/Admin_Settings.php +++ b/includes/Admin/Admin_Settings.php @@ -24,7 +24,7 @@ class Admin_Settings { public function __construct() { // For the admin interface. add_action( 'admin_menu', array( $this, 'register_settings_menu' ) ); - add_action( 'plugin_action_links_' . Functions::get_plugin_path(), array( $this, 'plugin_settings_link' ) ); + add_filter( 'plugin_action_links_' . Functions::get_plugin_path(), array( $this, 'plugin_settings_link' ) ); // init tabs here. new Tabs\Settings(); @@ -93,7 +93,7 @@ public static function get_settings_tabs() { $tabs = apply_filters( 'sce_admin_tabs', $tabs ); $tab_html = '