0

Step 1: Switch LocalWP to PHP 8.3

  1. Open LocalWP.
  2. Select your WordPress website.
  3. Go to Overview.
  4. Find PHP Version.
  5. Select PHP 8.3.
  6. Restart the website.
  7. Open Site Shell and verify:

php -v

Make sure it displays PHP 8.3.x.
Step 2: Install PHPCompatibility and PHP_CodeSniffer
Open LocalWP → Select your website → Open Site Shell.

Navigate to the WordPress root directory:


cd app/public

Check Composer:


composer --version

Install the required tools:


composer require --dev squizlabs/php_codesniffer phpcompatibility/php-compatibility

Register PHPCompatibility:


vendor/bin/phpcs --config-set installed_paths "$(pwd)/vendor/phpcompatibility/php-compatibility"

Verify installation:


vendor/bin/phpcs -i

Make sure PHPCompatibility appears in the installed standards list.
Step 3: Scan Themes and Plugins for PHP 8.3 Compatibility
Run the following command to scan PHP files only and export the complete report:


vendor/bin/phpcs \ --standard=PHPCompatibility \ --runtime-set testVersion 8.3 \ --extensions=php \ --report=full \ wp-content/themes wp-content/plugins \ > php83-compatibility-report.txt 2>&1

Report location:


app/public/php83-compatibility-report.txt

Open the report on Mac:


open php83-compatibility-report.txt

The report includes:

  • PHP compatibility errors.
  • Deprecated PHP functions.
  • Potentially incompatible PHP code.
  • File paths and line numbers.
  • Descriptions of detected issues.

Note: PHPCompatibility performs static code analysis.

To export the complete PHP 8.3 compatibility report, use:

vendor/bin/phpcs \
--standard=PHPCompatibility \
--runtime-set testVersion 8.3 \
--extensions=php \
--report=full \
wp-content/themes wp-content/plugins \
> php83-compatibility-report.txt 2>&1

To export only the summary:

vendor/bin/phpcs \
--standard=PHPCompatibility \
--runtime-set testVersion 8.3 \
--extensions=php \
--report=summary \
wp-content/themes wp-content/plugins \
> php83-summary-report.txt 2>&1

Jagdish Sarma Asked question 20 minutes ago
Add a Comment