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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
],
"stan-baseline": "phpstan.phar --generate-baseline",
"psalm-baseline": "psalm.phar --set-baseline=psalm-baseline.xml",
"stan-setup": "cp composer.json composer.backup && composer require --dev symfony/polyfill-php81 phpstan/phpstan:~1.7.0 psalm/phar:~4.23.0 && mv composer.backup composer.json",
"stan-setup": "cp composer.json composer.backup && composer require --dev symfony/polyfill-php81 phpstan/phpstan:~1.9.0 psalm/phar:~5.1.0 && mv composer.backup composer.json",
"test": "phpunit"
},
"minimum-stability": "dev",
Expand Down
10 changes: 10 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@ parameters:
message: "#^Call to an undefined method Cake\\\\ORM\\\\Locator\\\\LocatorInterface\\:\\:genericInstances\\(\\)\\.$#"
count: 1
path: src/Panel/SqlLogPanel.php

-
message: "#^Dead catch \\- Cake\\\\Core\\\\Exception\\\\CakeException is never thrown in the try block\\.$#"
count: 1
path: src/ToolbarService.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: src/ToolbarService.php
2 changes: 1 addition & 1 deletion src/DebugSql.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static function sql(
}

/** @var array $trace */
$trace = Debugger::trace(['start' => 1, 'depth' => $stackDepth + 2, 'format' => 'array']);
$trace = Debugger::trace(['start' => 0, 'depth' => $stackDepth + 1, 'format' => 'array']);
$file = isset($trace[$stackDepth]) ? $trace[$stackDepth]['file'] : 'n/a';
$line = isset($trace[$stackDepth]) ? $trace[$stackDepth]['line'] : 0;
$lineInfo = '';
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Table/PanelsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function findByRequest(SelectQuery $query, array $options): SelectQuery
}

return $query->where(['Panels.request_id' => $options['requestId']])
->order(['Panels.title' => 'ASC']);
->orderBy(['Panels.title' => 'ASC']);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Table/RequestsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function defaultConnectionName(): string
*/
public function findRecent(SelectQuery $query, array $options): SelectQuery
{
return $query->order(['Requests.requested_at' => 'DESC'])
return $query->orderBy(['Requests.requested_at' => 'DESC'])
->limit(10);
}

Expand Down Expand Up @@ -108,7 +108,7 @@ public function gc(): void
$noPurge = $this->find()
->select(['id'])
->enableHydration(false)
->order(['requested_at' => 'desc'])
->orderBy(['requested_at' => 'desc'])
->limit(Configure::read('DebugKit.requestCount') ?: 20)
->all()
->extract('id')
Expand Down
4 changes: 2 additions & 2 deletions src/ToolbarService.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace DebugKit;

use Cake\Core\Configure;
use Cake\Core\Exception\CakeException;
use Cake\Core\InstanceConfigTrait;
use Cake\Core\Plugin as CorePlugin;
use Cake\Datasource\Exception\MissingDatasourceConfigException;
Expand All @@ -25,7 +26,6 @@
use DebugKit\Model\Entity\Request;
use DebugKit\Panel\PanelRegistry;
use Exception;
use PDOException;
use Psr\Http\Message\ResponseInterface;

/**
Expand Down Expand Up @@ -302,7 +302,7 @@ public function saveData(ServerRequest $request, ResponseInterface $response): R

try {
return $requests->save($row);
} catch (PDOException $e) {
} catch (CakeException $e) {
Log::warning('Unable to save request. This is probably due to concurrent requests.');
Log::warning($e->getMessage());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Middleware/DebugKitMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function testInvokeSaveData()

$requests = $this->getTableLocator()->get('DebugKit.Requests');
$result = $requests->find()
->order(['Requests.requested_at' => 'DESC'])
->orderBy(['Requests.requested_at' => 'DESC'])
->contain('Panels')
->first();

Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/View/Helper/ToolbarHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function tearDown(): void

public function testDumpNodesSorted()
{
$path = '//*[@class="cake-dbg-array-item"]/*[@class="cake-dbg-string"]';
$path = '//*[@class="cake-debug-array-item"]/*[@class="cake-debug-string"]';
$data = ['z' => 1, 'a' => 99, 'm' => 123];
$nodes = array_map(function ($v) {
return Debugger::exportVarAsNodes($v);
Expand Down Expand Up @@ -104,7 +104,7 @@ public function testDumpCoerceHtml()

public function testDumpSorted()
{
$path = '//*[@class="cake-dbg-array-item"]/*[@class="cake-dbg-string"]';
$path = '//*[@class="cake-debug-array-item"]/*[@class="cake-debug-string"]';
$data = ['z' => 1, 'a' => 99, 'm' => 123];
$result = $this->Toolbar->dump($data);
$xml = new SimpleXmlElement($result);
Expand Down