Skip to content

Commit

Permalink
Fix query logger (#712)
Browse files Browse the repository at this point in the history
Removed string cast when logging LoggedQuery

Fixed errors reported by static analyzers
  • Loading branch information
JustinRuiter committed Apr 8, 2024
1 parent 440be3b commit 5ebd299
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Controller/Component/CrudComponent.php
Expand Up @@ -233,7 +233,7 @@ public function execute(?string $controllerAction = null, array $args = []): Res
{
$this->_loadListeners();

$this->_action = $controllerAction ?: $this->_action;
$this->_action = $controllerAction ?? $this->_action;

$action = $this->_action;
if (empty($args)) {
Expand Down Expand Up @@ -275,7 +275,7 @@ public function execute(?string $controllerAction = null, array $args = []): Res
*/
public function action(?string $name = null): BaseAction
{
if (empty($name)) {
if ($name === null) {
$name = $this->_action;
}

Expand Down Expand Up @@ -425,7 +425,7 @@ public function mapAction(string $action, array|string $config = [], bool $enabl
*/
public function isActionMapped(?string $action = null): bool
{
if (empty($action)) {
if ($action === null) {
$action = $this->_action;
}

Expand All @@ -448,7 +448,7 @@ public function isActionMapped(?string $action = null): bool
public function on(array|string $events, callable $callback, array $options = []): void
{
foreach ((array)$events as $event) {
if (!strpos($event, '.')) {
if (!str_contains($event, '.')) {
$event = $this->_config['eventPrefix'] . '.' . $event;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Log/QueryLogger.php
Expand Up @@ -30,7 +30,7 @@ public function getLogs(): array
*/
public function log($level, string|Stringable $message, array $context = []): void
{
$this->_logs[] = (string)$context['query'];
$this->_logs[] = $context['query'];

parent::log($level, $message, $context);
}
Expand Down

0 comments on commit 5ebd299

Please sign in to comment.