diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 54cd968..322e344 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -19,7 +19,7 @@ parameters: path: src/Listener/ViewListener.php - - message: '#^Parameter \#1 \$field of method CrudView\\Listener\\ViewListener\:\:_deriveFieldFromContext\(\) expects string, list\\|string\|null given\.$#' + message: '#^Parameter \#1 \$field of method CrudView\\Listener\\ViewListener\:\:_deriveFieldFromContext\(\) expects string, array\\|string\|null given\.$#' identifier: argument.type count: 1 path: src/Listener/ViewListener.php diff --git a/src/Breadcrumb/ActiveBreadcrumb.php b/src/Breadcrumb/ActiveBreadcrumb.php index 069c925..e245831 100644 --- a/src/Breadcrumb/ActiveBreadcrumb.php +++ b/src/Breadcrumb/ActiveBreadcrumb.php @@ -9,7 +9,6 @@ class ActiveBreadcrumb extends Breadcrumb /** * // phpcs:ignore * @inheritDoc - * @psalm-suppress MissingParamType */ public function __construct(string|array $title, string|array|null $url = null, array $options = []) { diff --git a/src/Listener/ViewListener.php b/src/Listener/ViewListener.php index d7b8ef1..0db9d12 100644 --- a/src/Listener/ViewListener.php +++ b/src/Listener/ViewListener.php @@ -42,7 +42,7 @@ class ViewListener extends BaseListener * * @param \Cake\Event\EventInterface $event Event. * @return void - * @psalm-param \Cake\Event\EventInterface<\Crud\Event\Subject> $event + * @phpstan-param \Cake\Event\EventInterface<\Crud\Event\Subject> $event */ public function beforeFind(EventInterface $event): void { @@ -63,7 +63,7 @@ public function beforeFind(EventInterface $event): void * * @param \Cake\Event\EventInterface $event Event. * @return void - * @psalm-param \Cake\Event\EventInterface<\Crud\Event\Subject> $event + * @phpstan-param \Cake\Event\EventInterface<\Crud\Event\Subject> $event */ public function beforePaginate(EventInterface $event): void { @@ -84,7 +84,7 @@ public function beforePaginate(EventInterface $event): void * * @param \Cake\Event\EventInterface $event Event. * @return void - * @psalm-param \Cake\Event\EventInterface<\Crud\Event\Subject> $event + * @phpstan-param \Cake\Event\EventInterface<\Crud\Event\Subject> $event */ public function beforeRender(EventInterface $event): void { @@ -96,7 +96,6 @@ public function beforeRender(EventInterface $event): void $this->_entity = $event->getSubject()->entity; } - /** @psalm-suppress RedundantPropertyInitializationCheck */ if (!isset($this->associations)) { $this->associations = $this->_associations(array_keys($this->_getRelatedModels())); } @@ -134,12 +133,11 @@ public function beforeRender(EventInterface $event): void * * @param \Cake\Event\EventInterface $event Event. * @return void - * @psalm-param \Cake\Event\EventInterface<\Crud\Event\Subject> $event + * @phpstan-param \Cake\Event\EventInterface<\Crud\Event\Subject> $event */ public function setFlash(EventInterface $event): void { unset($event->getSubject()->params['class']); - /** @psalm-suppress UndefinedPropertyAssignment */ $event->getSubject()->element = ltrim($event->getSubject()->type); } @@ -181,11 +179,11 @@ protected function _getPageTitle(): string $displayFieldValue === null || $this->_model()->getDisplayField() === $this->_model()->getPrimaryKey() ) { - /** @psalm-var string $primaryKeyValue */ + /** @phpstan-var string $primaryKeyValue */ return sprintf('%s %s #%s', $actionName, $controllerName, $primaryKeyValue); } - /** @psalm-var string $primaryKeyValue */ + /** @phpstan-var string $primaryKeyValue */ return sprintf('%s %s #%s: %s', $actionName, $controllerName, $primaryKeyValue, $displayFieldValue); } @@ -410,9 +408,7 @@ protected function _getControllerActions(): array } foreach ($actionBlacklist as $actionName) { - /** @psalm-suppress EmptyArrayAccess */ unset($table[$actionName]); - /** @psalm-suppress EmptyArrayAccess */ unset($entity[$actionName]); } @@ -440,7 +436,6 @@ protected function _getControllerActionConfiguration(string $actionName, array $ if ($this->_crud()->isActionMapped($realAction)) { $action = $this->_action($realAction); $class = get_class($action); - /** @psalm-suppress PossiblyFalseOperand */ $class = substr($class, strrpos($class, '\\') + 1); if ($class === 'DeleteAction') { @@ -591,7 +586,6 @@ protected function _primaryKeyValue(): array|string|int|null */ protected function _displayFieldValue(): string|int|null { - /** @psalm-suppress PossiblyInvalidArgument */ return $this->_deriveFieldFromContext($this->_model()->getDisplayField()); } diff --git a/src/Listener/ViewSearchListener.php b/src/Listener/ViewSearchListener.php index 51c300c..09a1bca 100644 --- a/src/Listener/ViewSearchListener.php +++ b/src/Listener/ViewSearchListener.php @@ -144,7 +144,6 @@ public function fields(): array $input['class'] = 'autocomplete'; } - /** @psalm-suppress PossiblyUndefinedArrayOffset */ if ( !empty($input['class']) && strpos($input['class'], 'autocomplete') !== false @@ -156,7 +155,6 @@ public function fields(): array $input['options'][$input['value']] = $input['value']; } - /** @psalm-suppress PossiblyInvalidOperand */ $input += [ 'data-input-type' => 'text', 'data-tags' => 'true', diff --git a/src/View/Cell/TablesListCell.php b/src/View/Cell/TablesListCell.php index 46269aa..3bc4882 100644 --- a/src/View/Cell/TablesListCell.php +++ b/src/View/Cell/TablesListCell.php @@ -25,7 +25,6 @@ public function display(?array $tables = null, ?array $blacklist = null): void $tables = $schema->listTables(); sort($tables); - /** @psalm-suppress RiskyTruthyFalsyComparison */ if (!empty($blacklist)) { $tables = array_diff($tables, $blacklist); } diff --git a/src/View/Helper/CrudViewHelper.php b/src/View/Helper/CrudViewHelper.php index 119fab2..2578886 100644 --- a/src/View/Helper/CrudViewHelper.php +++ b/src/View/Helper/CrudViewHelper.php @@ -155,7 +155,6 @@ public function introspect(string $field, mixed $value, array $options = []): ar $fieldFormatters = $this->getConfig('fieldFormatters'); if (isset($fieldFormatters[$type])) { - /** @psalm-suppress PossiblyNullArrayOffset */ if (is_callable($fieldFormatters[$type])) { return $fieldFormatters[$type]( $field, @@ -166,7 +165,6 @@ public function introspect(string $field, mixed $value, array $options = []): ar ); } - /** @psalm-suppress PossiblyNullArrayOffset */ return $this->{$fieldFormatters[$type]}($field, $value, $options); } diff --git a/src/View/Widget/DateTimeWidget.php b/src/View/Widget/DateTimeWidget.php index 9d2005a..14b65df 100644 --- a/src/View/Widget/DateTimeWidget.php +++ b/src/View/Widget/DateTimeWidget.php @@ -111,7 +111,6 @@ public function render(array $data, ContextInterface $context): string $clearIcon = $this->clearIcon; $toggleIcon = $this->calendarIcon; - /** @psalm-suppress PossiblyUndefinedArrayOffset */ if (isset($datetimePicker['iconClass'])) { $toggleIcon = $datetimePicker['iconClass']; unset($datetimePicker['iconClass']); @@ -155,7 +154,6 @@ public function render(array $data, ContextInterface $context): string return $input; } - /** @psalm-suppress PossiblyInvalidArrayOffset */ return $this->_templates->format('datetimePicker', [ 'input' => $input, 'toggleIcon' => $toggleIcon, diff --git a/templates/element/action-groups.php b/templates/element/action-groups.php index 443208a..1cd3101 100644 --- a/templates/element/action-groups.php +++ b/templates/element/action-groups.php @@ -15,6 +15,17 @@ ?> $group) : ?> + element('action-button', ['config' => $links[$subaction]]); + continue; + } + ?>