Add type declaration to untyped scalar params on interfaces
2 unresolved threads
Closes #3436327
Merge request reports
Activity
123 */ 124 private function refactorParamTypes($functionLike, PhpDocInfo $phpDocInfo) : void 125 { 126 foreach ($functionLike->params as $param) { 127 if ($param->type instanceof Node) { 128 continue; 129 } 130 $paramName = (string) $this->getName($param->var); 131 $paramTagValue = $phpDocInfo->getParamTagValueByName($paramName); 132 if (!$paramTagValue instanceof ParamTagValueNode) { 133 continue; 134 } 135 $paramType = $phpDocInfo->getParamType($paramName); 136 if (!$paramType->isScalar()->yes()) { 137 continue; 138 } - Comment on lines +136 to +138
changed this line in version 2 of the diff
added 2 commits
added 2 commits
28 28 * 29 29 * @return $this 30 30 */ 31 public function setLabel($label); 31 public function setLabel(string $label); - Comment on lines -31 to +31
I think this needs to be allow
TranslatableMarkup
. For example in\Drupal\layout_builder\Plugin\Derivative\FieldBlockDeriver::getDerivativeDefinitions
we get labels from\Drupal\Core\Entity\EntityTypeRepository::getEntityTypeLabels
which ultimately gets labels from\Drupal\Core\Entity\EntityTypeInterface::getLabel
which returnsstring|\Drupal\Core\StringTranslation\TranslatableMarkup
. We then pass those labels to\Drupal\Core\Plugin\Context\ContextDefinition::setLabel
which implements this method.There are probably many other instances of this that we won't know until the concrete classes declare the same parameter types.
Please register or sign in to reply