Skip to content

Conversation

@markconroy
Copy link
Member

Closes #253


Thanks to Big Blue Door for sponsoring my time to work on this.

Copy link
Member

@ekes ekes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only one that cause an error is processInbound processOutbound. Documentation says it always gets passed a string, but that's not enforced on the interface at the moment.

The rest are nit-picks, but then it's a standards patch :-)

*/
public function settingsForm(array $form, FormStateInterface $form_state) {
public function settingsForm(array $form, FormStateInterface $form_state): array {
$elements['title'] = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're being strict here we should also declare $elements as an array before accessing it as such.

$elements = [];

* {@inheritdoc}
*/
public function processInbound($path, Request $request) {
public function processInbound($path, Request $request): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $path is always a string on return, then it must be a string on being called ie: processInbound(string $path, Request $request). I guess that is the case? Is it? If not then it can't guarantee that it'll not return NULL or whatever passed in as $path.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21PathProcessor%21InboundPathProcessorInterface.php/function/InboundPathProcessorInterface%3A%3AprocessInbound/11.x

So at the moment we technically can't guarantee that a string is returned, unless we cast $path to a string. So maybe we should wait for the interface to be updated?

*/
public function processOutbound($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleableMetadata = NULL) {
public function processOutbound($path, &$options = [], ?Request $request = NULL, ?BubbleableMetadata $bubbleableMetadata = NULL): string {
assert($this->pathProcessor instanceof OutboundPathProcessorInterface);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as processInbound except even more so as we run substr on $path.

*
* @return array
* Array of item variables to render in Twig template.
* Array of status objects.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's returning an array from ::getStatusUpdates() and that is returning a render array, not objects.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix remaining strict types errors

3 participants