Skip to content

Commit

Permalink
Merge branch 'master' into issue-templates
Browse files Browse the repository at this point in the history
  • Loading branch information
cleptric authored Dec 11, 2024
2 parents 21017eb + 9897bdb commit 1f108ea
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 6 deletions.
22 changes: 21 additions & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ parameters:
count: 2
path: src/DependencyInjection/SentryExtension.php

-
message: "#^Cannot access offset 'logger' on mixed\\.$#"
count: 1
path: src/DependencyInjection/SentryExtension.php

-
message: "#^Cannot access offset 'traces_sampler' on mixed\\.$#"
count: 1
Expand All @@ -92,7 +97,7 @@ parameters:

-
message: "#^Parameter \\#1 \\$id of class Symfony\\\\Component\\\\DependencyInjection\\\\Reference constructor expects string, mixed given\\.$#"
count: 9
count: 10
path: src/DependencyInjection/SentryExtension.php

-
Expand Down Expand Up @@ -165,6 +170,21 @@ parameters:
count: 1
path: src/EventListener/LoginListener.php

-
message: "#^Instanceof between Throwable and Symfony\\\\Component\\\\Messenger\\\\Exception\\\\DelayedMessageHandlingException will always evaluate to false\\.$#"
count: 1
path: src/EventListener/MessengerListener.php

-
message: "#^Instanceof between Throwable and Symfony\\\\Component\\\\Messenger\\\\Exception\\\\HandlerFailedException will always evaluate to false\\.$#"
count: 1
path: src/EventListener/MessengerListener.php

-
message: "#^Result of && is always false\\.$#"
count: 2
path: src/EventListener/MessengerListener.php

-
message: "#^Call to an undefined method Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\KernelEvent\\:\\:isMasterRequest\\(\\)\\.$#"
count: 1
Expand Down
4 changes: 4 additions & 0 deletions src/DependencyInjection/SentryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ private function registerConfiguration(ContainerBuilder $container, array $confi
});
}

if (isset($options['logger'])) {
$options['logger'] = new Reference($options['logger']);
}

if (isset($options['traces_sampler'])) {
$options['traces_sampler'] = new Reference($options['traces_sampler']);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/DependencyInjection/Fixtures/php/full.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'attach_metric_code_locations' => true,
'context_lines' => 0,
'environment' => 'development',
'logger' => 'php',
'logger' => Sentry\Logger\DebugStdOutLogger::class,
'spotlight' => true,
'spotlight_url' => 'http://localhost:8969',
'release' => '4.0.x-dev',
Expand Down
2 changes: 1 addition & 1 deletion tests/DependencyInjection/Fixtures/xml/full.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
attach-metric-code-locations="true"
context-lines="0"
environment="development"
logger="php"
logger="Sentry\Logger\DebugStdOutLogger"
spotlight="true"
spotlight-url="http://localhost:8969"
release="4.0.x-dev"
Expand Down
2 changes: 1 addition & 1 deletion tests/DependencyInjection/Fixtures/yml/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sentry:
attach_metric_code_locations: true
context_lines: 0
environment: development
logger: php
logger: Sentry\Logger\DebugStdOutLogger
spotlight: true
spotlight_url: http://localhost:8969
release: 4.0.x-dev
Expand Down
3 changes: 2 additions & 1 deletion tests/DependencyInjection/SentryExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use Sentry\ClientInterface;
use Sentry\Logger\DebugStdOutLogger;
use Sentry\Options;
use Sentry\SentryBundle\DependencyInjection\SentryExtension;
use Sentry\SentryBundle\EventListener\ConsoleListener;
Expand Down Expand Up @@ -211,7 +212,7 @@ public function testClientIsCreatedFromOptions(): void
'attach_metric_code_locations' => true,
'context_lines' => 0,
'environment' => 'development',
'logger' => 'php',
'logger' => new Reference(DebugStdOutLogger::class),
'spotlight' => true,
'spotlight_url' => 'http://localhost:8969',
'release' => '4.0.x-dev',
Expand Down
11 changes: 10 additions & 1 deletion tests/EventListener/Fixtures/UserWithIdentifierStub.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,29 @@
final class UserWithIdentifierStub implements UserInterface
{
/**
* @var string
* @var non-empty-string
*/
private $username;

/**
* @param non-empty-string $username
*/
public function __construct(string $username = 'foo_user')
{
$this->username = $username;
}

/**
* @return non-empty-string
*/
public function getUserIdentifier(): string
{
return $this->getUsername();
}

/**
* @return non-empty-string
*/
public function getUsername(): string
{
return $this->username;
Expand Down

0 comments on commit 1f108ea

Please sign in to comment.