Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type errors, incorrect docblocks #395

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions src/Pusher.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class Pusher implements LoggerAwareInterface, PusherInterface
];

/**
* @var null|resource
* @var null|ClientInterface Guzzle client
*/
private $client = null; // Guzzle client
private $client = null;

/**
* Initializes a new Pusher instance with key, secret, app ID and channel.
Expand Down Expand Up @@ -136,7 +136,7 @@ public function getSettings(): array
* Log a string.
*
* @param string $msg The message to log
* @param array|\Exception $context [optional] Any extraneous information that does not fit well in a string.
* @param array $context [optional] Any extraneous information that does not fit well in a string.
* @param string $level [optional] Importance of log message, highly recommended to use Psr\Log\LogLevel::{level}
*/
private function log(string $msg, array $context = [], string $level = LogLevel::DEBUG): void
Expand Down Expand Up @@ -996,7 +996,7 @@ public function webhook(array $headers, string $body): object
try {
$decoded_json = json_decode($body, false, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException $e) {
$this->log('Unable to decrypt webhook event payload.', null, LogLevel::WARNING);
$this->log('Unable to decrypt webhook event payload.', [], LogLevel::WARNING);
throw new PusherException('Data encoding error.');
}

Expand All @@ -1006,12 +1006,12 @@ public function webhook(array $headers, string $body): object
$decryptedEvent = $this->crypto->decrypt_event($event);

if ($decryptedEvent === false) {
$this->log('Unable to decrypt webhook event payload. Wrong key? Ignoring.', null, LogLevel::WARNING);
$this->log('Unable to decrypt webhook event payload. Wrong key? Ignoring.', [], LogLevel::WARNING);
continue;
}
$decoded_events[] = $decryptedEvent;
} else {
$this->log('Got an encrypted webhook event payload, but no master key specified. Ignoring.', null, LogLevel::WARNING);
$this->log('Got an encrypted webhook event payload, but no master key specified. Ignoring.', [], LogLevel::WARNING);
}
} else {
$decoded_events[] = $event;
Expand Down Expand Up @@ -1053,7 +1053,7 @@ public function ensure_valid_signature(array $headers, string $body): void
/**
* Returns an event represented by an associative array to be used in creating events and batch_events requests
*
* @param array|string $channels A channel name or an array of channel names to publish the event on.
* @param array $channels An array of channel names to publish the event on.
* @param string $event
* @param mixed $data Event data
* @param array $params [optional]
Expand Down Expand Up @@ -1154,10 +1154,7 @@ private function make_trigger_body($channels, string $event, $data, array $param
/**
* Returns the body of a trigger batch events request serialized as string ready to be sent in a request
*
* @param array|string $channels A channel name or an array of channel names to publish the event on.
* @param string $event
* @param mixed $data Event data
* @param array $params [optional]
* @param array $batch [optional]
* @param bool $already_encoded [optional]
*
* @throws PusherException
Expand Down
Loading