Page MenuHomeDevCentral

D2706.id6857.diff
No OneTemporary

D2706.id6857.diff

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,7 +27,7 @@
*
* This method allows analyzer to edit the payload.
*/
- public function getPayload () {
+ public function getPayload () : \stdClass {
return $this->payload;
}
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
@@ -21,14 +21,14 @@
*
* @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,7 +39,7 @@
* @param $string Regular expression
* @return string
*/
- private function extractFromBody ($regex) {
+ private function extractFromBody ($regex) : string {
preg_match($regex, $this->getMailBody(), $matches);
return $matches[1];
}
@@ -49,7 +49,7 @@
*
* @return string
*/
- public function getText() {
+ public function getText() : string {
$repo = $this->extractFromBody("@\"(.*?\/.*?)\"@");
return "Image build by Docker Hub registry failure for $repo";
@@ -60,7 +60,7 @@
*
* @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
@@ -9,7 +9,7 @@
*
* @return string
*/
- public function getText() {
+ public function getText() : string {
$repo = $this->payload->repository->repo_name;
$who = $this->payload->push_data->pusher;
@@ -21,7 +21,7 @@
*
* @return string
*/
- public function getLink() {
+ public function getLink() : string {
return $this->payload->repository->repo_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,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 = ['created', 'edited', 'deleted'];
return in_array($action, $actions);
}
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',
@@ -51,7 +51,7 @@
*
* @return array
*/
- private function getLocalisationParameters () {
+ private function getLocalisationParameters () : array {
$parameters = [
'author' => $this->payload->sender->login,
'number' => $this->payload->number,
@@ -68,7 +68,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) {
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) {
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,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 = ['created', 'deleted', 'publicized', 'privatized'];
return in_array($action, $actions);
}
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
@@ -14,7 +14,7 @@
*
* @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);
@@ -25,7 +25,7 @@
*
* @return string
*/
- private function getStatusResult () {
+ private function getStatusResult () : string {
$glue = trans('GitHub.Separator');
$fragments = array_filter([
$this->payload->context,
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
@@ -14,7 +14,7 @@
* 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 +24,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) {
@@ -41,7 +41,7 @@
*
* @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/Config/Services/Services.php b/app/Config/Services/Services.php
--- a/app/Config/Services/Services.php
+++ b/app/Config/Services/Services.php
@@ -39,7 +39,7 @@
*
* @return Service[]
*/
- public function get () {
+ public function get () : array {
return $this->services;
}
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);
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
diff --git a/app/Events/PhabricatorPayloadEvent.php b/app/Events/PhabricatorPayloadEvent.php
--- a/app/Events/PhabricatorPayloadEvent.php
+++ b/app/Events/PhabricatorPayloadEvent.php
@@ -32,7 +32,7 @@
*
* @return PhabricatorStory
*/
- protected function getStory () {
+ protected function getStory () : PhabricatorStory {
return PhabricatorStory::loadFromIterable(
$this->door,
$this->payload
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;
@@ -131,7 +131,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 +139,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
@@ -65,9 +65,9 @@
/**
* Gets iterator.
*
- * @return \Traversable
+ * @return \Traversable|\ArrayIterator
*/
- public function getIterator () {
+ public function getIterator () : \Traversable|\ArrayIterator {
return new \ArrayIterator($this->map);
}
@@ -81,7 +81,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 +91,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 +124,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 +142,7 @@
public static function fetch (
string $phabricatorInstanceName,
?APIClient $apiClient = null
- ) {
+ ) : ProjectsMap {
$instance = new self($phabricatorInstanceName);
$instance->setAPIClient($apiClient);
$instance->fetchFromAPI();
@@ -156,7 +156,7 @@
/**
* @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);
@@ -212,7 +212,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 +223,7 @@
*
* @return bool true if cached; otherwise, false.
*/
- public function isCached () {
+ public function isCached () : bool {
return Cache::has($this->getCacheKey());
}
@@ -257,7 +257,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);
}
@@ -275,7 +275,7 @@
*
* @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
@@ -11,7 +11,7 @@
*
* @return void
*/
- public function boot() {
+ public function boot() : void {
//
}
@@ -20,7 +20,7 @@
*
* @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
@@ -14,7 +14,7 @@
*
* @return void
*/
- public function boot() {
+ public function boot() : void {
}
/**
diff --git a/app/Providers/DockerHubServiceProvider.php b/app/Providers/DockerHubServiceProvider.php
--- a/app/Providers/DockerHubServiceProvider.php
+++ b/app/Providers/DockerHubServiceProvider.php
@@ -15,7 +15,7 @@
*
* @return void
*/
- public function boot() {
+ public function boot() : void {
}
/**
@@ -24,7 +24,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');
@@ -41,7 +41,7 @@
*
* @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
@@ -14,7 +14,7 @@
*
* @return void
*/
- public function boot() {
+ public function boot() : void {
}
/**
diff --git a/app/Providers/PhabricatorAPIServiceProvider.php b/app/Providers/PhabricatorAPIServiceProvider.php
--- a/app/Providers/PhabricatorAPIServiceProvider.php
+++ b/app/Providers/PhabricatorAPIServiceProvider.php
@@ -13,7 +13,7 @@
*
* @return void
*/
- public function boot() {
+ public function boot() : void {
}
/**
@@ -21,7 +21,7 @@
*
* @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
@@ -13,7 +13,7 @@
*
* @return void
*/
- public function boot() {
+ public function boot() : void {
}
/**
diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php
--- a/app/Providers/RouteServiceProvider.php
+++ b/app/Providers/RouteServiceProvider.php
@@ -21,7 +21,7 @@
*
* @return void
*/
- public function boot() {
+ public function boot() : void {
//
parent::boot();
@@ -33,7 +33,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
@@ -12,7 +12,7 @@
*
* @return void
*/
- public function boot() {
+ public function boot() : void {
}
/**
@@ -20,7 +20,7 @@
*
* @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
@@ -13,7 +13,7 @@
*
* @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)) {

File Metadata

Mime Type
text/plain
Expires
Fri, May 23, 02:34 (2 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2676918
Default Alt Text
D2706.id6857.diff (24 KB)

Event Timeline