Documentation

PrintingFunctionsTrait

Helper functions and function lists for checking whether a function prints output.

Any sniff class which incorporates this trait will automatically support the following public property which can be changed from within a custom ruleset:

  • customPrintingFunctions.
Tags
since
3.0.0

The properties in this trait were previously contained partially in the WordPressCS\WordPress\Sniff class and partially in the EscapeOutputSniff class and have been moved here.

Table of Contents

Properties

$customPrintingFunctions  : array<string|int, string>
Custom list of functions which print output incorporating the passed values.
$addedCustomPrintingFunctions  : array<string|int, string>
Cache of previously added custom functions.
$allPrintingFunctions  : array<string, bool>
Combined list of WP/PHP native and custom printing functions.
$printingFunctions  : array<string, bool>
Functions which print output incorporating the values passed to them.

Methods

get_printing_functions()  : array<string, bool>
Retrieve a list of all known printing functions.
is_printing_function()  : bool
Check if a particular function is regarded as a printing function.

Properties

$customPrintingFunctions

Custom list of functions which print output incorporating the passed values.

public array<string|int, string> $customPrintingFunctions = array()
Tags
since
0.4.0
since
3.0.0

Moved from the EscapeOutput Sniff class to this trait.

used-by
EscapeOutputSniff

$addedCustomPrintingFunctions

Cache of previously added custom functions.

private array<string|int, string> $addedCustomPrintingFunctions = array()

Prevents having to do the same merges over and over again.

Tags
since
0.4.0
since
0.11.0
  • Changed from public static to protected non-static.
  • Changed the format from simple bool to array.
since
3.0.0
  • Moved from the EscapeOutput Sniff class to this trait.
  • Visibility changed from protected to private.

$allPrintingFunctions

Combined list of WP/PHP native and custom printing functions.

private array<string, bool> $allPrintingFunctions = array()
Tags
since
3.0.0

$printingFunctions

Functions which print output incorporating the values passed to them.

private array<string, bool> $printingFunctions = array('_deprecated_argument' => true, '_deprecated_constructor' => true, '_deprecated_file' => true, '_deprecated_function' => true, '_deprecated_hook' => true, '_doing_it_wrong' => true, '_e' => true, '_ex' => true, 'printf' => true, 'trigger_error' => true, 'user_error' => true, 'vprintf' => true, 'wp_die' => true, 'wp_dropdown_pages' => true)
Tags
since
0.5.0
since
0.11.0

Changed from public static to protected non-static.

since
3.0.0
  • Moved from the Sniff class to this trait.
  • Visibility changed from protected to private.

Methods

get_printing_functions()

Retrieve a list of all known printing functions.

public final get_printing_functions() : array<string, bool>
Tags
since
3.0.0
Return values
array<string, bool>

is_printing_function()

Check if a particular function is regarded as a printing function.

public final is_printing_function(string $functionName) : bool
Parameters
$functionName : string

The name of the function to check.

Tags
since
3.0.0
Return values
bool

        
On this page

Search results