This code sniff will error when print_r
is detected and is outputting directly.
<?php
print_r(
$this->toArray(),
true
);
print_r($this->toArray());
print_r('aaaaaa');
print_r('aaaaa', false);
print_r([], true);
$object->print_r($aaaa);
Will product the following output
----------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
----------------------------------------------------------------------
7 | ERROR | Using "print_r" is prohibited
8 | ERROR | Using "print_r" is prohibited
9 | ERROR | Using "print_r" is prohibited
----------------------------------------------------------------------