Skip to content

Commit e6bfebc

Browse files
committed
fix: php84 null
1 parent acb8b34 commit e6bfebc

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

src/DataCollector/LaravelQueryCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class LaravelQueryCollector extends QueryCollector
3434
'slow_threshold' => false, // 仅显示慢sql,设置毫秒时间来启用
3535
];
3636

37-
public function __construct(array $config = [], DebugBarTimeDataCollector $timeCollector = null)
37+
public function __construct(array $config = [], ?DebugBarTimeDataCollector $timeCollector = null)
3838
{
3939
$this->config = ArrayHelper::merge($this->config, $config);
4040

src/DataCollector/LaravelRedisCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class LaravelRedisCollector extends LaravelQueryCollector
2424
'slow_threshold' => false, // 仅显示慢执行,设置毫秒时间来启用
2525
];
2626

27-
public function __construct(array $config = [], DebugBarTimeDataCollector $timeCollector = null)
27+
public function __construct(array $config = [], ?DebugBarTimeDataCollector $timeCollector = null)
2828
{
2929
parent::__construct($config, $timeCollector);
3030

src/DataCollector/PDO/PDOCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class PDOCollector extends \DebugBar\DataCollector\PDO\PDOCollector
1010
/**
1111
* @inheritDoc
1212
*/
13-
protected function collectPDO(DebugbarTraceablePDO $pdo, TimeDataCollector $timeCollector = null, $connectionName = null)
13+
protected function collectPDO(DebugbarTraceablePDO $pdo, ?TimeDataCollector $timeCollector = null, $connectionName = null)
1414
{
1515
$data = parent::collectPDO($pdo, $timeCollector, $connectionName);
1616

src/DataCollector/ThinkPdoCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class ThinkPdoCollector extends PDOCollector
1212
{
13-
public function __construct(array $thinkOrmConfig = [], TimeDataCollector $timeCollector = null)
13+
public function __construct(array $thinkOrmConfig = [], ?TimeDataCollector $timeCollector = null)
1414
{
1515
$config = array_merge([
1616
'default' => '',

src/Laravel/DataCollector/QueryCollector.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class QueryCollector extends PDOCollector
3333
];
3434

3535
/**
36-
* @param TimeDataCollector $timeCollector
36+
* @param TimeDataCollector|null $timeCollector
3737
*/
38-
public function __construct(TimeDataCollector $timeCollector = null)
38+
public function __construct(?TimeDataCollector $timeCollector = null)
3939
{
4040
$this->timeCollector = $timeCollector;
4141
}
@@ -79,7 +79,7 @@ public function setShowCopyButton($enabled = true)
7979
*/
8080
public function setFindSource($value, array $middleware)
8181
{
82-
$this->findSource = (bool) $value;
82+
$this->findSource = (bool)$value;
8383
$this->middleware = $middleware;
8484
}
8585

@@ -96,7 +96,7 @@ public function mergeBacktraceExcludePaths(array $excludePaths)
9696
/**
9797
* Enable/disable the shaded duration background on queries
9898
*
99-
* @param bool $enabled
99+
* @param bool $enabled
100100
*/
101101
public function setDurationBackground($enabled)
102102
{
@@ -106,8 +106,8 @@ public function setDurationBackground($enabled)
106106
/**
107107
* Enable/disable the EXPLAIN queries
108108
*
109-
* @param bool $enabled
110-
* @param array|null $types Array of types to explain queries (select/insert/update/delete)
109+
* @param bool $enabled
110+
* @param array|null $types Array of types to explain queries (select/insert/update/delete)
111111
*/
112112
public function setExplainSource($enabled, $types)
113113
{
@@ -162,7 +162,7 @@ public function addQuery($query, $bindings, $time, $connection)
162162
if (!is_int($binding) && !is_float($binding)) {
163163
if ($pdo) {
164164
try {
165-
$binding = $pdo->quote((string) $binding);
165+
$binding = $pdo->quote((string)$binding);
166166
} catch (\Exception) {
167167
$binding = $this->emulateQuote($binding);
168168
}
@@ -171,7 +171,7 @@ public function addQuery($query, $bindings, $time, $connection)
171171
}
172172
}
173173

174-
$query = preg_replace($regex, addcslashes($binding, '$'), (string) $query, 1);
174+
$query = preg_replace($regex, addcslashes($binding, '$'), (string)$query, 1);
175175
}
176176
}
177177

@@ -210,10 +210,10 @@ public function addQuery($query, $bindings, $time, $connection)
210210
*/
211211
protected function emulateQuote($value)
212212
{
213-
$search = ["\\", "\x00", "\n", "\r", "'", '"', "\x1a"];
214-
$replace = ["\\\\","\\0","\\n", "\\r", "\'", '\"', "\\Z"];
213+
$search = ["\\", "\x00", "\n", "\r", "'", '"', "\x1a"];
214+
$replace = ["\\\\", "\\0", "\\n", "\\r", "\'", '\"', "\\Z"];
215215

216-
return "'" . str_replace($search, $replace, (string) $value) . "'";
216+
return "'" . str_replace($search, $replace, (string)$value) . "'";
217217
}
218218

219219
/**
@@ -280,13 +280,13 @@ protected function findSource()
280280
/**
281281
* Parse a trace element from the backtrace stack.
282282
*
283-
* @param int $index
284-
* @param array $trace
283+
* @param int $index
284+
* @param array $trace
285285
* @return object|bool
286286
*/
287287
protected function parseTrace($index, array $trace)
288288
{
289-
$frame = (object) [
289+
$frame = (object)[
290290
'index' => $index,
291291
'namespace' => null,
292292
'name' => null,
@@ -311,7 +311,7 @@ protected function parseTrace($index, array $trace)
311311
} elseif (str_contains($file, base_path() . '/storage')) {
312312
$hash = pathinfo($file, PATHINFO_FILENAME);
313313

314-
if (! $frame->name = $this->findViewFromHash($hash)) {
314+
if (!$frame->name = $this->findViewFromHash($hash)) {
315315
$frame->name = $hash;
316316
}
317317

@@ -350,7 +350,7 @@ protected function fileIsInExcludedPath($file)
350350
$normalizedPath = str_replace('\\', '/', $file);
351351

352352
foreach ($this->backtraceExcludePaths as $excludedPath) {
353-
if (str_contains($normalizedPath, (string) $excludedPath)) {
353+
if (str_contains($normalizedPath, (string)$excludedPath)) {
354354
return true;
355355
}
356356
}
@@ -361,15 +361,15 @@ protected function fileIsInExcludedPath($file)
361361
/**
362362
* Find the middleware alias from the file.
363363
*
364-
* @param string $file
364+
* @param string $file
365365
* @return string|null
366366
*/
367367
protected function findMiddlewareFromFile($file)
368368
{
369369
$filename = pathinfo($file, PATHINFO_FILENAME);
370370

371371
foreach ($this->middleware as $alias => $class) {
372-
if (str_contains((string) $class, $filename)) {
372+
if (str_contains((string)$class, $filename)) {
373373
return $alias;
374374
}
375375
}
@@ -378,7 +378,7 @@ protected function findMiddlewareFromFile($file)
378378
/**
379379
* Find the template name from the hash.
380380
*
381-
* @param string $hash
381+
* @param string $hash
382382
* @return null|string
383383
*/
384384
protected function findViewFromHash($hash)
@@ -397,7 +397,7 @@ protected function findViewFromHash($hash)
397397
}
398398

399399
foreach ($property->getValue($finder) as $name => $path) {
400-
if (sha1((string) $path) == $hash || md5((string) $path) == $hash) {
400+
if (sha1((string)$path) == $hash || md5((string)$path) == $hash) {
401401
return $name;
402402
}
403403
}
@@ -440,7 +440,7 @@ protected function normalizeFilename($path)
440440

441441
/**
442442
* Collect a database transaction event.
443-
* @param string $event
443+
* @param string $event
444444
* @param \Illuminate\Database\Connection $connection
445445
* @return array
446446
*/
@@ -586,4 +586,4 @@ public function getWidgets()
586586
]
587587
];
588588
}
589-
}
589+
}

0 commit comments

Comments
 (0)