Skip to content

Commit

Permalink
Redo fixes for "Implicitly marking parameter as nullable is deprecate…
Browse files Browse the repository at this point in the history
…d" to support older versions of PHP
  • Loading branch information
adrianbj committed Nov 27, 2024
1 parent 29d93cd commit 1498869
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion TracyDebugger.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static function getModuleInfo() {
'summary' => __('Tracy debugger from Nette with many PW specific custom tools.', __FILE__),
'author' => 'Adrian Jones',
'href' => 'https://processwire.com/talk/forum/58-tracy-debugger/',
'version' => '4.26.43',
'version' => '4.26.44',
'autoload' => 100000, // in PW 3.0.114+ higher numbers are loaded first - we want Tracy first
'singular' => true,
'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4',
Expand Down
16 changes: 8 additions & 8 deletions includes/ShortcutMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function tracyUnavailable() {
* @tracySkipLocation
*/
if(!function_exists('debugAll') && in_array('debugAll', $this->data['enabledShortcutMethods'])) {
function debugAll($var, $title = NULL, array $options = NULL) {
function debugAll($var, $title = NULL, $options = []) {
if(tracyUnavailable()) return false;
return TD::debugAll($var, $title, $options);
}
Expand All @@ -31,7 +31,7 @@ function debugAll($var, $title = NULL, array $options = NULL) {
* @tracySkipLocation
*/
if(!function_exists('barDump') && in_array('barDump', $this->data['enabledShortcutMethods'])) {
function barDump($var, $title = NULL, array $options = NULL) {
function barDump($var, $title = NULL, $options = []) {
if(tracyUnavailable() && !\TracyDebugger::getDataValue('recordGuestDumps')) return false;
return TD::barDump($var, $title, $options);
}
Expand All @@ -53,7 +53,7 @@ function barDumpBig($var, $title = NULL) {
* @tracySkipLocation
*/
if(!function_exists('dump') && in_array('dump', $this->data['enabledShortcutMethods'])) {
function dump($var, $title = NULL, array $options = NULL) {
function dump($var, $title = NULL, $options = []) {
if(tracyUnavailable() && PHP_SAPI !== 'cli') return false;
return TD::dump($var, $title, $options);
}
Expand All @@ -64,7 +64,7 @@ function dump($var, $title = NULL, array $options = NULL) {
* @tracySkipLocation
*/
if(!function_exists('dumpBig') && in_array('dumpBig', $this->data['enabledShortcutMethods'])) {
function dumpBig($var, $title = NULL, array $options = NULL) {
function dumpBig($var, $title = NULL, $options = []) {
if(tracyUnavailable() && PHP_SAPI !== 'cli') return false;
return TD::dumpBig($var, $title, $options);
}
Expand Down Expand Up @@ -136,7 +136,7 @@ function templateVars($vars) {
* @tracySkipLocation
*/
if(!function_exists('da') && in_array('da', $this->data['enabledShortcutMethods'])) {
function da($var, $title = NULL, array $options = NULL) {
function da($var, $title = NULL, $options = []) {
if(tracyUnavailable()) return false;
return TD::debugAll($var, $title, $options);
}
Expand All @@ -147,7 +147,7 @@ function da($var, $title = NULL, array $options = NULL) {
* @tracySkipLocation
*/
if(!function_exists('bd') && in_array('bd', $this->data['enabledShortcutMethods'])) {
function bd($var, $title = NULL, array $options = NULL) {
function bd($var, $title = NULL, $options = []) {
if(tracyUnavailable() && !\TracyDebugger::getDataValue('recordGuestDumps')) return false;
return TD::barDump($var, $title, $options);
}
Expand All @@ -169,7 +169,7 @@ function bdb($var, $title = NULL) {
* @tracySkipLocation
*/
if(!function_exists('d') && in_array('d', $this->data['enabledShortcutMethods'])) {
function d($var, $title = NULL, array $options = NULL) {
function d($var, $title = NULL, $options = []) {
if(tracyUnavailable() && PHP_SAPI !== 'cli') return false;
return TD::dump($var, $title, $options);
}
Expand All @@ -180,7 +180,7 @@ function d($var, $title = NULL, array $options = NULL) {
* @tracySkipLocation
*/
if(!function_exists('db') && in_array('db', $this->data['enabledShortcutMethods'])) {
function db($var, $title = NULL, array $options = NULL) {
function db($var, $title = NULL, $options = []) {
if(tracyUnavailable() && PHP_SAPI !== 'cli') return false;
return TD::dumpBig($var, $title, $options);
}
Expand Down
24 changes: 12 additions & 12 deletions includes/TD.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected static function tracyUnavailable() {
* Tracy\Debugger::debugAll() shortcut.
* @tracySkipLocation
*/
public static function debugAll($var, string|array|null $title = NULL, ?array $options = NULL) {
public static function debugAll($var, $title = NULL, $options = []) {
if(self::tracyUnavailable()) return false;
static::barDump($var, $title, $options);
static::dump($var, $title, $options);
Expand All @@ -51,7 +51,7 @@ public static function debugAll($var, string|array|null $title = NULL, ?array $o
* Tracy\Debugger::barEcho() shortcut.
* @tracySkipLocation
*/
public static function barEcho(string $str, string|array|null $title = null) {
public static function barEcho($str, $title = null) {
if(self::tracyUnavailable() && !\TracyDebugger::getDataValue('recordGuestDumps')) return false;
static::dumpToBar($str, $title, null, true);
}
Expand All @@ -60,7 +60,7 @@ public static function barEcho(string $str, string|array|null $title = null) {
* Tracy\Debugger::barDump() shortcut.
* @tracySkipLocation
*/
public static function barDump($var, string|array|null $title = NULL, ?array $options = NULL) {
public static function barDump($var, $title = NULL, $options = []) {
if(self::tracyUnavailable() && !\TracyDebugger::getDataValue('recordGuestDumps')) return false;
if(is_array($title)) {
$options = $title;
Expand All @@ -85,7 +85,7 @@ public static function barDump($var, string|array|null $title = NULL, ?array $op
* Tracy\Debugger::barDumpBig() shortcut dumping with maxDepth = 6, maxLength = 9999, and maxItems = 250.
* @tracySkipLocation
*/
public static function barDumpBig($var, string|array|null $title = NULL, ?array $options = NULL) {
public static function barDumpBig($var, $title = NULL, $options = []) {
if(self::tracyUnavailable() && !\TracyDebugger::getDataValue('recordGuestDumps')) return false;
if(is_array($title)) {
$options = $title;
Expand All @@ -108,7 +108,7 @@ public static function barDumpBig($var, string|array|null $title = NULL, ?array
* Tracy\Debugger::dump() shortcut.
* @tracySkipLocation
*/
public static function dump($var, string|array|null $title = NULL, ?array $options = NULL) {
public static function dump($var, $title = NULL, $options = []) {
if(self::tracyUnavailable() && PHP_SAPI !== 'cli') return false;
if(is_array($title)) {
$options = $title;
Expand Down Expand Up @@ -153,7 +153,7 @@ public static function dump($var, string|array|null $title = NULL, ?array $optio
* Tracy\Debugger::dumpBig() shortcut dumping with maxDepth = 6, maxLength = 9999 and maxItems = 250.
* @tracySkipLocation
*/
public static function dumpBig($var, string|array|null $title = NULL, ?array $options = NULL) {
public static function dumpBig($var, $title = NULL, $options = []) {
if(self::tracyUnavailable() && PHP_SAPI !== 'cli') return false;
if(is_array($title)) {
$options = $title;
Expand Down Expand Up @@ -196,7 +196,7 @@ public static function dumpBig($var, string|array|null $title = NULL, ?array $op
* Send content to dump bar
* @tracySkipLocation
*/
private static function dumpToBar($var, string|array|null $title = NULL, ?array $options = NULL, $echo = false) {
private static function dumpToBar($var, $title = NULL, $options = [], $echo = false) {
$dumpItem = array();
$dumpItem['title'] = $title;
$dumpItem['dump'] = $echo ? '<div class="tracy-echo">' . $var . '</div>' : static::generateDump($var, $options);
Expand All @@ -214,7 +214,7 @@ private static function dumpToBar($var, string|array|null $title = NULL, ?array
* Generate debugInfo and Full Object tabbed output
* @tracySkipLocation
*/
private static function generateDump($var, array $options) {
private static function generateDump($var, $options) {
// standard options for all dump/barDump variations
$options[Dumper::COLLAPSE] = isset($options['collapse']) ? $options['collapse'] : \TracyDebugger::getDataValue('collapse');
$options[Dumper::COLLAPSE_COUNT] = isset($options['collapse_count']) ? $options['collapse_count'] : \TracyDebugger::getDataValue('collapse_count');
Expand Down Expand Up @@ -341,7 +341,7 @@ private static function generateEditViewLinks($var, $type, $section) {
* Tracy\Debugger::log() shortcut.
* @tracySkipLocation
*/
public static function log(string $message, $priority = Debugger::INFO) {
public static function log($message, $priority = Debugger::INFO) {
if(self::tracyUnavailable()) return false;
return Debugger::log($message, $priority);
}
Expand All @@ -350,7 +350,7 @@ public static function log(string $message, $priority = Debugger::INFO) {
* Tracy\Debugger::timer() shortcut.
* @tracySkipLocation
*/
public static function timer(?string $name = NULL) {
public static function timer($name = NULL) {
if(self::tracyUnavailable()) return false;
$roundedTime = round(Debugger::timer($name),4);
if($name) {
Expand All @@ -365,7 +365,7 @@ public static function timer(?string $name = NULL) {
* Tracy\Debugger::fireLog() shortcut.
* @tracySkipLocation
*/
public static function fireLog(?string $message = NULL) {
public static function fireLog($message = NULL) {
if(!method_exists('Tracy\Debugger', 'getFireLogger') || self::tracyUnavailable()) return false;
return Debugger::fireLog($message);
}
Expand All @@ -375,7 +375,7 @@ public static function fireLog(?string $message = NULL) {
* Zarganwar\PerformancePanel\Register::add() shortcut.
* @tracySkipLocation
*/
public static function addBreakpoint(?string $name = null, ?bool $enforceParent = null) {
public static function addBreakpoint($name = null, $enforceParent = null) {
if(self::tracyUnavailable() || !class_exists('\Zarganwar\PerformancePanel\Register')) return false;
return Zarganwar\PerformancePanel\Register::add($name, $enforceParent);
}
Expand Down

0 comments on commit 1498869

Please sign in to comment.