Skip to content

Add kernel.project_dir as default prefix #434

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

Merged
merged 5 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Add `kernel.project_dir` to `prefixes` default value to trim paths to the project root (#434)

## 4.0.1 (2021-01-26)

- Add missing `capture-soft-fails` option to the XSD schema for the XML config (#417)
Expand Down
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ parameters:
count: 1
path: tests/End2End/End2EndTest.php

-
message: "#^Comparison operation \"\\<\" between 50201 and 40300 is always false\\.$#"
count: 1
path: tests/End2End/End2EndTest.php

-
message: "#^Parameter \\$event of method Sentry\\\\SentryBundle\\\\Tests\\\\EventListener\\\\ErrorListenerTest\\:\\:testHandleExceptionEvent\\(\\) has invalid typehint type Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\GetResponseForExceptionEvent\\.$#"
count: 1
Expand Down
1 change: 1 addition & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->booleanNode('default_integrations')->end()
->integerNode('send_attempts')->min(0)->end()
->arrayNode('prefixes')
->defaultValue(array_merge(['%kernel.project_dir%'], array_filter(explode(\PATH_SEPARATOR, get_include_path() ?: ''))))
->scalarPrototype()->end()
->end()
->floatNode('sample_rate')
Expand Down
4 changes: 3 additions & 1 deletion tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ final class ConfigurationTest extends TestCase
{
public function testProcessConfigurationWithDefaultConfiguration(): void
{
$defaultPrefixes = array_filter(explode(\PATH_SEPARATOR, get_include_path() ?: ''));

$expectedBundleDefaultConfig = [
'register_error_listener' => true,
'options' => [
'integrations' => [],
'prefixes' => [],
'prefixes' => array_merge(['%kernel.project_dir%'], $defaultPrefixes),
'environment' => '%kernel.environment%',
'release' => PrettyVersions::getRootPackageVersion()->getPrettyVersion(),
'tags' => [],
Expand Down
2 changes: 1 addition & 1 deletion tests/End2End/End2EndTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ private function assertLastEventIdIsNull(KernelBrowser $client): void

private function skipIfMessengerIsMissing(): void
{
if (!interface_exists(MessageBusInterface::class) || Kernel::VERSION_ID < 40300) {
if (!interface_exists(MessageBusInterface::class)) {
$this->markTestSkipped('Messenger missing');
}
}
Expand Down