Skip to content
1 change: 1 addition & 0 deletions HM/Sniffs/Security/EscapeOutputSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*
* @see https://github.com/WordPress/WordPress-Coding-Standards/issues/1864
*/
#[AllowDynamicProperties]
Copy link
Member Author

Choose a reason for hiding this comment

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

@goldenapples Is this necessary? Seems like we should know the properties being used?

Choose a reason for hiding this comment

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

Huh. Yeah, this was pretty hacky.

The problem is that $printingFunctions is changed in the parent class from protected to private, so trying to unset items from $this->printingFunctions here is not going to work, and will trigger an accessing dynamic properties warning.

foreach ( $this->hmSafePrintingFunctions as $function => $val ) {
unset( $this->printingFunctions[ $function ] );
}

This annotation silences the dynamic properties deprecation warning. It does not, however, make the code here work to ignore the safe printing functions.

class EscapeOutputSniff extends WPCSEscapeOutputSniff {
use ExtraSniffCode;

Expand Down