Skip to content

Commit

Permalink
Fix stan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Sep 8, 2024
1 parent 584c713 commit 6269278
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
php-version: '8.3'
extensions: mbstring, intl
coverage: none
tools: vimeo/psalm:5, phpstan:1.11, cs2pr
tools: vimeo/psalm:5, phpstan:1.12, cs2pr

- name: Composer Install
run: composer require --dev cakephp/cakephp-codesniffer:^5.0
Expand Down
11 changes: 7 additions & 4 deletions src/View/Helper/CrudViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,18 @@ public function formatDateTime(string $field, mixed $value, array $options): str
}

if ($value instanceof Date) {
return $value->i18nFormat($options['format'] ?? $this->getConfig('dateFormat'));
return (string)$value->i18nFormat($options['format'] ?? $this->getConfig('dateFormat'));
}

if ($value instanceof Time) {
return $value->i18nFormat($options['format'] ?? $this->getConfig('timeFormat'));
return (string)$value->i18nFormat($options['format'] ?? $this->getConfig('timeFormat'));
}

if ($value instanceof ChronosDate || $value instanceof ChronosTime) {
return (string)$value;
}

return $this->Time->i18nFormat($value, $options['format'] ?? $this->getConfig('dateTimeFormat'), '')
return (string)$this->Time->i18nFormat($value, $options['format'] ?? $this->getConfig('dateTimeFormat'), '')
?: $this->Html->badge(__d('crud', 'N/A'), ['class' => 'info']);
}

Expand Down Expand Up @@ -389,9 +389,12 @@ public function createRelationLink(string $alias, array $relation, array $option
*/
public function createViewLink(string $title, array $options = []): string
{
$entity = $this->getContext()->entity();
assert($entity instanceof EntityInterface);

return $this->Html->link(
$title,
['action' => 'view', $this->getContext()->entity()->get($this->getViewVar('primaryKey'))],
['action' => 'view', $entity->get($this->getViewVar('primaryKey'))],
$options
);
}
Expand Down

0 comments on commit 6269278

Please sign in to comment.