Skip to content

Commit 16fac88

Browse files
authored
Merge pull request #79 from vpietri/php-7.4-compatibility
Php 7.4 compatibility
2 parents 630325c + b137dfb commit 16fac88

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

Helper/Data.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ public function getCacheFrontendPool()
9393

9494
public function getQdbConfig($key, $scopeType = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null)
9595
{
96+
// Backward compatibility
97+
if($key=='handle_vardumper' && !class_exists(\Symfony\Component\VarDumper\VarDumper::class)) {
98+
return false;
99+
}
100+
96101
return $this->getConfig('dev/quickdevbar/'.$key, $scopeType, $scopeCode);
97102
}
98103

@@ -437,7 +442,7 @@ public function getIDELinkForClass($class)
437442
return $this->getIDELinkForFile($file, 1, $class);
438443
}
439444

440-
} catch (\ReflectionException) {
445+
} catch (\ReflectionException $e) {
441446

442447
}
443448
return $class;

Observer/ControllerFrontSendResponseBeforeObserver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ControllerFrontSendResponseBeforeObserver implements ObserverInterface
2121

2222

2323
public function __construct(\ADM\QuickDevBar\Helper\Register $qdbHelperRegister,
24-
Data $qdbHelper,)
24+
Data $qdbHelper)
2525
{
2626
$this->qdbHelperRegister = $qdbHelperRegister;
2727
$this->qdbHelper = $qdbHelper;

Plugin/Framework/App/FrontController.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
use ADM\QuickDevBar\Helper\Register;
77
use ADM\QuickDevBar\Service\Dumper;
88
use Magento\Framework\App\RequestInterface;
9-
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
10-
use Symfony\Component\VarDumper\VarDumper;
11-
use Symfony\Component\VarDumper\Cloner\VarCloner;
12-
139

1410
class FrontController
1511
{
@@ -63,7 +59,7 @@ public function beforeDispatch(\Magento\Framework\App\FrontControllerInterface $
6359
if($this->request->isAjax() && $enabledHandler<2) {
6460
return;
6561
}
66-
$prevHandler = VarDumper::setHandler($this->dumperHandler(...));
62+
$prevHandler = \Symfony\Component\VarDumper\VarDumper::setHandler($this->dumperHandler(...));
6763
}
6864
}
6965

@@ -73,8 +69,8 @@ public function beforeDispatch(\Magento\Framework\App\FrontControllerInterface $
7369
*/
7470
protected function dumperHandler($var)
7571
{
76-
$cloner = new VarCloner();
77-
$dumper = new HtmlDumper();
72+
$cloner = new \Symfony\Component\VarDumper\Cloner\VarCloner();
73+
$dumper = new \Symfony\Component\VarDumper\Dumper\HtmlDumper();
7874

7975
$dumper->setTheme('dark');
8076
$dumpBt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)[2];

view/base/templates/tab/dumper.phtml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?php
22
/** @var $block \ADM\QuickDevBar\Block\Tab\Panel */
33
?>
4+
<?php if(!$block->getQdbConfig('handle_vardumper')):?>
5+
<p>You need to activate admin configuration and having VarDumper Component installed, see <a href="https://github.com/symfony/var-dumper">github.com/symfony/var-dumper</a></p>
6+
<?php endif; ?>
7+
8+
49

510
<?php if(!$block->getDumps()): ?>
611
<div class="qdb-dump"></div>

0 commit comments

Comments
 (0)