Skip to content

fix: Remediate PHPCS lints#147

Open
justlevine wants to merge 1 commit intotest/skeleton-migrationfrom
scaffold-php-fixes
Open

fix: Remediate PHPCS lints#147
justlevine wants to merge 1 commit intotest/skeleton-migrationfrom
scaffold-php-fixes

Conversation

@justlevine
Copy link
Collaborator

Description

Fixes all the PHPCS issues in this repo

Important

This PR is based on #146 , which should be merged first

Technical Details

OpenCode Prompt:

Review and remediate all PHPCS errors in this repo: npm run lint:php

1. Run npm run lint:php to see all the smells.
2. Choose smell and review it and study the relevant code causing the smell.
3. Make a plan and fix the relevant smells.
4. Validate your fix by running npm run lint:php and confirming the smell is gone.
5. Choose another smell, and repeat steps 2-5 until there are no more smells.
ulw

Reviewed manually.

Checklist

Screenshots

To-do

Fixes/Covers issue

Fixes #

@justlevine justlevine requested a review from Copilot March 5, 2026 22:53
@justlevine justlevine changed the base branch from test/skeleton-migration to develop March 5, 2026 22:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Remediates PHPCS lint issues across the repo and modernizes tooling/configuration for PHP, JS/TS, testing, CI, and releases.

Changes:

  • Refactors PHPCS/PHPStan/PHPUnit configs and adds new test harness/files (Jest, Playwright, PHPUnit base TestCase).
  • Updates build/tooling configs (webpack, tsconfig, eslint/stylelint/prettier) and repo automation (CI workflows, release-please, dependabot).
  • Applies formatting/standards fixes across PHP and JS/TS sources and documentation.

Reviewed changes

Copilot reviewed 81 out of 90 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
webpack.config.js Aligns webpack config with updated wp-scripts defaults and plugin behavior.
uninstall.php Refactors uninstall flow and consolidates option/transient deletion.
tsconfig.json Simplifies TS project config and points to a shared base.
tsconfig.base.json Introduces a shared TS ruleset for reuse across projects/tests.
tests/php/TestCase.php Adds a PHPUnit base class to improve PHPUnit 11.5 compatibility.
tests/js/tsconfig.json Adds a dedicated TS config for JS unit tests.
tests/js/setup.ts Adds Jest setup (jest-dom + mock clearing).
tests/e2e/settings/activation.spec.ts Adds a basic Playwright activation/deactivation E2E test.
tests/bootstrap.php Updates PHPUnit bootstrap logic/paths and strict types.
release-please-config.json Adds Release Please configuration for automated releases.
playwright.config.ts Adds Playwright config and sets artifacts/storage state paths.
phpunit.xml.dist Upgrades PHPUnit schema/config and changes bootstrap/source/coverage settings.
phpstan.neon.dist Reformats and updates PHPStan rules and version constraints.
phpcs.xml.dist Removes legacy PHPCS ruleset config file.
package.json Updates scripts/deps for linting, formatting, tests (Jest/E2E), and wp-env usage.
onesearch.php Updates plugin header metadata and strict types/constant definitions.
languages/onesearch-features.pot Removes an unused/outdated POT file.
jest.config.js Adds a custom Jest configuration extending wp-scripts defaults.
inc/Utils.php Removes stray whitespace-only line for PHPCS compliance.
inc/Modules/Settings/Settings.php Adds hook-callback annotations and PHPCS suppressions where needed.
inc/Modules/Search/Watcher.php Adds hook-callback annotations and PHPCS suppressions where needed.
inc/Modules/Search/Settings.php Adds hook-callback annotations and PHPCS suppressions where needed.
inc/Modules/Search/Search.php Adjusts filter signatures/accepted args and minor cleanups.
inc/Modules/Search/Post_Record.php Updates PHPCS ignore code for hook-name sniff.
inc/Modules/Search/Algolia.php Removes stray whitespace-only line for PHPCS compliance.
inc/Modules/Rest/Search_Controller.php Adds strict types and docblock cleanups.
inc/Modules/Rest/Governing_Data_Handler.php Adds strict types and docblock cleanups.
inc/Modules/Rest/Governing_Data_Controller.php Adds strict types and removes stray whitespace-only line.
inc/Modules/Rest/Basic_Options_Controller.php Adds strict types and docblock cleanups.
inc/Modules/Core/Rest.php Removes stray whitespace-only line for PHPCS compliance.
inc/Modules/Core/Assets.php Changes enqueue signature (likely to satisfy lints) and cleans docblock.
inc/Contracts/Interfaces/Registrable.php Removes stray whitespace-only line for PHPCS compliance.
docs/SECURITY.md Normalizes punctuation/indentation and list formatting.
docs/DEVELOPMENT.md Major docs refresh for tooling, workflows, tests, and release process.
docs/CONTRIBUTING.md Updates PR target branch and wording consistency.
docs/CODE_OF_CONDUCT.md Normalizes markdown list formatting/indentation.
composer.json Updates dev tooling deps (coding standards, phpstan/phpunit tooling) and metadata.
blueprint.json Adds WP Playground blueprint for demos/previews.
babel.config.js Formatting update for lint/format consistency.
assets/src/js/utils.ts Normalizes TS spacing and wraps long expressions for lint compliance.
assets/src/components/SiteTable.tsx Formatting + prop typing cleanups to satisfy linting/formatting rules.
assets/src/components/SiteSettings.tsx Formatting + minor JSX prop/style normalization.
assets/src/components/SiteSearchSettings.js Formatting and promise chain cleanup for lint compliance.
assets/src/components/SiteModal.tsx Formatting/typing cleanups and error message string normalization.
assets/src/components/SiteIndexableEntities.js Formatting and long-line wrapping for lint compliance.
assets/src/components/MultiSelectChips.js Formatting/JSX wrapping for lint compliance.
assets/src/components/AlgoliaSettings.tsx Formatting/typing cleanups for lint compliance.
assets/src/admin/settings/page.tsx Formatting, typing, and promise chain cleanup for lint compliance.
assets/src/admin/settings/index.tsx Corrects dependency section header comment.
assets/src/admin/search/index.js Formatting and error message wrapping for lint compliance.
assets/src/admin/onboarding/page.tsx Reorders deps sections and formats generics/props.
assets/src/admin/onboarding/index.tsx Corrects dependency section header comment.
LICENSE.md Renames/adds license file as markdown.
LICENSE Removes legacy plain-text license file.
.wp-env.json Normalizes plugin list and adds debug logging config.
.stylelintrc.json Removes old stylelint JSON config.
.stylelint.config.js Adds JS-based stylelint config.
.release-please-manifest.json Adds Release Please manifest.
.prettierrc.js Adds Prettier config extending @wordpress/prettier-config.
.prettierignore Adds Prettier ignore patterns.
.phpcs.xml.dist Adds new dotfile PHPCS ruleset (rtCamp + project settings).
.lintstagedrc.mjs Adds lint-staged config to run linters/formatters pre-commit.
.lefthook.yml Adds lefthook config stub (currently commented out).
.gitignore Expands ignore patterns for tooling, build output, tests, and configs.
.github/workflows/test.yml Removes legacy monolithic GitHub Actions workflow.
.github/workflows/reusable-wp-playground-pr-preview.yml Adds reusable workflow for WP Playground PR previews.
.github/workflows/reusable-phpunit.yml Adds reusable PHPUnit workflow.
.github/workflows/reusable-phpstan.yml Adds reusable PHPStan workflow.
.github/workflows/reusable-phpcs.yml Adds reusable PHPCS workflow.
.github/workflows/reusable-lint-css-js.yml Adds reusable JS/CSS lint workflow.
.github/workflows/reusable-jest.yml Adds reusable Jest workflow.
.github/workflows/reusable-e2e.yml Adds reusable Playwright E2E workflow.
.github/workflows/reusable-build.yml Adds reusable build workflow for zip artifacts.
.github/workflows/release.yml Reworks releases to use Release Please + build/upload steps.
.github/workflows/pr-title.yml Adds semantic PR title validation workflow.
.github/workflows/copilot-setup-steps.yml Updates Copilot setup workflow with clearer steps/pinning.
.github/workflows/ci.yml Adds new modular CI workflow using reusable pipelines + change detection.
.github/workflows/README.md Documents the modular workflows and local testing guidance.
.github/dependabot.yml Reworks dependabot config with grouping/limits/strategies.
.github/.codecov.yml Adds Codecov configuration and path fixes.
.gitattributes Adds export-ignore rules for composer installs and marks docs.
.eslintrc.json Removes JSON ESLint config (migrated to JS).
.eslintrc.js Adds new JS ESLint config with TS/Jest/Playwright overrides.
.eslintignore Normalizes eslint ignore paths.
.editorconfig Simplifies editorconfig sections and aligns markdown/text handling.
.distignore Adds composer distribution ignore list.
Comments suppressed due to low confidence (5)

webpack.config.js:1

  • This assumes @wordpress/scripts/config/webpack.config exports an array. In many wp-scripts versions it exports a single config object, which would make this destructuring throw at runtime (not iterable). Consider requiring it as an object, or supporting both shapes (e.g., const wpConfig = require(...); const defaultScriptConfig = Array.isArray(wpConfig) ? wpConfig[0] : wpConfig;).
    webpack.config.js:1
  • This assumes @wordpress/scripts/config/webpack.config exports an array. In many wp-scripts versions it exports a single config object, which would make this destructuring throw at runtime (not iterable). Consider requiring it as an object, or supporting both shapes (e.g., const wpConfig = require(...); const defaultScriptConfig = Array.isArray(wpConfig) ? wpConfig[0] : wpConfig;).
    phpstan.neon.dist:1
  • The ignoreErrors key is declared but has no value. This can break PHPStan config parsing (or at least results in an invalid/non-array setting). Either remove ignoreErrors: entirely or set it to an explicit empty list (e.g., ignoreErrors: []).
    inc/Modules/Core/Assets.php:1
  • In WordPress, admin_enqueue_scripts passes $hook_suffix by default, and add_action() defaults accepted_args to 1. If this method is registered without explicitly setting accepted_args to 0, WP will pass 1 argument and PHP 8+ will throw an ArgumentCountError because the method now takes zero parameters. Either restore the $hook_suffix parameter or ensure the hook registration uses add_action( ..., ..., 10, 0 ).
    inc/Modules/Rest/Search_Controller.php:1
  • The declare(strict_types = 1); formatting is inconsistent with the rest of the codebase in this PR (e.g., declare( strict_types = 1 ); in other files). If PHPCS rules enforce spacing/formatting, this may reintroduce lint errors. Consider normalizing to the project’s chosen declare( strict_types = 1 ); style throughout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +3 to +4
on:
pull_request_target:
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow is triggered via pull_request_target, but the job condition checks for github.event_name == 'pull_request', so the job will never run. Update the condition to match pull_request_target (or remove the event_name check and only gate on draft == false).

Copilot uses AI. Check for mistakes.
@justlevine justlevine force-pushed the scaffold-php-fixes branch from 5c762fe to 98965fd Compare March 6, 2026 01:13
@justlevine justlevine changed the base branch from develop to test/skeleton-migration March 6, 2026 02:02
@justlevine justlevine requested a review from up1512001 March 6, 2026 02:07
Copy link
Member

@up1512001 up1512001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants