Skip to content

Commit

Permalink
Merge pull request #79 from vpietri/php-7.4-compatibility
Browse files Browse the repository at this point in the history
Php 7.4 compatibility
  • Loading branch information
vpietri authored Jun 22, 2024
2 parents 630325c + b137dfb commit 16fac88
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
7 changes: 6 additions & 1 deletion Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public function getCacheFrontendPool()

public function getQdbConfig($key, $scopeType = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null)
{
// Backward compatibility
if($key=='handle_vardumper' && !class_exists(\Symfony\Component\VarDumper\VarDumper::class)) {
return false;
}

return $this->getConfig('dev/quickdevbar/'.$key, $scopeType, $scopeCode);
}

Expand Down Expand Up @@ -437,7 +442,7 @@ public function getIDELinkForClass($class)
return $this->getIDELinkForFile($file, 1, $class);
}

} catch (\ReflectionException) {
} catch (\ReflectionException $e) {

}
return $class;
Expand Down
2 changes: 1 addition & 1 deletion Observer/ControllerFrontSendResponseBeforeObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ControllerFrontSendResponseBeforeObserver implements ObserverInterface


public function __construct(\ADM\QuickDevBar\Helper\Register $qdbHelperRegister,
Data $qdbHelper,)
Data $qdbHelper)
{
$this->qdbHelperRegister = $qdbHelperRegister;
$this->qdbHelper = $qdbHelper;
Expand Down
10 changes: 3 additions & 7 deletions Plugin/Framework/App/FrontController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
use ADM\QuickDevBar\Helper\Register;
use ADM\QuickDevBar\Service\Dumper;
use Magento\Framework\App\RequestInterface;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
use Symfony\Component\VarDumper\VarDumper;
use Symfony\Component\VarDumper\Cloner\VarCloner;


class FrontController
{
Expand Down Expand Up @@ -63,7 +59,7 @@ public function beforeDispatch(\Magento\Framework\App\FrontControllerInterface $
if($this->request->isAjax() && $enabledHandler<2) {
return;
}
$prevHandler = VarDumper::setHandler($this->dumperHandler(...));
$prevHandler = \Symfony\Component\VarDumper\VarDumper::setHandler($this->dumperHandler(...));
}
}

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

$dumper->setTheme('dark');
$dumpBt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)[2];
Expand Down
5 changes: 5 additions & 0 deletions view/base/templates/tab/dumper.phtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php
/** @var $block \ADM\QuickDevBar\Block\Tab\Panel */
?>
<?php if(!$block->getQdbConfig('handle_vardumper')):?>
<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>
<?php endif; ?>



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

0 comments on commit 16fac88

Please sign in to comment.