diff --git a/app/Actions/ActionsReport.php b/app/Actions/ActionsReport.php --- a/app/Actions/ActionsReport.php +++ b/app/Actions/ActionsReport.php @@ -64,8 +64,6 @@ /** * Determines if one of the action has failed. - * - * @return bool */ public function containsError () : bool { foreach ($this->actions as $action) { diff --git a/app/Analyzers/BasePayloadAnalyzer.php b/app/Analyzers/BasePayloadAnalyzer.php --- a/app/Analyzers/BasePayloadAnalyzer.php +++ b/app/Analyzers/BasePayloadAnalyzer.php @@ -67,8 +67,6 @@ /** * Gets the full path to the configuration file. - * - * @return string */ public function getConfigurationFileName () : string { $dir = Config::get( @@ -87,9 +85,7 @@ } /** - * Gets full qualified class name for configuration. - * - * @return string + * Gets full qualified class name for configuration */ private function getCandidateConfigurationClassName() : string { return 'Nasqueron\Notifications\Analyzers\\' . static::SERVICE_NAME //ns @@ -146,8 +142,6 @@ /** * Determines if the event isn't related to a specific item, * but to the general service. - * - * @return bool */ public function isAdministrativeEvent () : bool { return false; diff --git a/app/Analyzers/DockerHub/BaseEvent.php b/app/Analyzers/DockerHub/BaseEvent.php --- a/app/Analyzers/DockerHub/BaseEvent.php +++ b/app/Analyzers/DockerHub/BaseEvent.php @@ -27,22 +27,18 @@ * * This method allows analyzer to edit the payload. */ - public function getPayload () { + public function getPayload () : \stdClass { return $this->payload; } /** * Gets notification text for this event. - * - * @return string */ - abstract public function getText(); + abstract public function getText() : string; /** * Gets notification link related to this event. - * - * @return string */ - abstract public function getLink(); + abstract public function getLink() : string; } diff --git a/app/Analyzers/DockerHub/BuildFailureEvent.php b/app/Analyzers/DockerHub/BuildFailureEvent.php --- a/app/Analyzers/DockerHub/BuildFailureEvent.php +++ b/app/Analyzers/DockerHub/BuildFailureEvent.php @@ -18,17 +18,12 @@ /** * Gets a MailGun message. - * - * @return \stdClass */ - private function getMailGunPayload () { + private function getMailGunPayload () : \stdClass { return Mailgun::fetchMessageFromPayload($this->payload); } - /** - * @return string - */ - private function getMailBody () { + private function getMailBody () : string { $bodyProperty = 'body-plain'; return $this->payload->$bodyProperty; } @@ -39,17 +34,15 @@ * @param $string Regular expression * @return string */ - private function extractFromBody ($regex) { + private function extractFromBody ($regex) : string { preg_match($regex, $this->getMailBody(), $matches); return $matches[1]; } /** * Gets text from payload. - * - * @return string */ - public function getText() { + public function getText() : string { $repo = $this->extractFromBody("@\"(.*?\/.*?)\"@"); return "Image build by Docker Hub registry failure for $repo"; @@ -57,10 +50,8 @@ /** * Gets link from payload. - * - * @return string */ - public function getLink() { + public function getLink() : string { return $this->extractFromBody("@(https\:\/\/hub.docker.com\/r.*)@"); } diff --git a/app/Analyzers/DockerHub/PushEvent.php b/app/Analyzers/DockerHub/PushEvent.php --- a/app/Analyzers/DockerHub/PushEvent.php +++ b/app/Analyzers/DockerHub/PushEvent.php @@ -6,10 +6,8 @@ /** * Gets text from payload. - * - * @return string */ - public function getText() { + public function getText() : string { $repo = $this->payload->repository->repo_name; $who = $this->payload->push_data->pusher; @@ -18,10 +16,8 @@ /** * Gets link from payload. - * - * @return string */ - public function getLink() { + public function getLink() : string { return $this->payload->repository->repo_url; } diff --git a/app/Analyzers/GitHub/Events/CommitCommentEvent.php b/app/Analyzers/GitHub/Events/CommitCommentEvent.php --- a/app/Analyzers/GitHub/Events/CommitCommentEvent.php +++ b/app/Analyzers/GitHub/Events/CommitCommentEvent.php @@ -11,8 +11,6 @@ /** * Gets description for the payload - * - * @return string */ public function getDescription () : string { $comment = $this->payload->comment; @@ -29,8 +27,6 @@ /** * Gets link for the payload - * - * @return string */ public function getLink () : string { return $this->payload->comment->html_url; diff --git a/app/Analyzers/GitHub/Events/CreateEvent.php b/app/Analyzers/GitHub/Events/CreateEvent.php --- a/app/Analyzers/GitHub/Events/CreateEvent.php +++ b/app/Analyzers/GitHub/Events/CreateEvent.php @@ -19,8 +19,6 @@ /** * Gets description for the payload - * - * @return string */ public function getDescription () : string { $repository = $this->payload->repository->full_name; @@ -62,8 +60,6 @@ /** * Gets link for the payload - * - * @return string */ public function getLink () : string { $type = $this->payload->ref_type; diff --git a/app/Analyzers/GitHub/Events/DefaultBranchEvent.php b/app/Analyzers/GitHub/Events/DefaultBranchEvent.php --- a/app/Analyzers/GitHub/Events/DefaultBranchEvent.php +++ b/app/Analyzers/GitHub/Events/DefaultBranchEvent.php @@ -11,8 +11,6 @@ /** * Gets description for the payload - * - * @return string */ public function getDescription () : string { $repository = $this->payload->repository->full_name; @@ -31,8 +29,6 @@ /** * Gets link for the payload - * - * @return string */ public function getLink () : string { return $this->payload->repository->html_url; diff --git a/app/Analyzers/GitHub/Events/DeleteEvent.php b/app/Analyzers/GitHub/Events/DeleteEvent.php --- a/app/Analyzers/GitHub/Events/DeleteEvent.php +++ b/app/Analyzers/GitHub/Events/DeleteEvent.php @@ -16,8 +16,6 @@ /** * Gets description for the payload - * - * @return string */ public function getDescription () : string { $repository = $this->payload->repository->full_name; @@ -46,11 +44,9 @@ /** * Gets link segments for the type - * - * @return Array * @SuppressWarnings(PHPMD.UnusedPrivateMethod) */ - private function getLinkRefSegments () { + private function getLinkRefSegments () : array { return [ 'tag' => '/tags', 'branch' => '/branches', @@ -59,8 +55,6 @@ /** * Gets link for the payload - * - * @return string */ public function getLink () : string { $type = $this->payload->ref_type; diff --git a/app/Analyzers/GitHub/Events/Event.php b/app/Analyzers/GitHub/Events/Event.php --- a/app/Analyzers/GitHub/Events/Event.php +++ b/app/Analyzers/GitHub/Events/Event.php @@ -33,7 +33,7 @@ * @param string $eventName The event name (e.g. commit_comment) * @return string The event class name (e.g. CommitCommentEvent) */ - public static function getClass (string $eventName) { + public static function getClass (string $eventName) : string { return __NAMESPACE__ . '\\' . self::toCamelCase($eventName) . 'Event'; } @@ -45,9 +45,8 @@ * Gets an instance of the event class, from the * * @param string $eventName The event name (e.g. commit_comment) - * @return Event */ - public static function forPayload (string $eventName, $payload) { + public static function forPayload (string $eventName, $payload) : Event { $class = self::getClass($eventName); if (!class_exists($class)) { throw new \InvalidArgumentException( @@ -72,7 +71,7 @@ string $text, int $strLen = 114, string $symbol = '…' - ) { + ) : string { $len = strlen($text); if ($len <= $strLen) { return $text; diff --git a/app/Analyzers/GitHub/Events/ForkEvent.php b/app/Analyzers/GitHub/Events/ForkEvent.php --- a/app/Analyzers/GitHub/Events/ForkEvent.php +++ b/app/Analyzers/GitHub/Events/ForkEvent.php @@ -13,8 +13,6 @@ /** * Gets description for the payload - * - * @return string */ public function getDescription () : string { return trans( @@ -28,8 +26,6 @@ /** * Gets link for the payload - * - * @return string */ public function getLink () : string { return $this->payload->forkee->html_url; diff --git a/app/Analyzers/GitHub/Events/IssueCommentEvent.php b/app/Analyzers/GitHub/Events/IssueCommentEvent.php --- a/app/Analyzers/GitHub/Events/IssueCommentEvent.php +++ b/app/Analyzers/GitHub/Events/IssueCommentEvent.php @@ -15,15 +15,13 @@ * @param string $action The action to check * @return bool true if the action is valid; otherwise, false */ - protected static function isValidAction (string $action) { + protected static function isValidAction (string $action) : bool { $actions = ['created', 'edited', 'deleted']; return in_array($action, $actions); } /** * Gets description for the payload. - * - * @return string */ public function getDescription () : string { $action = $this->payload->action; @@ -54,8 +52,6 @@ /** * Gets link for the payload. - * - * @return string */ public function getLink () : string { return $this->payload->comment->html_url; diff --git a/app/Analyzers/GitHub/Events/PingEvent.php b/app/Analyzers/GitHub/Events/PingEvent.php --- a/app/Analyzers/GitHub/Events/PingEvent.php +++ b/app/Analyzers/GitHub/Events/PingEvent.php @@ -11,8 +11,6 @@ /** * Gets description for the payload - * - * @return string */ public function getDescription () : string { return trans( @@ -26,8 +24,6 @@ /** * Gets link for the payload - * - * @return string */ public function getLink () : string { return ''; diff --git a/app/Analyzers/GitHub/Events/PullRequestEvent.php b/app/Analyzers/GitHub/Events/PullRequestEvent.php --- a/app/Analyzers/GitHub/Events/PullRequestEvent.php +++ b/app/Analyzers/GitHub/Events/PullRequestEvent.php @@ -15,7 +15,7 @@ * @param string $action The action to check * @return bool true if the action is valid; otherwise, false */ - protected static function isValidAction(string $action) { + protected static function isValidAction(string $action) : bool { $actions = [ 'assigned', 'unassigned', 'labeled', 'unlabeled', @@ -27,8 +27,6 @@ /** * Gets description for the payload. - * - * @return string */ public function getDescription () : string { $action = $this->payload->action; @@ -48,10 +46,8 @@ /** * Gets the parameters to pass to the localisation message - * - * @return array */ - private function getLocalisationParameters () { + private function getLocalisationParameters () : array { $parameters = [ 'author' => $this->payload->sender->login, 'number' => $this->payload->number, @@ -68,7 +64,7 @@ /** * @return string The last assignee username, or "" if there is no assignee. */ - private function getLastAssignee() { + private function getLastAssignee() : string { $assignees = $this->payload->pull_request->assignees; if (count($assignees) === 0) { @@ -81,8 +77,6 @@ /** * Gets link for the payload. - * - * @return string */ public function getLink () : string { return $this->payload->pull_request->html_url; diff --git a/app/Analyzers/GitHub/Events/PushEvent.php b/app/Analyzers/GitHub/Events/PushEvent.php --- a/app/Analyzers/GitHub/Events/PushEvent.php +++ b/app/Analyzers/GitHub/Events/PushEvent.php @@ -18,7 +18,7 @@ * @param int $count The count of commits * @return string The l10n message key for description */ - private static function getDescriptionMessageKey (int $count) { + private static function getDescriptionMessageKey (int $count) : string { $key = 'GitHub.EventsDescriptions.PushEvent'; if ($count === 0) { @@ -30,8 +30,6 @@ /** * Gets description for the payload - * - * @return string */ public function getDescription () : string { $n = count($this->payload->commits); @@ -52,8 +50,6 @@ /** * Gets link for the payload - * - * @return string */ public function getLink () : string { $n = count($this->payload->commits); diff --git a/app/Analyzers/GitHub/Events/RepositoryEvent.php b/app/Analyzers/GitHub/Events/RepositoryEvent.php --- a/app/Analyzers/GitHub/Events/RepositoryEvent.php +++ b/app/Analyzers/GitHub/Events/RepositoryEvent.php @@ -15,15 +15,13 @@ * @param string $action The action to check * @return bool true if the action is valid; otherwise, false */ - protected static function isValidAction (string $action) { + protected static function isValidAction (string $action) : bool { $actions = ['created', 'deleted', 'publicized', 'privatized']; return in_array($action, $actions); } /** * Gets description for the payload - * - * @return string */ public function getDescription () : string { $action = $this->payload->action; @@ -57,8 +55,6 @@ /** * Gets link for the payload - * - * @return string */ public function getLink () : string { return $this->payload->repository->html_url; diff --git a/app/Analyzers/GitHub/Events/StatusEvent.php b/app/Analyzers/GitHub/Events/StatusEvent.php --- a/app/Analyzers/GitHub/Events/StatusEvent.php +++ b/app/Analyzers/GitHub/Events/StatusEvent.php @@ -11,10 +11,8 @@ /** * Gets state localized message - * - * @return string */ - private function getState () { + private function getState () : string { $state = $this->payload->state; // pending, success, failure, or error $key = 'GitHub.StatusEventState.' . $state; return trans($key); @@ -22,10 +20,8 @@ /** * Gets status result - * - * @return string */ - private function getStatusResult () { + private function getStatusResult () : string { $glue = trans('GitHub.Separator'); $fragments = array_filter([ $this->payload->context, @@ -38,8 +34,6 @@ /** * Gets description for the payload - * - * @return string */ public function getDescription () : string { return trans('GitHub.EventsDescriptions.StatusEvent', [ @@ -50,8 +44,6 @@ /** * Gets link for the payload - * - * @return string */ public function getLink () : string { $url = $this->payload->target_url; diff --git a/app/Analyzers/GitHub/Events/UnknownEvent.php b/app/Analyzers/GitHub/Events/UnknownEvent.php --- a/app/Analyzers/GitHub/Events/UnknownEvent.php +++ b/app/Analyzers/GitHub/Events/UnknownEvent.php @@ -27,8 +27,6 @@ /** * Gets description for the payload - * - * @return string */ public function getDescription () : string { return "Some $this->eventType happened"; @@ -36,8 +34,6 @@ /** * Gets link for the payload - * - * @return string */ public function getLink () : string { return ""; diff --git a/app/Analyzers/GitHub/Events/WatchEvent.php b/app/Analyzers/GitHub/Events/WatchEvent.php --- a/app/Analyzers/GitHub/Events/WatchEvent.php +++ b/app/Analyzers/GitHub/Events/WatchEvent.php @@ -17,8 +17,6 @@ /** * Gets description for the payload - * - * @return string */ public function getDescription () : string { return trans( @@ -32,8 +30,6 @@ /** * Gets link for the payload - * - * @return string */ public function getLink () : string { return $this->payload->sender->html_url; diff --git a/app/Analyzers/GitHub/Events/WithCommit.php b/app/Analyzers/GitHub/Events/WithCommit.php --- a/app/Analyzers/GitHub/Events/WithCommit.php +++ b/app/Analyzers/GitHub/Events/WithCommit.php @@ -12,9 +12,8 @@ /** * Gets the title of the head commit - * @return string */ - private function getHeadCommitTitle () { + private function getHeadCommitTitle () : string { return static::getCommitTitle($this->payload->head_commit->message); } @@ -24,7 +23,7 @@ * @param string $message The commit message * @return string The commit title */ - public static function getCommitTitle (string $message) { + public static function getCommitTitle (string $message) : string { // Discards extra lines $pos = strpos($message, "\n"); if ($pos > 0) { @@ -38,10 +37,8 @@ /** * Gets the description text for the head commit. - * - * @return string */ - private function getHeadCommitDescription () { + private function getHeadCommitDescription () : string { $commit = $this->payload->head_commit; $committer = $commit->committer->username; $author = $commit->author->username; diff --git a/app/Analyzers/GitHub/Events/WithRef.php b/app/Analyzers/GitHub/Events/WithRef.php --- a/app/Analyzers/GitHub/Events/WithRef.php +++ b/app/Analyzers/GitHub/Events/WithRef.php @@ -19,7 +19,7 @@ * @param string $type The ref type to check * @return bool true if the ref type id valid; otherwise, false */ - protected static function isValidRefType (string $type) { + protected static function isValidRefType (string $type) : bool { $types = ['branch', 'tag']; return in_array($type, $types); } @@ -30,7 +30,7 @@ * @param string $type The reference type * @return string the part of the URL for this reference type (e.g. /tree/) */ - protected function getLinkRefSegment (string $type) { + protected function getLinkRefSegment (string $type) : string { $segments = $this->getLinkRefSegments(); if (!array_key_exists($type, $segments)) { diff --git a/app/Analyzers/GitHub/GitHubPayloadAnalyzer.php b/app/Analyzers/GitHub/GitHubPayloadAnalyzer.php --- a/app/Analyzers/GitHub/GitHubPayloadAnalyzer.php +++ b/app/Analyzers/GitHub/GitHubPayloadAnalyzer.php @@ -75,8 +75,6 @@ /** * Gets the name of the item, ie here of the name of the repository. - * - * @var string */ public function getItemName () : string { if ($this->isAdministrativeEvent()) { @@ -90,9 +88,6 @@ /// Qualification of the payload /// - /** - * @return bool - */ public function isAdministrativeEvent () : bool { $administrativeEvents = [ 'membership', // Member added to team @@ -109,8 +104,6 @@ /** * Gets a short textual description of the event. - * - * @return string */ public function getDescription () : string { return $this->analyzerEvent->getDescription(); diff --git a/app/Analyzers/ItemGroupMapping.php b/app/Analyzers/ItemGroupMapping.php --- a/app/Analyzers/ItemGroupMapping.php +++ b/app/Analyzers/ItemGroupMapping.php @@ -49,8 +49,6 @@ /** * Determines if the specified item belong to this mapping - * - * @return bool */ public function doesItemBelong (string $actualItem) : bool { foreach ($this->items as $candidateItem) { diff --git a/app/Analyzers/Jenkins/JenkinsPayloadAnalyzer.php b/app/Analyzers/Jenkins/JenkinsPayloadAnalyzer.php --- a/app/Analyzers/Jenkins/JenkinsPayloadAnalyzer.php +++ b/app/Analyzers/Jenkins/JenkinsPayloadAnalyzer.php @@ -43,9 +43,6 @@ return true; } - /** - * @return bool - */ public function shouldNotifyOnlyOnFailure () : bool { return in_array( $this->getItemName(), @@ -55,8 +52,6 @@ /** * Determines if the build status is a failure. - * - * @return bool */ public function isFailure () : bool { $status = ""; diff --git a/app/Analyzers/Phabricator/PhabricatorGroupMapping.php b/app/Analyzers/Phabricator/PhabricatorGroupMapping.php --- a/app/Analyzers/Phabricator/PhabricatorGroupMapping.php +++ b/app/Analyzers/Phabricator/PhabricatorGroupMapping.php @@ -24,8 +24,6 @@ /** * Determines if the specified story belong to this mapping - * - * @return bool */ public function doesStoryBelong (PhabricatorStory $story) : bool { foreach ($this->words as $word) { diff --git a/app/Config/Reporting/ServiceReportEntry.php b/app/Config/Reporting/ServiceReportEntry.php --- a/app/Config/Reporting/ServiceReportEntry.php +++ b/app/Config/Reporting/ServiceReportEntry.php @@ -82,8 +82,6 @@ * Determines if the service matches the following issue to report: * - service is Phabricator * - instance doesn't have the projects' name/PHID map in cache - * - * @return bool */ protected function isPhabricatorServiceWithNotCachedProjectsMap () : bool { if ($this->service->gate !== 'Phabricator') { diff --git a/app/Config/Services/Services.php b/app/Config/Services/Services.php --- a/app/Config/Services/Services.php +++ b/app/Config/Services/Services.php @@ -36,10 +36,8 @@ /** * Gets the services found in credentials.json configuration file. - * - * @return Service[] */ - public function get () { + public function get () : array { return $this->services; } diff --git a/app/Console/Commands/ConfigShow.php b/app/Console/Commands/ConfigShow.php --- a/app/Console/Commands/ConfigShow.php +++ b/app/Console/Commands/ConfigShow.php @@ -34,7 +34,7 @@ /** * Gets the services (defined in credentials.json) as table rows. * - * @return array + * @return string[][] */ protected function getServicesTableRows () : array { $rows = []; @@ -49,7 +49,7 @@ /** * Gets features as table rows * - * @return array + * @return string[][] */ protected function getFeaturesTableRows () : array { $rows = []; diff --git a/app/Console/Commands/NotificationsPayload.php b/app/Console/Commands/NotificationsPayload.php --- a/app/Console/Commands/NotificationsPayload.php +++ b/app/Console/Commands/NotificationsPayload.php @@ -132,9 +132,9 @@ /** * Formats payload to pass to constructor * - * @return PhabricatorStory|stdClass A deserialization of the payload + * @return PhabricatorStory|\stdClass A deserialization of the payload */ - private function formatPayload() { + private function formatPayload() : \stdClass|PhabricatorStory { if ($this->service === "Phabricator") { $project = $this->constructor['project']; return PhabricatorStory::loadFromJson($project, $this->payload); @@ -171,8 +171,6 @@ /** * Initializes a new instance of the relevant notification class, * with the arguments given in the constructor property. - * - * @return \Nasqueron\Notifications\Notifications\Notification */ private function getNotification () : Notification { $class = $this->getNotificationClass(); @@ -182,8 +180,6 @@ /** * Gets the notification in JSON format. - * - * @return string */ private function formatNotification () : string { return json_encode($this->getNotification(), JSON_PRETTY_PRINT); @@ -197,9 +193,7 @@ } /** - * Gets the notification class for the specified service. - * - * @return string + * Gets the notification class for the specified service */ private function getNotificationClass () : string { $namespace = "Nasqueron\Notifications\Notifications\\"; @@ -210,7 +204,7 @@ * Gets an array with the parameters to pass to the constructor * of the notification class for the specified service. * - * @return array + * @return string[] */ private function getNotificationConstructorParameters () : array { $parameters = []; diff --git a/app/Contracts/APIClient.php b/app/Contracts/APIClient.php --- a/app/Contracts/APIClient.php +++ b/app/Contracts/APIClient.php @@ -10,7 +10,7 @@ * @param string $url The API end point URL * @return void */ - public function setEndPoint (string $url); + public function setEndPoint (string $url) : void; /** * Calls an API method @@ -19,6 +19,6 @@ * @param array $arguments The arguments to use * @return mixed The API result */ - public function call (string $method, array $arguments = []); + public function call (string $method, array $arguments = []) : mixed; } diff --git a/app/Contracts/APIFactory.php b/app/Contracts/APIFactory.php --- a/app/Contracts/APIFactory.php +++ b/app/Contracts/APIFactory.php @@ -8,8 +8,7 @@ * Gets an instance of the API client class * * @param string $endPoint The API end point - * @return APIClient */ - public function get (string $endPoint); + public function get (string $endPoint) : APIClient; } diff --git a/app/Events/DockerHubPayloadEvent.php b/app/Events/DockerHubPayloadEvent.php --- a/app/Events/DockerHubPayloadEvent.php +++ b/app/Events/DockerHubPayloadEvent.php @@ -27,8 +27,6 @@ /** * Gets event according the kind of payload we receive. - * - * @return string */ public function getEvent () : string { if (isset($this->payload->repository->repo_url)) { diff --git a/app/Events/PhabricatorPayloadEvent.php b/app/Events/PhabricatorPayloadEvent.php --- a/app/Events/PhabricatorPayloadEvent.php +++ b/app/Events/PhabricatorPayloadEvent.php @@ -29,10 +29,8 @@ /** * Gets story from the request - * - * @return PhabricatorStory */ - protected function getStory () { + protected function getStory () : PhabricatorStory { return PhabricatorStory::loadFromIterable( $this->door, $this->payload diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -56,8 +56,6 @@ /** * Determines if the error handler should report to Sentry - * - * @return bool */ protected function shouldReportToSentry () : bool { return Raven::isConfigured() && Config::get('app.env') !== 'testing'; diff --git a/app/Facades/Broker.php b/app/Facades/Broker.php --- a/app/Facades/Broker.php +++ b/app/Facades/Broker.php @@ -11,8 +11,6 @@ /** * Gets the registered name of the component. - * - * @return string */ protected static function getFacadeAccessor() : string { return 'broker'; diff --git a/app/Facades/DockerHub.php b/app/Facades/DockerHub.php --- a/app/Facades/DockerHub.php +++ b/app/Facades/DockerHub.php @@ -11,8 +11,6 @@ /** * Gets the registered name of the component. - * - * @return string */ protected static function getFacadeAccessor() : string { return 'dockerhub'; diff --git a/app/Facades/Mailgun.php b/app/Facades/Mailgun.php --- a/app/Facades/Mailgun.php +++ b/app/Facades/Mailgun.php @@ -11,8 +11,6 @@ /** * Gets the registered name of the component. - * - * @return string */ protected static function getFacadeAccessor() : string { return 'mailgun'; diff --git a/app/Facades/PhabricatorAPI.php b/app/Facades/PhabricatorAPI.php --- a/app/Facades/PhabricatorAPI.php +++ b/app/Facades/PhabricatorAPI.php @@ -11,8 +11,6 @@ /** * Gets the registered name of the component. - * - * @return string */ protected static function getFacadeAccessor() : string { return 'phabricator-api'; diff --git a/app/Facades/ProjectsMap.php b/app/Facades/ProjectsMap.php --- a/app/Facades/ProjectsMap.php +++ b/app/Facades/ProjectsMap.php @@ -11,8 +11,6 @@ /** * Gets the registered name of the component. - * - * @return string */ protected static function getFacadeAccessor() : string { return 'phabricator-projectsmap'; diff --git a/app/Facades/Raven.php b/app/Facades/Raven.php --- a/app/Facades/Raven.php +++ b/app/Facades/Raven.php @@ -12,8 +12,6 @@ /** * Gets the registered name of the component. - * - * @return string */ protected static function getFacadeAccessor() : string { return 'raven'; diff --git a/app/Facades/Report.php b/app/Facades/Report.php --- a/app/Facades/Report.php +++ b/app/Facades/Report.php @@ -11,8 +11,6 @@ /** * Gets the registered name of the component. - * - * @return string */ protected static function getFacadeAccessor() : string { return 'report'; diff --git a/app/Facades/Services.php b/app/Facades/Services.php --- a/app/Facades/Services.php +++ b/app/Facades/Services.php @@ -11,8 +11,6 @@ /** * Gets the registered name of the component. - * - * @return string */ protected static function getFacadeAccessor() : string { return 'services'; diff --git a/app/Http/Controllers/Gate/GateController.php b/app/Http/Controllers/Gate/GateController.php --- a/app/Http/Controllers/Gate/GateController.php +++ b/app/Http/Controllers/Gate/GateController.php @@ -67,8 +67,6 @@ /** * Renders the report - * - * @return \Symfony\Component\HttpFoundation\Response */ protected function renderReport () : BaseResponse { if (!Features::isEnabled('ActionsReport')) { diff --git a/app/Jobs/FireJenkinsNotification.php b/app/Jobs/FireJenkinsNotification.php --- a/app/Jobs/FireJenkinsNotification.php +++ b/app/Jobs/FireJenkinsNotification.php @@ -30,8 +30,6 @@ /** * Executes the job. - * - * @return void */ public function handle() : void { $notification = $this->createNotification(); diff --git a/app/Jobs/NotifyNewCommitsToDiffusion.php b/app/Jobs/NotifyNewCommitsToDiffusion.php --- a/app/Jobs/NotifyNewCommitsToDiffusion.php +++ b/app/Jobs/NotifyNewCommitsToDiffusion.php @@ -68,8 +68,6 @@ /** * Executes the job. - * - * @return void */ public function handle () : void { if (!$this->fetchRequirements()) { diff --git a/app/Jobs/SendMessageToBroker.php b/app/Jobs/SendMessageToBroker.php --- a/app/Jobs/SendMessageToBroker.php +++ b/app/Jobs/SendMessageToBroker.php @@ -73,8 +73,6 @@ /** * Executes the job. - * - * @return void */ public function handle() : void { $this->sendMessage(); diff --git a/app/Jobs/TriggerDockerHubBuild.php b/app/Jobs/TriggerDockerHubBuild.php --- a/app/Jobs/TriggerDockerHubBuild.php +++ b/app/Jobs/TriggerDockerHubBuild.php @@ -46,8 +46,6 @@ /** * Executes the job. - * - * @return void */ public function handle () : void { $this->initializeReport(); diff --git a/app/Notifications/DockerHubNotification.php b/app/Notifications/DockerHubNotification.php --- a/app/Notifications/DockerHubNotification.php +++ b/app/Notifications/DockerHubNotification.php @@ -59,8 +59,6 @@ /** * Gets analyzer class name for the current event. - * - * @return string */ private function getAnalyzerClassName () : string { return "Nasqueron\Notifications\Analyzers\DockerHub\\" @@ -70,8 +68,6 @@ /** * Gets analyzer for the current event. - * - * @return \Nasqueron\Notifications\Analyzers\DockerHub\BaseEvent */ private function getAnalyzer () : BaseEvent { $class = $this->getAnalyzerClassName(); diff --git a/app/Notifications/GitHubNotification.php b/app/Notifications/GitHubNotification.php --- a/app/Notifications/GitHubNotification.php +++ b/app/Notifications/GitHubNotification.php @@ -54,8 +54,6 @@ /** * Gets the notification text. * Intended to convey a short message (thing Twitter or IRC). - * - * @return string */ public function getText () : string { return $this->getAnalyzer()->getDescription(); @@ -63,8 +61,6 @@ /** * Gets the notification URL. Intended to be a widget or icon link. - * - * @return string */ public function getLink () : string { return $this->getAnalyzer()->getLink(); diff --git a/app/Notifications/JenkinsNotification.php b/app/Notifications/JenkinsNotification.php --- a/app/Notifications/JenkinsNotification.php +++ b/app/Notifications/JenkinsNotification.php @@ -38,8 +38,6 @@ /** * Gets the notification type. - * - * @return string */ public function getType () : string { $build = $this->rawContent->build; @@ -57,8 +55,6 @@ /** * Gets the notification text. Intended to convey a short message * (thing Twitter or IRC). - * - * @return string */ public function getText () : string { $name = $this->rawContent->name; @@ -78,8 +74,6 @@ /** * Gets analyzer - * - * @return \Nasqueron\Notifications\Analyzers\Jenkins\JenkinsPayloadAnalyzer */ private function getAnalyzer () : JenkinsPayloadAnalyzer { if ($this->analyzer === null) { @@ -93,8 +87,6 @@ /** * Gets the notification group. - * - * @return string */ public function getGroup () : string { return $this->getAnalyzer()->getGroup(); diff --git a/app/Notifications/PhabricatorNotification.php b/app/Notifications/PhabricatorNotification.php --- a/app/Notifications/PhabricatorNotification.php +++ b/app/Notifications/PhabricatorNotification.php @@ -33,8 +33,6 @@ /** * Gets analyzer - * - * @return \Nasqueron\Notifications\Analyzers\Phabricator\PhabricatorPayloadAnalyzer */ private function getAnalyzer () : PhabricatorPayloadAnalyzer { if ($this->analyzer === null) { @@ -57,8 +55,6 @@ /** * Gets the notification URL. Intended to be a widget or icon link. - * - * @return string */ public function getLink () : string { return ""; diff --git a/app/Phabricator/PhabricatorAPI.php b/app/Phabricator/PhabricatorAPI.php --- a/app/Phabricator/PhabricatorAPI.php +++ b/app/Phabricator/PhabricatorAPI.php @@ -60,7 +60,7 @@ /** * @throws \RuntimeException when the service isn't in credentials.json */ - public static function forProject ($project) { + public static function forProject ($project) : PhabricatorAPI { $service = Services::findServiceByDoor('Phabricator', $project); if ($service === null) { throw new \RuntimeException( @@ -79,7 +79,7 @@ * * @param string $url The API end point URL */ - public function setEndPoint (string $url) { +public function setEndPoint (string $url) : void { $this->endPoint = $url; } @@ -91,7 +91,7 @@ * * @return mixed The API result */ - public function call (string $method, array $arguments = []) { + public function call (string $method, array $arguments = []) : mixed { $url = $this->endPoint . '/api/' . $method; $arguments['api.token'] = $this->apiToken; @@ -113,11 +113,8 @@ /** * Gets the first result of an API reply. - * - * @param iterable $reply - * @return mixed */ - public static function getFirstResult (iterable $reply) { + public static function getFirstResult (iterable $reply) : mixed { if (is_object($reply) && property_exists($reply, 'data')) { $reply = $reply->data; } @@ -131,7 +128,7 @@ /// CURL session /// - protected static function getPostFields ($arguments) { + protected static function getPostFields ($arguments) : string { $items = []; foreach ($arguments as $key => $value) { $items[] = urlencode($key) . '=' . urlencode($value); @@ -139,7 +136,7 @@ return implode('&', $items); } - protected static function post ($url, $arguments) { + protected static function post ($url, $arguments) : bool|string { $options = [ CURLOPT_URL => $url, CURLOPT_HEADER => false, diff --git a/app/Phabricator/PhabricatorAPIFactory.php b/app/Phabricator/PhabricatorAPIFactory.php --- a/app/Phabricator/PhabricatorAPIFactory.php +++ b/app/Phabricator/PhabricatorAPIFactory.php @@ -12,7 +12,7 @@ * @param string $instance The Phabricator instance * @return \Nasqueron\Notifications\Phabricator\PhabricatorAPI */ - public function get (string $instance) { + public function get (string $instance) : PhabricatorAPI { return PhabricatorAPI::forInstance($instance); } @@ -22,7 +22,7 @@ * @param string $project The Phabricator project name * @return PhabricatorAPI */ - public function getForProject (string $project) { + public function getForProject (string $project) : PhabricatorAPI { return PhabricatorAPI::forProject($project); } } diff --git a/app/Phabricator/PhabricatorStory.php b/app/Phabricator/PhabricatorStory.php --- a/app/Phabricator/PhabricatorStory.php +++ b/app/Phabricator/PhabricatorStory.php @@ -91,7 +91,7 @@ */ public static function loadFromIterable ( string $instanceName, iterable $payload - ) { + ) : PhabricatorStory { $instance = new self($instanceName); foreach ($payload as $key => $value) { @@ -105,7 +105,7 @@ public static function loadFromJson ( $instanceName, $payload - ) { + ) : PhabricatorStory { $array = json_decode($payload, true); if (!is_array($array)) { @@ -131,7 +131,7 @@ * * @return string The object type, as a 4 letters string (e.g. 'TASK') */ - public function getObjectType () { + public function getObjectType () : string { if ($this->hasVoidObjectType()) { return 'VOID'; } @@ -144,7 +144,7 @@ * * return string[] The list of project PHIDs */ - public function getProjectsPHIDs () { + public function getProjectsPHIDs () : array { if (!array_key_exists('objectPHID', $this->data)) { return []; } @@ -188,7 +188,7 @@ * @param string $method The API method to call (e.g. differential.query) * @return string The repository PHID or "" if not found */ - public function getRepositoryPHID (string $method) { + public function getRepositoryPHID (string $method) : string { $objectPHID = $this->data['objectPHID']; $api = PhabricatorAPI::forProject($this->instanceName); @@ -220,7 +220,7 @@ * @param string $objectPHID The object PHID to pass as method parameter * @return string[] The list of project PHIDs */ - public function getItemProjectsPHIDs (string $method, string $objectPHID) { + public function getItemProjectsPHIDs (string $method, string $objectPHID) : array { if (!$objectPHID) { return []; } @@ -248,7 +248,7 @@ protected function getItemProjectsPHIDsThroughApplicationSearch ( $method, $objectPHID - ) { + ) : array { if (!$objectPHID) { return []; } @@ -279,7 +279,7 @@ * * @return string[] The list of project PHIDs */ - public function getProjects () { + public function getProjects () : array { if ($this->projects === null) { $this->attachProjects(); } @@ -290,7 +290,7 @@ * Queries the list of the projects associated to the story * and attached it to the projects property. */ - public function attachProjects () { + public function attachProjects () : void { $this->projects = []; $PHIDs = $this->getProjectsPHIDs(); @@ -316,7 +316,7 @@ * @param string $key The field of the API reply * @return string The property's name */ - public static function mapPhabricatorFeedKey (string $key) { + public static function mapPhabricatorFeedKey (string $key) : string { if ($key == "storyID") { return "id"; } diff --git a/app/Phabricator/ProjectsMap.php b/app/Phabricator/ProjectsMap.php --- a/app/Phabricator/ProjectsMap.php +++ b/app/Phabricator/ProjectsMap.php @@ -64,10 +64,8 @@ /** * Gets iterator. - * - * @return \Traversable */ - public function getIterator () { + public function getIterator () : \Traversable { return new \ArrayIterator($this->map); } @@ -81,7 +79,7 @@ * @param mixed $offset The offset * @return bool */ - public function offsetExists (mixed $offset) { + public function offsetExists (mixed $offset) : bool { return array_key_exists($offset, $this->map); } @@ -91,7 +89,7 @@ * @param mixed $offset The offset. * @return mixed The value */ - public function offsetGet (mixed $offset) { + public function offsetGet (mixed $offset) : mixed { return $this->map[$offset]; } @@ -124,7 +122,7 @@ * @param string $phabricatorInstanceName The Phabricator instance name * @return ProjectsMap */ - public static function load (string $phabricatorInstanceName) { + public static function load (string $phabricatorInstanceName) : ProjectsMap { $instance = new self($phabricatorInstanceName); if ($instance->isCached()) { @@ -142,7 +140,7 @@ public static function fetch ( string $phabricatorInstanceName, ?APIClient $apiClient = null - ) { + ) : ProjectsMap { $instance = new self($phabricatorInstanceName); $instance->setAPIClient($apiClient); $instance->fetchFromAPI(); @@ -153,10 +151,7 @@ /// API /// - /** - * @return \Nasqueron\Notifications\Contracts\APIClient - */ - public function getAPIClient () { + public function getAPIClient () : APIClient { if ($this->apiClient === null) { $factory = App::make('phabricator-api'); $this->apiClient = $factory->getForProject($this->instanceName); @@ -164,10 +159,7 @@ return $this->apiClient; } - /** - * @param \Nasqueron\Notifications\Contracts\APIClient|null $apiClient - */ - public function setAPIClient (?APIClient $apiClient = null) { + public function setAPIClient (?APIClient $apiClient = null) : void { $this->apiClient = $apiClient; } @@ -212,7 +204,7 @@ * * @return string The cache key for the current projects map */ - private function getCacheKey () { + private function getCacheKey () : string { return class_basename(get_class($this)) . '-' . md5($this->instanceName); @@ -223,7 +215,7 @@ * * @return bool true if cached; otherwise, false. */ - public function isCached () { + public function isCached () : bool { return Cache::has($this->getCacheKey()); } @@ -257,7 +249,7 @@ * @param string $projectPHID the PHID of the project to query the name * @return string The name of the poject, or an empty string if not found */ - public function getProjectName (string $projectPHID) { + public function getProjectName (string $projectPHID) : string { if ($this->offsetExists($projectPHID)) { return $this->offsetGet($projectPHID); } @@ -273,9 +265,9 @@ /** * Returns the projects map as an array. * - * @return array An array, each row containing ['PHID', 'project name'] + * @return array[] An array, each row containing ['PHID', 'project name'] */ - public function toArray () { + public function toArray () : array { $array = []; foreach ($this->map as $phid => $projectName) { $array[] = [$phid, $projectName]; diff --git a/app/Phabricator/ProjectsMapFactory.php b/app/Phabricator/ProjectsMapFactory.php --- a/app/Phabricator/ProjectsMapFactory.php +++ b/app/Phabricator/ProjectsMapFactory.php @@ -10,7 +10,7 @@ * @param string $instanceName The Phabricator instance name * @return ProjectsMap */ - public function load (string $instanceName) { + public function load (string $instanceName) : ProjectsMap { return ProjectsMap::load($instanceName); } @@ -20,7 +20,7 @@ * @param string $instanceName The Phabricator instance name * @return ProjectsMap */ - public function fetch (string $instanceName) { + public function fetch (string $instanceName) : ProjectsMap { return ProjectsMap::fetch($instanceName); } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -8,19 +8,15 @@ /** * Bootstrap any application services. - * - * @return void */ - public function boot() { + public function boot() : void { // } /** * Register any application services. - * - * @return void */ - public function register() { + public function register() : void { // } } diff --git a/app/Providers/BrokerServiceProvider.php b/app/Providers/BrokerServiceProvider.php --- a/app/Providers/BrokerServiceProvider.php +++ b/app/Providers/BrokerServiceProvider.php @@ -11,18 +11,14 @@ /** * Bootstraps the application services. - * - * @return void */ - public function boot() { + public function boot() : void { } /** * Registers the application services. - * - * @return void */ - public function register() { + public function register() : void { $this->app->singleton('broker', function (Application $app) { $config = $app->make('config'); $driver = $config->get('broker.driver'); diff --git a/app/Providers/DockerHubServiceProvider.php b/app/Providers/DockerHubServiceProvider.php --- a/app/Providers/DockerHubServiceProvider.php +++ b/app/Providers/DockerHubServiceProvider.php @@ -12,10 +12,8 @@ class DockerHubServiceProvider extends ServiceProvider { /** * Bootstraps the application services. - * - * @return void */ - public function boot() { + public function boot() : void { } /** @@ -24,7 +22,7 @@ * @param \Illuminate\Contracts\Foundation\Application $app * @return array */ - public static function getTokens (Application $app) { + public static function getTokens (Application $app) : array { $file = $app->make('config')->get('services.dockerhub.tokens'); $fs = $app->make('filesystem')->disk('local'); @@ -38,10 +36,8 @@ /** * Registers the application services. - * - * @return void */ - public function register() { + public function register() : void { $this->app->singleton('dockerhub', function (Application $app) { $tokens = DockerHubServiceProvider::getTokens($app); return new TriggerBuildFactory(new Client, $tokens); diff --git a/app/Providers/MailgunServiceProvider.php b/app/Providers/MailgunServiceProvider.php --- a/app/Providers/MailgunServiceProvider.php +++ b/app/Providers/MailgunServiceProvider.php @@ -11,18 +11,14 @@ class MailgunServiceProvider extends ServiceProvider { /** * Bootstraps the application services. - * - * @return void */ - public function boot() { + public function boot() : void { } /** * Registers the application services. - * - * @return void */ - public function register() { + public function register() : void { $this->app->singleton('mailgun', function (Application $app) { $config = $app->make('config'); $key = $config->get('services.mailgun.secret'); diff --git a/app/Providers/PhabricatorAPIServiceProvider.php b/app/Providers/PhabricatorAPIServiceProvider.php --- a/app/Providers/PhabricatorAPIServiceProvider.php +++ b/app/Providers/PhabricatorAPIServiceProvider.php @@ -10,18 +10,14 @@ /** * Bootstraps the application services. - * - * @return void */ - public function boot() { + public function boot() : void { } /** * Registers the application services. - * - * @return void */ - public function register() { + public function register() : void { $this->app->singleton('phabricator-api', static function () { return new PhabricatorAPIFactory; }); diff --git a/app/Providers/PhabricatorProjectsMapServiceProvider.php b/app/Providers/PhabricatorProjectsMapServiceProvider.php --- a/app/Providers/PhabricatorProjectsMapServiceProvider.php +++ b/app/Providers/PhabricatorProjectsMapServiceProvider.php @@ -10,18 +10,14 @@ /** * Bootstraps the application services. - * - * @return void */ - public function boot() { + public function boot() : void { } /** * Registers the application services. - * - * @return void */ - public function register() { + public function register() : void { $this->app->singleton('phabricator-projectsmap', static function () { return new ProjectsMapFactory; }); diff --git a/app/Providers/ReportServiceProvider.php b/app/Providers/ReportServiceProvider.php --- a/app/Providers/ReportServiceProvider.php +++ b/app/Providers/ReportServiceProvider.php @@ -12,10 +12,8 @@ class ReportServiceProvider extends ServiceProvider { /** * Registers the application services. - * - * @return void */ - public function register() { + public function register() : void { $this->app->singleton('report', function (Application $app) { $report = new ActionsReport(); static::listenToActionsForReport( @@ -29,7 +27,7 @@ public static function listenToActionsForReport ( ActionsReport $report, Dispatcher $events - ) { + ) : void { $events->listen( 'Nasqueron\Notifications\Events\ReportEvent', static function (ReportEvent $event) use ($report) { diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -18,10 +18,8 @@ /** * Define your route model bindings, pattern filters, etc. - * - * @return void */ - public function boot() { + public function boot() : void { // parent::boot(); @@ -33,7 +31,7 @@ * @param \Illuminate\Routing\Router $router * @return void */ - public function map(Router $router) { + public function map(Router $router) : void { $router->group(['namespace' => $this->namespace], static function ($router) { require app_path('Http/routes.php'); }); diff --git a/app/Providers/SentryServiceProvider.php b/app/Providers/SentryServiceProvider.php --- a/app/Providers/SentryServiceProvider.php +++ b/app/Providers/SentryServiceProvider.php @@ -9,18 +9,14 @@ /** * Bootstraps the application services. - * - * @return void */ - public function boot() { + public function boot() : void { } /** * Registers the application services. - * - * @return void */ - public function register() { + public function register() : void { $this->app->singleton('raven', function (Application $app) { $config = $app->make('config'); $dsn = $config->get('services.sentry.dsn'); diff --git a/app/Providers/ServicesServiceProvider.php b/app/Providers/ServicesServiceProvider.php --- a/app/Providers/ServicesServiceProvider.php +++ b/app/Providers/ServicesServiceProvider.php @@ -10,10 +10,8 @@ class ServicesServiceProvider extends ServiceProvider { /** * Registers the application services. - * - * @return void */ - public function register() { + public function register() : void { $this->app->singleton('services', function (Application $app) { $path = config('services.gate.credentials'); if (strlen($path) > 0 && $app->make('filesystem')->has($path)) { diff --git a/tests/Phabricator/ProjectsMapTest.php b/tests/Phabricator/ProjectsMapTest.php --- a/tests/Phabricator/ProjectsMapTest.php +++ b/tests/Phabricator/ProjectsMapTest.php @@ -177,7 +177,7 @@ public function setEndPoint ($url) : void { } - public function call ($method, $arguments = []) { + public function call ($method, $arguments = []) : mixed { return $this->reply; } });