Skip to content

Commit

Permalink
Apply code standard fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DieterHolvoet committed Feb 17, 2021
1 parent c9e7abd commit 2c995ac
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Event/SentryBeforeBreadcrumbEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function isExcluded(): bool
return $this->excluded;
}

public function setExcluded(bool $excluded): SentryBeforeBreadcrumbEvent
public function setExcluded(bool $excluded): self
{
$this->excluded = $excluded;

Expand Down
2 changes: 1 addition & 1 deletion src/Event/SentryBeforeSendEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function isExcluded(): bool
return $this->excluded;
}

public function setExcluded(bool $excluded = true): SentryBeforeSendEvent
public function setExcluded(bool $excluded = true): self
{
$this->excluded = $excluded;

Expand Down
6 changes: 3 additions & 3 deletions src/Form/SettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function buildForm(array $form, FormStateInterface $form_state)
return parent::buildForm($form, $form_state);
}

public function submitForm(array &$form, FormStateInterface $form_state)
public function submitForm(array &$form, FormStateInterface $form_state): void
{
$this->config('wmsentry.settings')
->set('dsn', $form_state->getValue('dsn'))
Expand Down Expand Up @@ -136,14 +136,14 @@ protected function transformExcludedTags($value)
{
if (is_string($value)) {
$lines = array_map('trim', explode(PHP_EOL, $value));
return array_map(function (string $line) {
return array_map(function (string $line): array {
[$tag, $value] = array_map('trim', explode(':', $line));
return compact('tag', 'value');
}, $lines);
}

if (is_array($value)) {
$lines = array_map(function (array $line) {
$lines = array_map(function (array $line): string {
return "{$line['tag']}: {$line['value']}";
}, $value);
return implode(PHP_EOL, $lines);
Expand Down
16 changes: 8 additions & 8 deletions src/Logger/Sentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
use Drupal\wmsentry\WmsentryEvents;
use Drush\Drush;
use Psr\Log\LoggerInterface;
use function Sentry\addBreadcrumb;
use Sentry\Breadcrumb;
use function Sentry\captureEvent;
use function Sentry\captureException;
use Sentry\ClientBuilder;
use Sentry\ClientInterface;
use Sentry\Event;
Expand All @@ -29,13 +32,10 @@
use Sentry\Severity;
use Sentry\Stacktrace;
use Sentry\State\Scope;
use function Sentry\withScope;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleErrorEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use function Sentry\addBreadcrumb;
use function Sentry\captureEvent;
use function Sentry\captureException;
use function Sentry\withScope;

class Sentry implements LoggerInterface
{
Expand Down Expand Up @@ -100,7 +100,7 @@ public function onBeforeBreadcrumb(Breadcrumb $breadcrumb): ?Breadcrumb
return $beforeBreadcrumbEvent->isExcluded() ? null : $beforeBreadcrumbEvent->getBreadcrumb();
}

public function log($level, $message, array $context = [])
public function log($level, $message, array $context = []): void
{
$this->logException($level, $message, $context);
$this->logBreadcrumb($level, $message, $context);
Expand Down Expand Up @@ -259,7 +259,7 @@ function (string $className) use ($finder) {

return array_reduce(
$backtrace,
function (Stacktrace $stacktrace, array $frame) {
function (Stacktrace $stacktrace, array $frame): Stacktrace {
$file = $frame['file'] ?? '[internal]';
$line = $frame['line'] ?? 0;

Expand All @@ -286,7 +286,7 @@ protected function getUserData(array $context): array
return $data;
}

/* @var UserInterface $user */
/** @var UserInterface $user */
$user = $this->entityTypeManager->getStorage('user')->load($context['uid']);

if ($user) {
Expand All @@ -312,7 +312,7 @@ protected function isExceptionIncluded(string $type): bool
protected function normalizePaths(array $paths): array
{
return array_map(
static function (string $path) {
static function (string $path): string {
return DRUPAL_ROOT . DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR);
},
$paths
Expand Down
2 changes: 1 addition & 1 deletion wmsentry.module
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use Drupal\wmsentry\Utility\Error;
*
* @see _drupal_error_handler_real
*/
function _wmsentry_error_handler_real($error_level, $message, $filename, $line, $context = null)
function _wmsentry_error_handler_real($error_level, $message, $filename, $line, $context = null): void
{
if ($error_level & error_reporting()) {
$types = drupal_error_levels();
Expand Down

0 comments on commit 2c995ac

Please sign in to comment.