10up / safe-redirect-manager

A simple HTTP redirection plugin for WordPress.
https://wordpress.org/plugins/safe-redirect-manager
GNU General Public License v2.0
314 stars 82 forks source link

PHP 8.1: Ensure PHPCS doesn't warn on the now harmless ini_set #355

Closed philipjohn closed 10 months ago

philipjohn commented 1 year ago

Description of the Change

While #327 resolved a deprecation warning, the code is still flagged by PHPCS as being problematic. This change builds on #327 to add the phpcs:ignore statement so that the code doesn't hold up any processes unnecessarily by flagging something that's no longer an issue.

Closes #283

How to test the Change

  1. Run PHPCS using PHP 8.1 (e.g. with <config name="testVersion" value="8.1" /> in phpcs.xml)
  2. Observe that PHPCS produces a warning for inc/functions.php:415
  3. Apply this patch and re-run PHPCS, there will be no warning

Changelog Entry

Added - phpcs:ignore on the now safe ini_set()

Credits

Props @philipjohn

Checklist:

philipjohn commented 12 months ago

@ravinderk Are you referring to the "Silencing errors..." warning? If so, that's not the PHPCS issue this PR is addressing.

Without this PR, PHP 8.2 compatibility checks with PHPCS report the following:

FILE: safe-redirect-manager/inc/functions.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 336 | WARNING | INI directive 'auto_detect_line_endings' is deprecated since PHP 8.1
     |         | (PHPCompatibility.IniDirectives.RemovedIniDirectives.auto_detect_line_endingsDeprecated)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

After this change, that deprecation warning is gone.