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 src/DebugSql.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public static function sqld(
*
* @return bool
*/
protected static function isCli()
protected static function isCli(): bool
{
return PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg';
}
Expand Down
20 changes: 10 additions & 10 deletions src/Model/Behavior/TimedBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
namespace DebugKit\Model\Behavior;

use Cake\Event\Event;
use Cake\Event\EventInterface;
use Cake\ORM\Behavior;
use Cake\ORM\Query;
use Cake\ORM\Query\SelectQuery;
use DebugKit\DebugTimer;

/**
Expand All @@ -28,11 +28,11 @@ class TimedBehavior extends Behavior
/**
* beforeFind, starts a timer for a find operation.
*
* @param \Cake\Event\Event $event The beforeFind event
* @param \Cake\ORM\Query $query Query
* @return \Cake\ORM\Query
* @param \Cake\Event\EventInterface $event The beforeFind event
* @param \Cake\ORM\Query\SelectQuery $query SelectQuery
* @return \Cake\ORM\Query\SelectQuery
*/
public function beforeFind(Event $event, Query $query): Query
public function beforeFind(EventInterface $event, SelectQuery $query): SelectQuery
{
$alias = $event->getSubject()->getAlias();
DebugTimer::start($alias . '_find', $alias . '->find()');
Expand All @@ -47,10 +47,10 @@ public function beforeFind(Event $event, Query $query): Query
/**
* beforeSave, starts a time before a save is initiated.
*
* @param \Cake\Event\Event $event The beforeSave event
* @param \Cake\Event\EventInterface $event The beforeSave event
* @return void
*/
public function beforeSave(Event $event): void
public function beforeSave(EventInterface $event): void
{
$alias = $event->getSubject()->getAlias();
DebugTimer::start($alias . '_save', $alias . '->save()');
Expand All @@ -59,10 +59,10 @@ public function beforeSave(Event $event): void
/**
* afterSave, stop the timer started from a save.
*
* @param \Cake\Event\Event $event The afterSave event
* @param \Cake\Event\EventInterface $event The afterSave event
* @return void
*/
public function afterSave(Event $event): void
public function afterSave(EventInterface $event): void
{
$alias = $event->getSubject()->getAlias();
DebugTimer::stop($alias . '_save');
Expand Down
8 changes: 4 additions & 4 deletions src/Model/Table/PanelsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
namespace DebugKit\Model\Table;

use Cake\ORM\Query;
use Cake\ORM\Query\SelectQuery;
use Cake\ORM\Table;
use RuntimeException;

Expand Down Expand Up @@ -50,12 +50,12 @@ public function initialize(array $config): void
/**
* Find panels by requestid
*
* @param \Cake\ORM\Query $query The query
* @param \Cake\ORM\Query\SelectQuery $query The query
* @param array $options The options to use.
* @return \Cake\ORM\Query The query.
* @return \Cake\ORM\Query\SelectQuery The query.
* @throws \RuntimeException
*/
public function findByRequest(Query $query, array $options): Query
public function findByRequest(SelectQuery $query, array $options): SelectQuery
{
if (empty($options['requestId'])) {
throw new RuntimeException(__d('debug_kit', 'Missing request id in {0}.', 'findByRequest()'));
Expand Down
14 changes: 6 additions & 8 deletions src/Model/Table/RequestsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Cake\Core\Configure;
use Cake\Database\Driver\Sqlite;
use Cake\Log\Log;
use Cake\ORM\Query;
use Cake\ORM\Query\SelectQuery;
use Cake\ORM\Table;
use PDOException;

Expand Down Expand Up @@ -69,11 +69,11 @@ public static function defaultConnectionName(): string
/**
* Finder method to get recent requests as a simple array
*
* @param \Cake\ORM\Query $query The query
* @param \Cake\ORM\Query\SelectQuery $query The query
* @param array $options The options
* @return \Cake\ORM\Query The query.
* @return \Cake\ORM\Query\SelectQuery The query.
*/
public function findRecent(Query $query, array $options): Query
public function findRecent(SelectQuery $query, array $options): SelectQuery
{
return $query->order(['Requests.requested_at' => 'DESC'])
->limit(10);
Expand Down Expand Up @@ -118,14 +118,12 @@ public function gc(): void
return;
}

$query = $this->Panels->query()
->delete()
$query = $this->Panels->deleteQuery()
->where(['request_id NOT IN' => $noPurge]);
$statement = $query->execute();
$statement->closeCursor();

$query = $this->query()
->delete()
$query = $this->deleteQuery()
->where(['id NOT IN' => $noPurge]);

$statement = $query->execute();
Expand Down
5 changes: 3 additions & 2 deletions src/Panel/PanelRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

/**
* Registry object for panels.
*
* @extends \Cake\Core\ObjectRegistry<\DebugKit\DebugPanel>
*/
class PanelRegistry extends ObjectRegistry implements EventDispatcherInterface
{
Expand Down Expand Up @@ -73,11 +75,10 @@ protected function _throwMissingClassError(string $class, ?string $plugin): void
*
* Part of the template method for Cake\Utility\ObjectRegistry::load()
*
* @param string $class The classname to create.
* @param \DebugKit\DebugPanel|class-string<\DebugKit\DebugPanel> $class The classname to create.
* @param string $alias The alias of the panel.
* @param array $config An array of config to use for the panel.
* @return \DebugKit\DebugPanel The constructed panel class.
* @psalm-param class-string<\DebugKit\DebugPanel> $class
*/
protected function _create(object|string $class, string $alias, array $config): DebugPanel
{
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Panel/VariablesPanelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function testShutdown()
$result = $requests->find()->all();
$unbufferedQuery = $requests->find('all');
$unbufferedQuery->toArray(); //toArray call would normally happen somewhere in View, usually implicitly
$update = $requests->query()->update();
$update = $requests->updateQuery();
$debugInfoException = $requests->query()->contain('NonExistentAssociation');

$unserializable = new stdClass();
Expand Down
2 changes: 1 addition & 1 deletion tests/test_app/Stub/DebugSqlStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DebugSqlStub extends DebugSql
{
public static $isCli = true;

protected static function isCli()
protected static function isCli(): bool
{
return static::$isCli;
}
Expand Down