Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Forwardport] Fix type hint of @message declaration as the "setWidgetParameters" method allows arrays too #18545

Merged
merged 1 commit into from
Oct 16, 2018

Conversation

mage2pratik
Copy link
Contributor

@mage2pratik mage2pratik commented Oct 12, 2018

Original Pull Request

#18155

Description

The magic setWidgetParameters method of the \Magento\Widget\Model\Widget\Instance class accepts not only strings as its parameter, but also arrays. If it's an array, it gets transformed to a string automatically before saving. This PR adds the corresponding type hint.

Fixed Issues (if relevant)

The IDE shows a warning if you use an array as a parameter:

grafik

This is especially annoying as the getWidgetParameters returns an array. It should be possible to use the same data type for getter and setter of one field.

Manual testing scenarios

Insert the following code into your IDE:

 /** @var WidgetInstance $widget */
$widgetParameters = $widget->getWidgetParameters();
$widget->setWidgetParameters($widgetParameters);

It shouldn't show a warning as displayed in the screenshot above.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

Sorry, something went wrong.

@magento-engcom-team
Copy link
Contributor

Hi @mage2pratik. Thank you for your contribution.
We will aim to release these changes as part of 2.3.1.
Please check the release notes for final confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants