Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit53ce26e

Browse files
derrabusnicolas-grekas
authored andcommitted
[MonologBridge] Remove deprecated code
1 parentd131937 commit53ce26e

File tree

6 files changed

+20
-102
lines changed

6 files changed

+20
-102
lines changed

‎src/Symfony/Bridge/Monolog/CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
6.0
5+
---
6+
7+
* The`$actionLevel` constructor argument of`NotFoundActivationStrategy` has been replaced by the`$inner` one which expects an`ActivationStrategyInterface` to decorate instead
8+
* The`$actionLevel` constructor argument of`HttpCodeActivationStrategy` has been replaced by the`$inner` one which expects an`ActivationStrategyInterface` to decorate instead
9+
410
5.3
511
---
612

‎src/Symfony/Bridge/Monolog/Handler/FingersCrossed/HttpCodeActivationStrategy.php‎

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespaceSymfony\Bridge\Monolog\Handler\FingersCrossed;
1313

1414
useMonolog\Handler\FingersCrossed\ActivationStrategyInterface;
15-
useMonolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
1615
useSymfony\Component\HttpFoundation\RequestStack;
1716
useSymfony\Component\HttpKernel\Exception\HttpException;
1817

@@ -21,28 +20,17 @@
2120
*
2221
* @author Shaun Simmons <shaun@envysphere.com>
2322
* @author Pierrick Vignand <pierrick.vignand@gmail.com>
24-
*
25-
* @final
2623
*/
27-
class HttpCodeActivationStrategyextends ErrorLevelActivationStrategyimplements ActivationStrategyInterface
24+
finalclass HttpCodeActivationStrategyimplements ActivationStrategyInterface
2825
{
29-
private$inner;
30-
private$exclusions;
31-
private$requestStack;
32-
3326
/**
34-
* @param array $exclusions each exclusion must have a "code" and "urls" keys
35-
* @param ActivationStrategyInterface|int|string $inner an ActivationStrategyInterface to decorate
27+
* @param array $exclusions each exclusion must have a "code" and "urls" keys
3628
*/
37-
publicfunction__construct(RequestStack$requestStack,array$exclusions,$inner)
38-
{
39-
if (!$innerinstanceof ActivationStrategyInterface) {
40-
trigger_deprecation('symfony/monolog-bridge','5.2','Passing an actionLevel (int|string) as constructor\'s 3rd argument of "%s" is deprecated, "%s" expected.',__CLASS__, ActivationStrategyInterface::class);
41-
42-
$actionLevel =$inner;
43-
$inner =newErrorLevelActivationStrategy($actionLevel);
44-
}
45-
29+
publicfunction__construct(
30+
privateRequestStack$requestStack,
31+
privatearray$exclusions,
32+
privateActivationStrategyInterface$inner,
33+
) {
4634
foreach ($exclusionsas$exclusion) {
4735
if (!\array_key_exists('code',$exclusion)) {
4836
thrownew \LogicException('An exclusion must have a "code" key.');
@@ -51,10 +39,6 @@ public function __construct(RequestStack $requestStack, array $exclusions, $inne
5139
thrownew \LogicException('An exclusion must have a "urls" key.');
5240
}
5341
}
54-
55-
$this->inner =$inner;
56-
$this->requestStack =$requestStack;
57-
$this->exclusions =$exclusions;
5842
}
5943

6044
publicfunctionisHandlerActivated(array$record):bool

‎src/Symfony/Bridge/Monolog/Handler/FingersCrossed/NotFoundActivationStrategy.php‎

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespaceSymfony\Bridge\Monolog\Handler\FingersCrossed;
1313

1414
useMonolog\Handler\FingersCrossed\ActivationStrategyInterface;
15-
useMonolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
1615
useSymfony\Component\HttpFoundation\RequestStack;
1716
useSymfony\Component\HttpKernel\Exception\HttpException;
1817

@@ -22,29 +21,16 @@
2221
* @author Jordi Boggiano <j.boggiano@seld.be>
2322
* @author Fabien Potencier <fabien@symfony.com>
2423
* @author Pierrick Vignand <pierrick.vignand@gmail.com>
25-
*
26-
* @final
2724
*/
28-
class NotFoundActivationStrategyextends ErrorLevelActivationStrategyimplements ActivationStrategyInterface
25+
finalclass NotFoundActivationStrategyimplements ActivationStrategyInterface
2926
{
30-
private$inner;
3127
private$exclude;
32-
private$requestStack;
33-
34-
/**
35-
* @param ActivationStrategyInterface|int|string $inner an ActivationStrategyInterface to decorate
36-
*/
37-
publicfunction__construct(RequestStack$requestStack,array$excludedUrls,$inner)
38-
{
39-
if (!$innerinstanceof ActivationStrategyInterface) {
40-
trigger_deprecation('symfony/monolog-bridge','5.2','Passing an actionLevel (int|string) as constructor\'s 3rd argument of "%s" is deprecated, "%s" expected.',__CLASS__, ActivationStrategyInterface::class);
41-
42-
$actionLevel =$inner;
43-
$inner =newErrorLevelActivationStrategy($actionLevel);
44-
}
4528

46-
$this->inner =$inner;
47-
$this->requestStack =$requestStack;
29+
publicfunction__construct(
30+
privateRequestStack$requestStack,
31+
array$excludedUrls,
32+
privateActivationStrategyInterface$inner
33+
) {
4834
$this->exclude ='{('.implode('|',$excludedUrls).')}i';
4935
}
5036

‎src/Symfony/Bridge/Monolog/Tests/Handler/FingersCrossed/HttpCodeActivationStrategyTest.php‎

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -21,48 +21,6 @@
2121

2222
class HttpCodeActivationStrategyTestextends TestCase
2323
{
24-
/**
25-
* @group legacy
26-
*/
27-
publicfunctiontestExclusionsWithoutCodeLegacy()
28-
{
29-
$this->expectException(\LogicException::class);
30-
newHttpCodeActivationStrategy(newRequestStack(), [['urls' => []]], Logger::WARNING);
31-
}
32-
33-
/**
34-
* @group legacy
35-
*/
36-
publicfunctiontestExclusionsWithoutUrlsLegacy()
37-
{
38-
$this->expectException(\LogicException::class);
39-
newHttpCodeActivationStrategy(newRequestStack(), [['code' =>404]], Logger::WARNING);
40-
}
41-
42-
/**
43-
* @dataProvider isActivatedProvider
44-
*
45-
* @group legacy
46-
*/
47-
publicfunctiontestIsActivatedLegacy($url,$record,$expected)
48-
{
49-
$requestStack =newRequestStack();
50-
$requestStack->push(Request::create($url));
51-
52-
$strategy =newHttpCodeActivationStrategy(
53-
$requestStack,
54-
[
55-
['code' =>403,'urls' => []],
56-
['code' =>404,'urls' => []],
57-
['code' =>405,'urls' => []],
58-
['code' =>400,'urls' => ['^/400/a','^/400/b']],
59-
],
60-
Logger::WARNING
61-
);
62-
63-
self::assertEquals($expected,$strategy->isHandlerActivated($record));
64-
}
65-
6624
publicfunctiontestExclusionsWithoutCode()
6725
{
6826
$this->expectException(\LogicException::class);

‎src/Symfony/Bridge/Monolog/Tests/Handler/FingersCrossed/NotFoundActivationStrategyTest.php‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,6 @@
2121

2222
class NotFoundActivationStrategyTestextends TestCase
2323
{
24-
/**
25-
* @dataProvider isActivatedProvider
26-
*
27-
* @group legacy
28-
*/
29-
publicfunctiontestIsActivatedLegacy(string$url,array$record,bool$expected)
30-
{
31-
$requestStack =newRequestStack();
32-
$requestStack->push(Request::create($url));
33-
34-
$strategy =newNotFoundActivationStrategy($requestStack, ['^/foo','bar'], Logger::WARNING);
35-
36-
self::assertEquals($expected,$strategy->isHandlerActivated($record));
37-
}
38-
3924
/**
4025
* @dataProvider isActivatedProvider
4126
*/

‎src/Symfony/Bridge/Monolog/composer.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"php":">=8.0.2",
2020
"monolog/monolog":"^1.25.1|^2",
2121
"symfony/service-contracts":"^1.1|^2",
22-
"symfony/http-kernel":"^5.4|^6.0",
23-
"symfony/deprecation-contracts":"^2.1"
22+
"symfony/http-kernel":"^5.4|^6.0"
2423
},
2524
"require-dev": {
2625
"symfony/console":"^5.4|^6.0",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp