Page MenuHomeDevCentral

Add missing parameters return type of each function
Needs ReviewPublic

Authored by DorianWinty on May 27 2022, 20:54.

Details

Reviewers
dereckson
Summary

Some return type of function are missing.

Diff Detail

Repository
rNOTIF Notifications center
Lint
Lint Warnings
SeverityLocationCodeMessage
Warningapp/Providers/RouteServiceProvider.php:24PHPCS.W.Generic.CodeAnalysis.UselessOverridingMethod.FoundGeneric.CodeAnalysis.UselessOverridingMethod.Found
Unit
Tests Passed
Branch
useRtnType

Event Timeline

app/Analyzers/DockerHub/BuildFailureEvent.php
22

When the only goal of @return is to give the type, we can remove them. The old phpdoc is now useless as we say the same thing directly in PHP code.

app/Analyzers/GitHub/Events/IssueCommentEvent.php
16

Here we can keep it because it gives extra info than just @return bool

app/Phabricator/PhabricatorStory.php
282

The documentation states @return string[], that's a hint we'll always return an array.

if $this->projects is null we call the attachProjects method. That method will assign a value [] at the first step, so we've an array to return.

app/Phabricator/ProjectsMap.php
68

According PHP documentation:

  1. class ArrayIterator implements SeekableIterator, ArrayAccess, Serializable, Countable
  2. interface SeekableIterator extends Iterator
  3. interface Iterator extends Traversable

So an instance of the class ArrayIterator is a Traversable.

By documenting only Traversable, we only allow code calling this method to use foreach, and we keep the right to implement our iterator as we want.

70

+ use Traversable;

276

We can express the idea of array of arrays like this (in doc, not in PHP code).