Skip to content

Fix typos, improve PHP 8.1+ compatibility, and enhance cache and work… - #356

Closed
sonali195 wants to merge 1 commit into
WordPress:masterfrom
sonali195:fix/runner-fixes-and-improvements
Closed

sonali195 wants to merge 1 commit into
WordPress:masterfrom
sonali195:fix/runner-fixes-and-improvements

Conversation

@sonali195

Copy link
Copy Markdown

Description

This pull request addresses several bug fixes, code quality improvements, and compatibility updates across the test runner:

  1. Typo Fixes & Docblock Corrections:

    • Fixed a typo in report.php (PHPUnity -> PHPUnit).
    • Corrected inaccurate docblock comments in functions.php for setup_runner_env_vars() (which previously contained copied Gutenberg block-delimiter descriptions) and corrected @type bool $WPT_DEBUG_MODE to $WPT_DEBUG.
    • Removed an outdated/misleading comment regarding TLS certificate validation in prepare.php.
  2. PHP 8.1+ Compatibility & Notice Prevention:

    • Guarded wpt_curl_selected_bits() with function_exists() checks in both functions.php and prepare.php to prevent potential fatal redeclaration errors on repeated calls.
    • Added string casting to shell_exec() outputs before passing to trim() to avoid PHP 8.1+ deprecation warnings when commands return null.
    • Safely verified regex match results before accessing $version[1] during Imagick/Gmagick version parsing.
  3. PHPCS & Cache Improvements:

    • Added .cache/.gitkeep, updated .gitignore, and added directory verification in composer.json scripts so running composer lint or phpcs directly does not error out on fresh clones when .cache/ is missing.
    • Added .gitattributes to enforce eol=lf across platforms and prevent line-ending sniff errors on Windows checkouts.
    • Fixed code alignment warnings in functions.php to achieve 0 PHPCS warnings.
  4. CI Testing:

    • Added PHP 8.3 to the PHPUnit test workflow matrix (.github/workflows/phpunit-tests.yml).

Testing Instructions

  1. Run composer install.
  2. Run composer lint / composer lint:errors to verify all PHPCS checks pass.
  3. Run php -l on all PHP files to confirm syntax validity.

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sonali195 <sonaliprajapati@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@chrisdavidmiles

Copy link
Copy Markdown

As implemented, composer lint errors out because it chains two @php commands with &&, which is unsupported:

sh: @php: command not found
Script @php -r "..." && @php ./vendor/.../phpcs ... returned with error code 127

Also the directory guard for the .cache folder is redundant alongside .cache/.gitkeep

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