Skip to content
Snippets Groups Projects

Issue #3507935 by tr: Add typing to VotingApiWidgets plugins and manager

Files
6
<?php
declare(strict_types=1);
namespace Drupal\votingapi_widgets\Plugin\VotingApiWidget;
use Drupal\Core\StringTranslation\StringTranslationTrait;
@@ -27,7 +29,7 @@ class FiveStarWidget extends VotingApiWidgetBase {
/**
* Vote form.
*/
public function buildForm($entity_type, $entity_bundle, $entity_id, $vote_type, $field_name, $settings) {
public function buildForm(string $entity_type, string $entity_bundle, string|int $entity_id, string $vote_type, string $field_name, array $settings): array {
$form = $this->getForm($entity_type, $entity_bundle, $entity_id, $vote_type, $field_name, $settings);
$build = [
'rating' => [
@@ -68,7 +70,7 @@ class FiveStarWidget extends VotingApiWidgetBase {
/**
* {@inheritdoc}
*/
public function getStyles() {
public function getStyles(): array {
return [
'default' => $this->t('Default'),
'bars-horizontal' => $this->t('Bars horizontal'),
Loading