Skip to content

Commit 40e5cf0

Browse files
TjoostenTjoosten
authored andcommitted
replace and by &&
The and operator does not have the same precedence as &&. This could lead to unexpected behavior, use && instead.
1 parent 0576b25 commit 40e5cf0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/LaravelDebugbar.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function () use ($debugbar) {
164164
$this->addCollector(new RequestDataCollector());
165165
}
166166

167-
if ($this->shouldCollect('events', false) and isset($this->app['events'])) {
167+
if ($this->shouldCollect('events', false) && isset($this->app['events'])) {
168168
try {
169169
$startTime = defined('LARAVEL_START') ? LARAVEL_START : null;
170170
$eventCollector = new EventCollector($startTime);
@@ -182,7 +182,7 @@ function () use ($debugbar) {
182182
}
183183
}
184184

185-
if ($this->shouldCollect('views', true) and isset($this->app['events'])) {
185+
if ($this->shouldCollect('views', true) && isset($this->app['events'])) {
186186
try {
187187
$collectData = $this->app['config']->get('debugbar.options.views.data', true);
188188
$this->addCollector(new ViewCollector($collectData));
@@ -251,7 +251,7 @@ function ($level, $message, $context) use ($logger) {
251251
}
252252
}
253253

254-
if ($this->shouldCollect('db', true) and isset($this->app['db'])) {
254+
if ($this->shouldCollect('db', true) && isset($this->app['db'])) {
255255
$db = $this->app['db'];
256256
if ($debugbar->hasCollector('time') && $this->app['config']->get(
257257
'debugbar.options.db.timeline',
@@ -305,7 +305,7 @@ function ($query, $bindings, $time, $connectionName) use ($db, $queryCollector)
305305
try {
306306
$mailer = $this->app['mailer']->getSwiftMailer();
307307
$this->addCollector(new SwiftMailCollector($mailer));
308-
if ($this->app['config']->get('debugbar.options.mail.full_log') and $this->hasCollector(
308+
if ($this->app['config']->get('debugbar.options.mail.full_log') && $this->hasCollector(
309309
'messages'
310310
)
311311
) {
@@ -476,7 +476,7 @@ public function modifyResponse($request, $response)
476476
}
477477
}
478478

479-
if ($this->shouldCollect('symfony_request', true) and !$this->hasCollector('request')) {
479+
if ($this->shouldCollect('symfony_request', true) && !$this->hasCollector('request')) {
480480
try {
481481
$this->addCollector(new SymfonyRequestCollector($request, $response, $sessionManager));
482482
} catch (\Exception $e) {
@@ -497,7 +497,7 @@ public function modifyResponse($request, $response)
497497
$app['log']->error('Debugbar exception: ' . $e->getMessage());
498498
}
499499
} elseif (
500-
$this->isJsonRequest($request) and
500+
$this->isJsonRequest($request) &&
501501
$app['config']->get('debugbar.capture_ajax', true)
502502
) {
503503
try {
@@ -506,7 +506,7 @@ public function modifyResponse($request, $response)
506506
$app['log']->error('Debugbar exception: ' . $e->getMessage());
507507
}
508508
} elseif (
509-
($response->headers->has('Content-Type') and
509+
($response->headers->has('Content-Type') &&
510510
strpos($response->headers->get('Content-Type'), 'html') === false)
511511
|| $request->getRequestFormat() !== 'html'
512512
) {
@@ -548,7 +548,7 @@ protected function isDebugbarRequest()
548548
{
549549
return $this->app['request']->segment(1) == '_debugbar';
550550
}
551-
551+
552552
/**
553553
* @param \Symfony\Component\HttpFoundation\Request $request
554554
* @return bool

0 commit comments

Comments
 (0)