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(tests): deprecate warning in Symfony 5.4 for setAuthenticated #847

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f8fc4de
fix(tests): deprecate warning in Symfony 5.4 for setAuthenticated
shakaran May 27, 2024
abc5d8c
fix: error with phpstan with Parameter #2 of function preg_replace_c…
shakaran Jun 3, 2024
ac6b793
fix: since PHPUnit 8 filters config changed by whitelist/blacklist
shakaran Jun 3, 2024
26af81b
fix: use global namespace for is_string
shakaran Jun 3, 2024
98b1b4c
fix: handle non scalar values
shakaran Jun 3, 2024
de9b825
fix: remove warning configuration option is deprecated
shakaran Jun 3, 2024
8be62f0
fix: php-cs-fixer warnings
shakaran Jun 3, 2024
ef568e5
feat: add load of config file for 5.4 deprecations
shakaran Jun 3, 2024
f356da0
fix: allow equals to 5.4 version for authenticated
shakaran Jun 3, 2024
2a0b841
fix: adjust kernel version to only 5.4 load
shakaran Jun 3, 2024
06cca8c
fix: improve condition check 5.4 to 6.0
shakaran Jun 3, 2024
7673f2b
fix: authenticathed for non guard versions of symfony
shakaran Jun 3, 2024
0d9bc2f
fix: remove strong typed params for PHP 7.x version
shakaran Jun 3, 2024
9299180
fix: wrong condition inverse
shakaran Jun 3, 2024
f8e50a8
fix: phpstan warning for authentication
shakaran Jun 3, 2024
7533b6f
fix: implement a legacy version token stub for Symfony 4.x
shakaran Jun 3, 2024
f9e70f0
fix: php-cs-fixer warnings
shakaran Jun 3, 2024
1331c1a
fix: phpstan ignore lines
shakaran Jun 3, 2024
69a7df9
fix: more phpstan warnings and errors
shakaran Jun 3, 2024
7057406
fix: typo php-cs-fixer
shakaran Jun 3, 2024
f8e95f2
fix: improve pcov test with invalid values
shakaran Jun 3, 2024
8e85a9c
fix: check for symfony/messenger class present for autoload config
shakaran Jun 3, 2024
cdc72c9
fix: typo blank line php-cs-fixer
shakaran Jun 3, 2024
91f0809
Merge branch 'master' into fix/deprecated-warning-authenticated
cleptric Jun 4, 2024
832bfe5
fix: generate new baseline
shakaran Jun 4, 2024
b5f07ac
Revert "fix: generate new baseline"
shakaran Jun 4, 2024
3af4261
Merge branch 'master' into fix/deprecated-warning-authenticated
shakaran Jun 4, 2024
d56b138
Merge branch 'master' into fix/deprecated-warning-authenticated
stayallive Jun 4, 2024
51af755
fix: add more ignore error to phpstan
shakaran Jun 4, 2024
7c72979
fix: add ignore errors to baseline
shakaran Jun 4, 2024
338c16a
fix: get rid of report unmatched ignored errors by default
shakaran Jun 4, 2024
eecd3b2
fix: update removing from baseline
shakaran Jun 4, 2024
3938fd5
fix: remove more unmatched
shakaran Jun 4, 2024
dbe9792
fix: remove last one unmatched
shakaran Jun 4, 2024
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
15 changes: 0 additions & 15 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ parameters:
count: 2
path: src/DependencyInjection/SentryExtension.php

-
message: "#^Parameter \\#2 \\$callback of function preg_replace_callback expects callable\\(array\\<int\\|string, string\\>\\)\\: string, Closure\\(array\\)\\: mixed given\\.$#"
count: 1
path: src/ErrorTypesParser.php

-
message: "#^Call to an undefined method Symfony\\\\Component\\\\HttpKernel\\\\Event\\\\KernelEvent\\:\\:isMasterRequest\\(\\)\\.$#"
count: 1
Expand Down Expand Up @@ -300,11 +295,6 @@ parameters:
count: 1
path: tests/EventListener/LoginListenerTest.php

-
message: "#^Parameter \\#1 \\$user of method Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\AbstractToken\\:\\:setUser\\(\\) expects Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface, string\\|Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface given\\.$#"
count: 1
path: tests/EventListener/LoginListenerTest.php

-
message: "#^Parameter \\#2 \\$firewallName of class Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\SwitchUserToken constructor expects string, null given\\.$#"
count: 1
Expand All @@ -320,11 +310,6 @@ parameters:
count: 1
path: tests/EventListener/LoginListenerTest.php

-
message: "#^Parameter \\#5 \\$originatedFromUri of class Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\SwitchUserToken constructor expects string\\|null, Sentry\\\\SentryBundle\\\\Tests\\\\EventListener\\\\AuthenticatedTokenStub given\\.$#"
count: 1
path: tests/EventListener/LoginListenerTest.php

-
message: "#^Access to undefined constant Symfony\\\\Component\\\\HttpKernel\\\\HttpKernelInterface\\:\\:MASTER_REQUEST\\.$#"
count: 6
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ includes:
- phpstan-baseline.neon

parameters:
reportUnmatchedIgnoredErrors: true
level: 9
paths:
- src
Expand Down
12 changes: 3 additions & 9 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,11 @@
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<file>src/aliases.php</file>
</exclude>
</coverage>

<filter>
<whitelist>
<directory suffix=".php">src</directory>
<exclude>
<file>src/aliases.php</file>
</exclude>
</whitelist>
</filter>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
Expand Down
16 changes: 15 additions & 1 deletion src/ErrorTypesParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,21 @@ private static function convertErrorConstants(string $value): string
{
$output = preg_replace_callback('/(E_[A-Z_]+)/', static function (array $matches) {
if (\defined($matches[1])) {
return \constant($matches[1]);
$constant = \constant($matches[1]);

if (\is_string($constant)) {
return $constant;
} elseif (\is_int($constant)) {
return (string) $constant;
} elseif (\is_array($constant)) {
return implode(' | ', array_map(static function ($value) {
return \is_string($value) ? $value : (string) $value;
}, $constant));
} elseif (\is_object($constant)) {
return \get_class($constant);
} else { // Non-scalar values
return '';
}
}

return $matches[0];
Expand Down
7 changes: 7 additions & 0 deletions tests/End2End/App/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
$loader->load(__DIR__ . '/deprecations_for_5.yml');
}

if (self::VERSION_ID >= 50400 && self::VERSION_ID <= 60000) {
// Check if class for Messenger is present (component symfony/messenger is not mandatory)
if (interface_exists(MessageBusInterface::class)) {
$loader->load(__DIR__ . '/deprecations_for_54.yml');
}
}

if (self::VERSION_ID >= 60000) {
$loader->load(__DIR__ . '/deprecations_for_6.yml');
}
Expand Down
3 changes: 3 additions & 0 deletions tests/End2End/App/deprecations_for_54.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
framework:
messenger:
reset_on_message: true
3 changes: 3 additions & 0 deletions tests/ErrorTypesParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@ public function parseThrowsExceptionIfArgumentContainsInvalidCharactersDataProvi
yield ['('];
yield [')'];
yield ['()'];
// Non scalar values (probably misstypes, but still valid PHP code)
yield ['[8, 8192]'];
yield [\stdClass::class];
}
}
Loading
Loading