Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/run-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
pull_request:
branches:
- "*"
schedule:
- cron: '0 0 * * *'

jobs:
php-tests:
Expand All @@ -19,7 +17,7 @@ jobs:

strategy:
matrix:
php: [8.5, 8.4, 8.3, 8.2, 8.1]
php: [8.5, 8.4, 8.3, 8.2]

name: PHP${{ matrix.php }}

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/run-screenshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
pull_request:
branches:
- "*"
schedule:
- cron: '0 0 * * *'

jobs:
php-tests:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
pull_request:
branches:
- "*"
schedule:
- cron: '0 0 * * *'

jobs:
php-tests:
Expand All @@ -19,7 +17,7 @@ jobs:

strategy:
matrix:
php: [8.5, 8.4, 8.3, 8.2, 8.1]
php: [8.5, 8.4, 8.3, 8.2]

name: PHP${{ matrix.php }}

Expand Down
17 changes: 9 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
}
],
"require": {
"php": "^8.1",
"php-debugbar/php-debugbar": "^2.0",
"php": "^8.2",
"php-debugbar/php-debugbar": "^3",
"doctrine/orm": "^2.10|^3.0",
"doctrine/dbal": "^3.6|^4",
"symfony/var-exporter": "^6.4|^7",
"symfony/dom-crawler": "^6.4|^7",
"symfony/browser-kit": "^6.4|^7"
"doctrine/dbal": "^3.6|^4"
},
"require-dev": {
"symfony/var-exporter": "^6.4|^7",
"symfony/dom-crawler": "^6.4|^7",
"symfony/browser-kit": "^6.4|^7",
"phpunit/phpunit": "^10",
"symfony/panther": "^1|^2.1",
"dbrekelmans/bdi": "^1"
Expand Down Expand Up @@ -55,7 +55,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "3.0-dev"
}
}
},
"minimum-stability": "beta"
}
14 changes: 14 additions & 0 deletions demo/assets.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

/** @var \DebugBar\DebugBar $debugbar */
/** @var \DebugBar\JavascriptRenderer $debugbarRenderer */

//Disable session caching
session_cache_limiter('');

include 'bootstrap.php';

$openHandler = new DebugBar\AssetHandler($debugbar);
$openHandler->handle($_GET);
28 changes: 15 additions & 13 deletions demo/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

$debugbar = new StandardDebugBar();
$debugbarRenderer = $debugbar->getJavascriptRenderer()
->setBaseUrl('../src/DebugBar/Resources')
->setAssetHandlerUrl('assets.php')
->setAjaxHandlerEnableTab(true)
->setHideEmptyTabs(true)
->setEnableJqueryNoConflict(false)
->setTheme($_GET['theme'] ?? 'auto');


//
// create a writable profiles folder in the demo directory to uncomment the following lines
//
Expand All @@ -27,24 +27,26 @@ function render_demo_page(?Closure $callback = null)
global $debugbarRenderer;
?>
<html>
<head>
<?php echo $debugbarRenderer->renderHead() ?>
<script type="text/javascript">
$(function() {
$('.ajax').click(function() {
$.get(this.href, function(data) {
$('#ajax-result').html(data);
});
return false;
<script type="text/javascript" nonce="demo">
document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('.ajax').forEach(function(el) {
el.addEventListener('click', function(event) {
event.preventDefault();
fetch(this.href)
.then(response => response.text())
.then(data => {
document.getElementById('ajax-result').innerHTML = data;
});
});
});
</script>
</head>
});
</script>
<body>
<h1>DebugBar Demo</h1>
<p>DebugBar at the bottom of the page</p>
<?php if ($callback) $callback(); ?>
<?php
echo $debugbarRenderer->renderHead();
echo $debugbarRenderer->render();
?>
</body>
Expand Down
16 changes: 8 additions & 8 deletions src/DoctrineCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function setDebugStack(DebugBarSQLMiddleware $debugStack): void
*
* @param bool $enabled
*/
public function setDurationBackground($enabled)
public function setDurationBackground(bool $enabled): void
{
$this->durationBackground = $enabled;
}
Expand All @@ -67,15 +67,15 @@ public function setDurationBackground($enabled)
*
* @param int|float $threshold miliseconds value
*/
public function setSlowThreshold($threshold)
public function setSlowThreshold(int|float $threshold): void
{
$this->slowThreshold = $threshold / 1000;
}

/**
* @return array
*/
public function collect()
public function collect(): array
{
$queries = array();
$nb_statements = 0;
Expand All @@ -85,7 +85,7 @@ public function collect()
'sql' => $q['sql'],
'params' => (object) $this->getParameters($q['params'] ?? []),
'duration' => $q['executionMS'],
'duration_str' => $this->formatDuration($q['executionMS']),
'duration_str' => $this->getDataFormatter()->formatDuration($q['executionMS']),
'type' => $q['type'] ?? null,
'slow' => $this->slowThreshold && $this->slowThreshold <= $q['executionMS'],
);
Expand Down Expand Up @@ -114,7 +114,7 @@ public function collect()
'count' => count($queries),
'nb_statements' => $nb_statements,
'accumulated_duration' => $totalExecTime,
'accumulated_duration_str' => $this->formatDuration($totalExecTime),
'accumulated_duration_str' => $this->getDataFormatter()->formatDuration($totalExecTime),
'statements' => $queries
);
}
Expand Down Expand Up @@ -145,15 +145,15 @@ public function getParameters($params) : array
/**
* @return string
*/
public function getName()
public function getName(): string
{
return 'doctrine';
}

/**
* @return array
*/
public function getWidgets()
public function getWidgets(): array
{
return array(
"database" => array(
Expand All @@ -172,7 +172,7 @@ public function getWidgets()
/**
* @return array
*/
public function getAssets()
public function getAssets(): array
{
return array(
'css' => 'widgets/sqlqueries/widget.css',
Expand Down