Skip to content

Commit 735263f

Browse files
[7.0] Remove remaining deprecated code paths
1 parent 40c7bb5 commit 735263f

File tree

3 files changed

+5
-35
lines changed

3 files changed

+5
-35
lines changed

Exception/MissingMandatoryParametersException.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,11 @@ class MissingMandatoryParametersException extends \InvalidArgumentException impl
2626
* @param string[] $missingParameters
2727
* @param int $code
2828
*/
29-
public function __construct(string $routeName = '', $missingParameters = null, $code = 0, \Throwable $previous = null)
29+
public function __construct(string $routeName = '', array $missingParameters = [], int $code = 0, \Throwable $previous = null)
3030
{
31-
if (\is_array($missingParameters)) {
32-
$this->routeName = $routeName;
33-
$this->missingParameters = $missingParameters;
34-
$message = sprintf('Some mandatory parameters are missing ("%s") to generate a URL for route "%s".', implode('", "', $missingParameters), $routeName);
35-
} else {
36-
trigger_deprecation('symfony/routing', '6.1', 'Construction of "%s" with an exception message is deprecated, provide the route name and an array of missing parameters instead.', __CLASS__);
37-
$message = $routeName;
38-
$previous = $code instanceof \Throwable ? $code : null;
39-
$code = (int) $missingParameters;
40-
}
31+
$this->routeName = $routeName;
32+
$this->missingParameters = $missingParameters;
33+
$message = sprintf('Some mandatory parameters are missing ("%s") to generate a URL for route "%s".', implode('", "', $missingParameters), $routeName);
4134

4235
parent::__construct($message, $code, $previous);
4336
}

Tests/Generator/UrlGeneratorTest.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -321,29 +321,6 @@ public function testGenerateWithInvalidLocale()
321321
$generator->generate($name);
322322
}
323323

324-
/**
325-
* @group legacy
326-
*/
327-
public function testLegacyThrowingMissingMandatoryParameters()
328-
{
329-
$this->expectDeprecation('Since symfony/routing 6.1: Construction of "Symfony\Component\Routing\Exception\MissingMandatoryParametersException" with an exception message is deprecated, provide the route name and an array of missing parameters instead.');
330-
331-
$exception = new MissingMandatoryParametersException('expected legacy message');
332-
$this->assertSame('expected legacy message', $exception->getMessage());
333-
}
334-
335-
/**
336-
* @group legacy
337-
*/
338-
public function testLegacyThrowingMissingMandatoryParametersWithAllParameters()
339-
{
340-
$this->expectDeprecation('Since symfony/routing 6.1: Construction of "Symfony\Component\Routing\Exception\MissingMandatoryParametersException" with an exception message is deprecated, provide the route name and an array of missing parameters instead.');
341-
342-
$exception = new MissingMandatoryParametersException('expected legacy message', 256, new \Exception());
343-
$this->assertSame('expected legacy message', $exception->getMessage());
344-
$this->assertInstanceOf(\Exception::class, $exception->getPrevious());
345-
}
346-
347324
public function testGenerateForRouteWithoutMandatoryParameter()
348325
{
349326
$this->expectException(MissingMandatoryParametersException::class);

Tests/RouteCompilerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public static function provideCompileData()
186186
/**
187187
* @dataProvider provideCompileImplicitUtf8Data
188188
*/
189-
public function testCompileImplicitUtf8Data($name, $arguments, $prefix, $regex, $variables, $tokens, $deprecationType)
189+
public function testCompileImplicitUtf8Data($name, $arguments, $prefix, $regex, $variables, $tokens)
190190
{
191191
$this->expectException(\LogicException::class);
192192
$r = new \ReflectionClass(Route::class);

0 commit comments

Comments
 (0)