Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3750291
D1545.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
33 KB
Referenced Files
None
Subscribers
None
D1545.id.diff
View Options
diff --git a/app/Actions/AMQPAction.php b/app/Actions/AMQPAction.php
--- a/app/Actions/AMQPAction.php
+++ b/app/Actions/AMQPAction.php
@@ -31,7 +31,11 @@
* @param string $target The queue or exchange target on the broker
* @param string $routingKey The routing key for this exchange or queue
*/
- public function __construct (string $method, string $target, string $routingKey = '') {
+ public function __construct (
+ string $method,
+ string $target,
+ string $routingKey = ''
+ ) {
parent::__construct();
$this->method = $method;
diff --git a/app/Actions/ActionError.php b/app/Actions/ActionError.php
--- a/app/Actions/ActionError.php
+++ b/app/Actions/ActionError.php
@@ -18,11 +18,6 @@
*/
public $message;
- /**
- * Initializes a new action error report instance from the specified Exception
- *
- * @param \Exception $ex The exception to build an ActionError instance from
- */
public function __construct (\Exception $ex) {
$this->type = class_basename(get_class($ex));
$this->message = $ex->getMessage();
diff --git a/app/Analyzers/BasePayloadAnalyzer.php b/app/Analyzers/BasePayloadAnalyzer.php
--- a/app/Analyzers/BasePayloadAnalyzer.php
+++ b/app/Analyzers/BasePayloadAnalyzer.php
@@ -72,7 +72,11 @@
* @return string
*/
public function getConfigurationFileName () : string {
- $dir = Config::get('services.' . strtolower(static::SERVICE_NAME) . '.analyzer.configDir');
+ $dir = Config::get(
+ 'services.'
+ . strtolower(static::SERVICE_NAME)
+ . '.analyzer.configDir'
+ );
$filename = $dir . '/' . $this->project . '.json';
@@ -89,8 +93,9 @@
* @return string
*/
private function getCandidateConfigurationClassName() : string {
- $namespace = 'Nasqueron\Notifications\Analyzers\\' . static::SERVICE_NAME;
- return $namespace . "\\" . static::SERVICE_NAME . 'PayloadAnalyzerConfiguration';
+ return 'Nasqueron\Notifications\Analyzers\\' . static::SERVICE_NAME //ns
+ . "\\"
+ . static::SERVICE_NAME . 'PayloadAnalyzerConfiguration'; // class
}
/**
@@ -133,7 +138,10 @@
* @var string
*/
public function getItemName () : string {
- throw new BadMethodCallException("The getItemName method must be implemented in the analyzer class if used.");
+ throw new BadMethodCallException(<<<MSG
+The getItemName method must be implemented in the analyzer class if used.
+MSG
+);
}
/**
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
@@ -46,7 +46,9 @@
public static function forPayload ($eventName, $payload) {
$class = self::getClass($eventName);
if (!class_exists($class)) {
- throw new \InvalidArgumentException("Class doesn't exist: $class (for $eventName)");
+ throw new \InvalidArgumentException(
+ "Class doesn't exist: $class (for $eventName)"
+ );
}
return new $class($payload);
}
diff --git a/app/Analyzers/GitHub/Events/WithRepoAndBranch.php b/app/Analyzers/GitHub/Events/WithRepoAndBranch.php
--- a/app/Analyzers/GitHub/Events/WithRepoAndBranch.php
+++ b/app/Analyzers/GitHub/Events/WithRepoAndBranch.php
@@ -12,24 +12,18 @@
/**
* Gets repository and branch information
- *
- * @return string
*/
- public function getWhere () {
+ public function getWhere () : string {
$repo = $this->payload->repository->name;
$branch = $this->payload->ref;
return static::getRepositoryAndBranch($repo, $branch);
}
- /**
- * Gets a repository and branch information string
- *
- * @param string $repo The repository
- * @param string $branch The branch
- * @return string "<repo>" or "<repo> (branch <branch>)" when branch isn't master
- */
- public static function getRepositoryAndBranch ($repo = "", $branch = "") {
+ public static function getRepositoryAndBranch (
+ $repo = "",
+ $branch = ""
+ ) : string {
if ($repo === "") {
return "";
}
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
@@ -41,7 +41,11 @@
* @param string $event
* @param \stdClass $payload
*/
- public function __construct(string $project, string $event, \stdClass $payload) {
+ public function __construct(
+ string $project,
+ string $event,
+ \stdClass $payload
+ ) {
parent::__construct($project, $payload);
$this->event = $event;
diff --git a/app/Analyzers/ItemGroupMapping.php b/app/Analyzers/ItemGroupMapping.php
--- a/app/Analyzers/ItemGroupMapping.php
+++ b/app/Analyzers/ItemGroupMapping.php
@@ -38,7 +38,10 @@
* @param string $item The item name to compare with the pattern
* @return bool
*/
- public static function doesItemMatch (string $pattern, string $item) : bool {
+ public static function doesItemMatch (
+ string $pattern,
+ string $item
+ ) : bool {
return str_is($pattern, $item);
}
diff --git a/app/Analyzers/Phabricator/PhabricatorPayloadAnalyzerConfiguration.php b/app/Analyzers/Phabricator/PhabricatorPayloadAnalyzerConfiguration.php
--- a/app/Analyzers/Phabricator/PhabricatorPayloadAnalyzerConfiguration.php
+++ b/app/Analyzers/Phabricator/PhabricatorPayloadAnalyzerConfiguration.php
@@ -4,7 +4,8 @@
use Nasqueron\Notifications\Analyzers\PayloadAnalyzerConfiguration;
-class PhabricatorPayloadAnalyzerConfiguration extends PayloadAnalyzerConfiguration {
+class PhabricatorPayloadAnalyzerConfiguration
+ extends PayloadAnalyzerConfiguration {
/**
* An array of RepositoryGroupMapping objects to match repositories & groups
diff --git a/app/Config/Features.php b/app/Config/Features.php
--- a/app/Config/Features.php
+++ b/app/Config/Features.php
@@ -63,8 +63,6 @@
/**
* Gets all the features, with the toggle status.
- *
- * @return array An array with features as keys, bool as values (true if enabled)
*/
public static function getAll () : array {
return Config::get('app.features');
diff --git a/app/Config/Reporting/BaseReportEntry.php b/app/Config/Reporting/BaseReportEntry.php
--- a/app/Config/Reporting/BaseReportEntry.php
+++ b/app/Config/Reporting/BaseReportEntry.php
@@ -22,7 +22,10 @@
* @param string $emptyStringGlyph The glyph to use if the string is empty
* @return string
*/
- public static function fancyString (string $string, string $emptyStringGlyph) : string {
+ public static function fancyString (
+ string $string,
+ string $emptyStringGlyph
+ ) : string {
if ($string === "") {
return $emptyStringGlyph;
}
@@ -35,10 +38,16 @@
*
* @param bool $value The source value
* @param string $truthyStringGlyph The glyph to use if the value is true
- * @param string $falsyStringGlyph The glyph to use if the value is false [facultative, by default an empty string]
+ * @param string $falsyStringGlyph The glyph to use if the value is false
+ * [facultative, by default an empty string]
+ *
* @return string The relevant glyph
*/
- public static function fancyBool (bool $value, string $truthyStringGlyph, string $falsyStringGlyph = '') : string {
+ public static function fancyBool (
+ bool $value,
+ string $truthyStringGlyph,
+ string $falsyStringGlyph = ''
+ ) : string {
if ($value) {
return $truthyStringGlyph;
}
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
@@ -45,11 +45,6 @@
/// Constructor
///
- /**
- * Initializes a new instance of the ServiceReportEntry class.
- *
- * @param \Nasqueron\Notifications\Config\Services\Service $service The service
- */
public function __construct (Service $service) {
$this->service = $service;
$this->query();
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
@@ -20,8 +20,6 @@
///
/**
- * Initializes a new instance of the Services class deserializing a JSON file.
- *
* @param string $file The JSON file to deserialize
* @return Services The deserialized instance
*/
@@ -89,10 +87,15 @@
*
* @param string $gate The gate (e.g. Phabricator)
* @param string $property The property to check (e.g. instance)
- * @param mixed $value The property value to find (e.g. 'http://devcentral.nasqueron.org')
+ * @param mixed $value The property value to find
+ * (e.g. 'http://devcentral.nasqueron.org')
* @return Service|null The service information is found; otherwise, null.
*/
- public function findServiceByProperty (string $gate, string $property, $value) : ?Service {
+ public function findServiceByProperty (
+ string $gate,
+ string $property,
+ $value
+ ) : ?Service {
foreach ($this->services as $service) {
if ($service->gate === $gate && $service->$property === $value) {
return $service;
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
@@ -23,7 +23,10 @@
*
* @var string
*/
- protected $description = 'Gets a notification payload from a service payload';
+ protected $description = <<<'TXT'
+Gets a notification payload from a service payload
+TXT;
+
/**
* The service to handle a payload for.
@@ -80,13 +83,16 @@
*
* Fills it to the service property.
*
- * @throws InvalidArgumentException when a notification class can't be found for the requested service.
+ * @throws InvalidArgumentException when a notification class can't be
+ * found for the requested service.
*/
private function parseService () : void {
$this->service = $this->argument('service');
if (!class_exists($this->getNotificationClass())) {
- throw new InvalidArgumentException("Unknown service: $this->service");
+ throw new InvalidArgumentException(
+ "Unknown service: $this->service"
+ );
}
}
@@ -111,7 +117,7 @@
* Parses all the extra arguments and sets the constructor property
* as an array of constructor arguments.
*
- * @throws InvalidArgumentException when too many or too few arguments have been given.
+ * @throws InvalidArgumentException on wrong arguments count.
*/
private function parseConstructorParameters () : void {
$keys = $this->getNotificationConstructorParameters();
@@ -146,12 +152,17 @@
*
* @throws InvalidArgumentException when keys and values counts don't match
*/
- public static function argumentsArrayCombine (array $keys, array $values) : array {
+ public static function argumentsArrayCombine (
+ array $keys, array $values
+ ) : array {
$countKeys = count($keys);
$countValues = count($values);
if ($countKeys != $countValues) {
- throw new InvalidArgumentException("Number of arguments mismatch: got $countValues but expected $countKeys.");
+ throw new InvalidArgumentException(<<<MSG
+Number of arguments mismatch: got $countValues but expected $countKeys.
+MSG
+ );
}
return array_combine($keys, $values);
diff --git a/app/Console/Commands/PhabricatorProjectsMap.php b/app/Console/Commands/PhabricatorProjectsMap.php
--- a/app/Console/Commands/PhabricatorProjectsMap.php
+++ b/app/Console/Commands/PhabricatorProjectsMap.php
@@ -20,7 +20,9 @@
*
* @var string
*/
- protected $description = 'Regenerate the projects map for each Phabricator instances';
+ protected $description = <<<'TXT'
+Regenerate the projects map for each Phabricator instances
+TXT;
/**
* Executes the console command.
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -35,8 +35,6 @@
/**
* Gets a command by name
*
- * @param string $name The command name (first word of the command signature)
- * @return \Illuminate\Console\Command
* @throws \RuntimeException when command doesn't exit
*/
public function get (string $name) : Command {
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
@@ -88,11 +88,12 @@
/**
* Gets service credentials for this gate and door
- *
- * @return \Nasqueron\Notifications\Config\Services\Service|null The service information is found; otherwise, null.
*/
public function getService () : ?Service {
- return Services::findServiceByDoor($this->getServiceName(), $this->door);
+ return Services::findServiceByDoor(
+ $this->getServiceName(),
+ $this->door
+ );
}
/**
diff --git a/app/Http/routes.php b/app/Http/routes.php
--- a/app/Http/routes.php
+++ b/app/Http/routes.php
@@ -35,7 +35,8 @@
if (Features::isEnabled('Gate')) {
foreach (Config::get('gate.controllers') as $controller) {
$controllerRoute = '/gate/' . $controller . '/';
- Route::get($controllerRoute . '{door?}', "Gate\\${controller}GateController@onGet");
- Route::post($controllerRoute . '{door}', "Gate\\${controller}GateController@onPost");
+ $controllerClass = "Gate\\${controller}GateController";
+ Route::get($controllerRoute . '{door?}', "$controllerClass@onGet");
+ Route::post($controllerRoute . '{door}', "$controllerClass@onPost");
}
}
diff --git a/app/Jobs/FireDockerHubNotification.php b/app/Jobs/FireDockerHubNotification.php
--- a/app/Jobs/FireDockerHubNotification.php
+++ b/app/Jobs/FireDockerHubNotification.php
@@ -37,11 +37,6 @@
Event::fire(new NotificationEvent($notification));
}
- /**
- * Creates a DockerHub notification
- *
- * @return \Nasqueron\Notifications\Notifications\DockerHubNotification The notification
- */
protected function createNotification() : DockerHubNotification {
return new DockerHubNotification(
$this->event->door, // project
diff --git a/app/Jobs/FireGitHubNotification.php b/app/Jobs/FireGitHubNotification.php
--- a/app/Jobs/FireGitHubNotification.php
+++ b/app/Jobs/FireGitHubNotification.php
@@ -37,11 +37,7 @@
Event::fire(new NotificationEvent($notification));
}
- /**
- * Creates a GitHub notification
- *
- * @return \Nasqueron\Notifications\Notifications\GitHubNotification The notification
- */
+
protected function createNotification() : GitHubNotification {
return new GitHubNotification(
$this->event->door, // project
diff --git a/app/Jobs/FireJenkinsNotification.php b/app/Jobs/FireJenkinsNotification.php
--- a/app/Jobs/FireJenkinsNotification.php
+++ b/app/Jobs/FireJenkinsNotification.php
@@ -41,11 +41,6 @@
}
}
- /**
- * Creates a Jenkins notification
- *
- * @return \Nasqueron\Notifications\Notifications\JenkinsNotification The notification
- */
protected function createNotification() : JenkinsNotification {
return new JenkinsNotification(
$this->event->door, // project
diff --git a/app/Jobs/FirePhabricatorNotification.php b/app/Jobs/FirePhabricatorNotification.php
--- a/app/Jobs/FirePhabricatorNotification.php
+++ b/app/Jobs/FirePhabricatorNotification.php
@@ -37,11 +37,6 @@
Event::fire(new NotificationEvent($notification));
}
- /**
- * Creates a Phabricator notification
- *
- * @return \Nasqueron\Notifications\Notifications\PhabricatorNotification The notification
- */
protected function createNotification() : PhabricatorNotification {
return new PhabricatorNotification(
$this->event->door, // Project
diff --git a/app/Jobs/NotifyNewCommitsToDiffusion.php b/app/Jobs/NotifyNewCommitsToDiffusion.php
--- a/app/Jobs/NotifyNewCommitsToDiffusion.php
+++ b/app/Jobs/NotifyNewCommitsToDiffusion.php
@@ -131,7 +131,7 @@
/**
* Fetches API and call sign.
*
- * @return bool true if all requirement have been fetched ; otherwise, false.
+ * @return bool true if all requirement have been fetched
*/
private function fetchRequirements () : bool {
return $this->fetchAPI() && $this->fetchCallSign();
@@ -140,7 +140,7 @@
/**
* Fetches the Phabricator API to use for the current source project.
*
- * @return bool true if an API instance has been fetch ; otherwise, false.
+ * @return bool true if an API instance has been fetched
*/
private function fetchAPI () : bool {
$project = $this->getPhabricatorProject();
@@ -169,9 +169,9 @@
///
/**
- * Gets the call sign matching the repository URL.
+ * Gets the call sign matching the repository URL (e.g. "OPS").
*
- * @return string the repository call sign "OPS", or "" if not in Phabricator
+ * @return string the repository call sign, or "" if not in Phabricator
*/
private function getCallSign () : string {
$reply = $this->api->call(
diff --git a/app/Jobs/SendMessageToBroker.php b/app/Jobs/SendMessageToBroker.php
--- a/app/Jobs/SendMessageToBroker.php
+++ b/app/Jobs/SendMessageToBroker.php
@@ -58,7 +58,11 @@
*
* @return void
*/
- public function __construct (string $target, string $routingKey, string $message) {
+ public function __construct (
+ string $target,
+ string $routingKey,
+ string $message
+ ) {
$this->target = $target;
$this->routingKey = $routingKey;
$this->message = $message;
diff --git a/app/Listeners/AMQPEventListener.php b/app/Listeners/AMQPEventListener.php
--- a/app/Listeners/AMQPEventListener.php
+++ b/app/Listeners/AMQPEventListener.php
@@ -25,12 +25,9 @@
$this->sendNotification($event->notification);
}
- /**
- * Gets routing key, to allow consumers to select the topic they subscribe to.
- *
- * @param Notification The $notification from where the keys must be extracted
- */
- protected static function getNotificationRoutingKey (Notification $notification) : string {
+ protected static function getNotificationRoutingKey (
+ Notification $notification
+ ) : string {
$keyParts = [
$notification->project,
$notification->group,
@@ -66,7 +63,10 @@
*/
public function subscribe (Dispatcher $events) : void {
$class = AMQPEventListener::class;
- $events->listen(NotificationEvent::class, "$class@onNotification");
+ $events->listen(
+ NotificationEvent::class,
+ "$class@onNotification"
+ );
}
}
diff --git a/app/Listeners/NotificationListener.php b/app/Listeners/NotificationListener.php
--- a/app/Listeners/NotificationListener.php
+++ b/app/Listeners/NotificationListener.php
@@ -45,7 +45,9 @@
* @param PhabricatorPayloadEvent $event
* @return void
*/
- public function onPhabricatorPayload(PhabricatorPayloadEvent $event) : void {
+ public function onPhabricatorPayload(
+ PhabricatorPayloadEvent $event
+ ) : void {
$job = new FirePhabricatorNotification($event);
$job->handle();
}
diff --git a/app/Notifications/DockerHubNotification.php b/app/Notifications/DockerHubNotification.php
--- a/app/Notifications/DockerHubNotification.php
+++ b/app/Notifications/DockerHubNotification.php
@@ -27,7 +27,11 @@
*/
class DockerHubNotification extends Notification {
- public function __construct (string $project, string $event, \stdClass $payload) {
+ public function __construct (
+ string $project,
+ string $event,
+ \stdClass $payload
+ ) {
// Straightforward properties
$this->service = "DockerHub";
$this->project = $project;
diff --git a/app/Notifications/GitHubNotification.php b/app/Notifications/GitHubNotification.php
--- a/app/Notifications/GitHubNotification.php
+++ b/app/Notifications/GitHubNotification.php
@@ -11,7 +11,11 @@
*/
private $analyzer = null;
- public function __construct (string $project, string $event, \stdClass $payload) {
+ public function __construct (
+ string $project,
+ string $event,
+ \stdClass $payload
+ ) {
// Straightforward properties
$this->service = "GitHub";
$this->project = $project;
@@ -48,7 +52,8 @@
}
/**
- * Gets the notification text. Intended to convey a short message (thing Twitter or IRC).
+ * Gets the notification text.
+ * Intended to convey a short message (thing Twitter or IRC).
*
* @return string
*/
diff --git a/app/Notifications/JenkinsNotification.php b/app/Notifications/JenkinsNotification.php
--- a/app/Notifications/JenkinsNotification.php
+++ b/app/Notifications/JenkinsNotification.php
@@ -55,7 +55,8 @@
}
/**
- * Gets the notification text. Intended to convey a short message (thing Twitter or IRC).
+ * Gets the notification text. Intended to convey a short message
+ * (thing Twitter or IRC).
*
* @return string
*/
diff --git a/app/Phabricator/PhabricatorAPI.php b/app/Phabricator/PhabricatorAPI.php
--- a/app/Phabricator/PhabricatorAPI.php
+++ b/app/Phabricator/PhabricatorAPI.php
@@ -42,29 +42,31 @@
}
/**
- * Gets an API instance for the specific instance
- *
- * @param string $instance The name of the instance (this matches that parameter in credentials.json)
- * @return PhabricatorAPI A PhabricatorAPI instance for the project if found; otherwise, null.
+ * @throws \RuntimeException when the service isn't in credentials.json
*/
- public static function forInstance ($instance) {
- $service = Services::findServiceByProperty('Phabricator', 'instance', $instance);
+ public static function forInstance ($instance) : PhabricatorAPI {
+ $service = Services::findServiceByProperty(
+ 'Phabricator',
+ 'instance',
+ $instance
+ );
if ($service === null) {
- throw new \RuntimeException("No credentials for Phabricator instance $instance.");
+ throw new \RuntimeException(
+ "No credentials for Phabricator instance $instance."
+ );
}
return new self($service->instance, $service->secret);
}
/**
- * Gets an API instance for the specific project
- *
- * @param string $project The name of the project (this matches the door parameter in credentials.json)
- * @return PhabricatorAPI A PhabricatorAPI instance for the project if found; otherwise, null.
+ * @throws \RuntimeException when the service isn't in credentials.json
*/
public static function forProject ($project) {
$service = Services::findServiceByDoor('Phabricator', $project);
if ($service === null) {
- throw new \RuntimeException("No credentials for Phabricator project $project.");
+ throw new \RuntimeException(
+ "No credentials for Phabricator project $project."
+ );
}
return new self($service->instance, $service->secret);
}
@@ -152,7 +154,9 @@
curl_close($ch);
if ($result === false) {
- throw new \RuntimeException("Can't reach Phabricator API endpoint: $url");
+ throw new \RuntimeException(
+ "Can't reach Phabricator API endpoint: $url"
+ );
}
return $result;
diff --git a/app/Phabricator/PhabricatorStory.php b/app/Phabricator/PhabricatorStory.php
--- a/app/Phabricator/PhabricatorStory.php
+++ b/app/Phabricator/PhabricatorStory.php
@@ -89,7 +89,9 @@
* @param iterable $payload The data submitted by Phabricator
* @return PhabricatorStory
*/
- public static function loadFromIterable (string $instanceName, iterable $payload) {
+ public static function loadFromIterable (
+ string $instanceName, iterable $payload
+ ) {
$instance = new self($instanceName);
foreach ($payload as $key => $value) {
@@ -100,20 +102,17 @@
return $instance;
}
- /**
- * Initializes a new instance of PhabricatorStory from a JSON payload.
- *
- * This is intended to parse files saved by LastPayloadSaver::savePayload.
- *
- * @param string $instanceName The Phabricator instance name
- * @param string $payload The data submitted by Phabricator's JSON representation
- * @return PhabricatorStory
- */
- public static function loadFromJson ($instanceName, $payload) {
+ public static function loadFromJson (
+ $instanceName,
+ $payload
+ ) {
$array = json_decode($payload, true);
if (!is_array($array)) {
- throw new InvalidArgumentException("Payload should be deserializable as an array.");
+ throw new InvalidArgumentException(<<<MSG
+Payload should be deserializable as an array.
+MSG
+);
}
return self::loadFromIterable($instanceName, $array);
@@ -246,7 +245,10 @@
* migrated from info (generation 1) or query (generation 2) to search
* (generation 3), we'll rename it to getItemProjectsPHIDs and overwrite it.
*/
- protected function getItemProjectsPHIDsThroughApplicationSearch ($method, $objectPHID) {
+ protected function getItemProjectsPHIDsThroughApplicationSearch (
+ $method,
+ $objectPHID
+ ) {
if (!$objectPHID) {
return [];
}
diff --git a/app/Phabricator/ProjectsMap.php b/app/Phabricator/ProjectsMap.php
--- a/app/Phabricator/ProjectsMap.php
+++ b/app/Phabricator/ProjectsMap.php
@@ -138,12 +138,11 @@
/**
* Gets a new ProjectsMap instance and queries Phabricator API to fill it.
- *
- * @param string $phabricatorInstanceName The Phabricator instance name
- * @param \Nasqueron\Notifications\Contracts\APIClient|null $apiClient The Phabricator API client
- * @return ProjectsMap
*/
- public static function fetch ($phabricatorInstanceName, ?APIClient $apiClient = null) {
+ public static function fetch (
+ string $phabricatorInstanceName,
+ ?APIClient $apiClient = null
+ ) {
$instance = new self($phabricatorInstanceName);
$instance->setAPIClient($apiClient);
$instance->fetchFromAPI();
@@ -184,11 +183,17 @@
);
if (!$reply) {
- throw new \Exception("Empty reply calling project.query at $this->instanceName Conduit API.");
+ throw new \Exception(<<<MSG
+Empty reply calling project.query at $this->instanceName Conduit API.
+MSG
+);
}
if (!property_exists($reply, 'data')) {
- throw new \Exception("Invalid reply calling project.query at $this->instanceName Conduit API.");
+ throw new \Exception(<<<MSG
+Invalid reply calling project.query at $this->instanceName Conduit API.
+MSG
+);
}
foreach ($reply->data as $phid => $projectInfo) {
@@ -208,7 +213,9 @@
* @return string The cache key for the current projects map
*/
private function getCacheKey () {
- return class_basename(get_class($this)) . '-' . md5($this->instanceName);
+ return class_basename(get_class($this))
+ . '-'
+ . md5($this->instanceName);
}
/**
diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php
--- a/app/Providers/EventServiceProvider.php
+++ b/app/Providers/EventServiceProvider.php
@@ -2,8 +2,10 @@
namespace Nasqueron\Notifications\Providers;
-use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
-use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
+use Illuminate\{
+ Contracts\Events\Dispatcher as DispatcherContract,
+ Foundation\Support\Providers\EventServiceProvider as ServiceProvider
+};
use Config;
diff --git a/app/Providers/ReportServiceProvider.php b/app/Providers/ReportServiceProvider.php
--- a/app/Providers/ReportServiceProvider.php
+++ b/app/Providers/ReportServiceProvider.php
@@ -18,18 +18,18 @@
public function register() {
$this->app->singleton('report', function (Application $app) {
$report = new ActionsReport();
- static::listenToActionsForReport($report, $app->make('events'));
+ static::listenToActionsForReport(
+ $report,
+ $app->make('events')
+ );
return $report;
});
}
- /**
- * Listen to actions fired by the application to add to the report
- *
- * @param \Nasqueron\Notifications\Actions\ActionsReport $report The report to add actions to
- * @param \Illuminate\Contracts\Events\Dispatcher $events The application events dispatcher
- */
- public static function listenToActionsForReport (ActionsReport $report, Dispatcher $events) {
+ public static function listenToActionsForReport (
+ ActionsReport $report,
+ Dispatcher $events
+ ) {
$events->listen(
'Nasqueron\Notifications\Events\ReportEvent',
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
@@ -2,8 +2,10 @@
namespace Nasqueron\Notifications\Providers;
-use Illuminate\Routing\Router;
-use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
+use Illuminate\{
+ Routing\Router,
+ Foundation\Support\Providers\RouteServiceProvider as ServiceProvider
+};
class RouteServiceProvider extends ServiceProvider {
diff --git a/tests/Console/Commands/ConfigShowTest.php b/tests/Console/Commands/ConfigShowTest.php
--- a/tests/Console/Commands/ConfigShowTest.php
+++ b/tests/Console/Commands/ConfigShowTest.php
@@ -66,7 +66,9 @@
}
protected function mockProjectsMap () {
- $mock = Mockery::mock('Nasqueron\Notifications\Phabricator\ProjectsMap');
+ $mock = Mockery::mock(
+ 'Nasqueron\Notifications\Phabricator\ProjectsMap'
+ );
$this->app->instance('phabricator-projectsmap', $mock);
return $mock;
diff --git a/tests/Console/Commands/NotificationsPayloadTest.php b/tests/Console/Commands/NotificationsPayloadTest.php
--- a/tests/Console/Commands/NotificationsPayloadTest.php
+++ b/tests/Console/Commands/NotificationsPayloadTest.php
@@ -9,7 +9,7 @@
/**
* @var string
*/
- protected $class = 'Nasqueron\Notifications\Console\Commands\NotificationsPayload';
+ protected $class = NotificationsPayload::class;
public function testRegularExecute () {
$path = __DIR__ . '/../../data/payloads/DockerHubPushPayload.json';
diff --git a/tests/Console/Commands/PhabricatorProjectsMapTest.php b/tests/Console/Commands/PhabricatorProjectsMapTest.php
--- a/tests/Console/Commands/PhabricatorProjectsMapTest.php
+++ b/tests/Console/Commands/PhabricatorProjectsMapTest.php
@@ -3,13 +3,14 @@
namespace Nasqueron\Notifications\Tests\Console\Commands;
use Nasqueron\Notifications\Config\Services\Service;
+use Nasqueron\Notifications\Console\Commands\PhabricatorProjectsMap;
class PhabricatorProjectsMapTest extends TestCase {
/**
* @var string
*/
- protected $class = 'Nasqueron\Notifications\Console\Commands\PhabricatorProjectsMap';
+ protected $class = PhabricatorProjectsMap::class;
public function setUp () {
parent::setUp();
diff --git a/tests/Console/KernelTest.php b/tests/Console/KernelTest.php
--- a/tests/Console/KernelTest.php
+++ b/tests/Console/KernelTest.php
@@ -89,7 +89,11 @@
* @param array $haystack The array where to find
* @param string $message The test message
*/
- public static function assertArrayContainsInstanceOf ($expectedType, $haystack, $message = '') {
+ public static function assertArrayContainsInstanceOf (
+ $expectedType,
+ $haystack,
+ $message = ''
+ ) {
self::assertThat(
self::arrayContainsInstanceOf($expectedType, $haystack),
self::isTrue(),
@@ -105,7 +109,10 @@
* @param array $haystack The array where to find
* @return bool
*/
- protected static function arrayContainsInstanceOf ($expectedType, $haystack) {
+ protected static function arrayContainsInstanceOf (
+ $expectedType,
+ $haystack
+ ) {
foreach ($haystack as $item) {
if ($item instanceof $expectedType) {
return true;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 23:35 (21 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2249896
Default Alt Text
D1545.id.diff (33 KB)
Attached To
Mode
D1545: Ensure lines are at most 80 characters
Attached
Detach File
Event Timeline
Log In to Comment