Skip to content

Commit

Permalink
chore: 5.x remove passing indexed array
Browse files Browse the repository at this point in the history
  • Loading branch information
DjordyKoert committed Nov 12, 2024
1 parent 6db970a commit 50ab5f7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 35 deletions.
4 changes: 3 additions & 1 deletion UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ This parameter was deprecated since `4.25.2`

## BC BREAK: Removed `Nelmio\ApiDocBundle\Exception\UndocumentedArrayItemsException`

## BC BREAK: Changed type of parameter `$propertyDescriber` in `Nelmio\ApiDocBundle\ModelDescriber\ObjectModelDescriber::__construct()` from `PropertyDescriberInterface|PropertyDescriberInterface[]` to `PropertyDescriberInterface`
## BC BREAK: Changed type of parameter `$propertyDescriber` in `Nelmio\ApiDocBundle\ModelDescriber\ObjectModelDescriber::__construct()` from `PropertyDescriberInterface|PropertyDescriberInterface[]` to `PropertyDescriberInterface`

## BC BREAK: Removed passing an indexed array with a collection of path patterns as argument 1 for `Nelmio\ApiDocBundle\Routing\FilteredRouteCollectionBuilder::__construct()`
7 changes: 0 additions & 7 deletions src/Routing/FilteredRouteCollectionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ public function __construct(
->setAllowedTypes('disable_default_routes', 'boolean')
;

if (array_key_exists(0, $options)) {
trigger_deprecation('nelmio/api-doc-bundle', '3.2', 'Passing an indexed array with a collection of path patterns as argument 1 for `%s()` is deprecated since 3.2.0, expected structure is an array containing parameterized options.', __METHOD__);

$normalizedOptions = ['path_patterns' => $options];
$options = $normalizedOptions;
}

$this->controllerReflector = $controllerReflector;
$this->area = $area;
$this->options = $resolver->resolve($options);
Expand Down
27 changes: 0 additions & 27 deletions tests/Routing/FilteredRouteCollectionBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,33 +57,6 @@ public function testFilter(): void
self::assertCount(4, $filteredRoutes);
}

/**
* @group legacy
*
* @expectedDeprecation Passing an indexed array with a collection of path patterns as argument 1 for `Nelmio\ApiDocBundle\Routing\FilteredRouteCollectionBuilder::__construct()` is deprecated since 3.2.0, expected structure is an array containing parameterized options.
*/
public function testFilterWithDeprecatedArgument(): void
{
$pathPattern = [
'^/api/foo',
'^/api/bar',
];

$routes = new RouteCollection();
foreach ($this->getRoutes() as $name => $route) {
$routes->add($name, $route);
}

$routeBuilder = new FilteredRouteCollectionBuilder(
$this->createControllerReflector(),
'areaName',
$pathPattern
);
$filteredRoutes = $routeBuilder->filter($routes);

self::assertCount(5, $filteredRoutes);
}

/**
* @param array<string, mixed> $options
*/
Expand Down

0 comments on commit 50ab5f7

Please sign in to comment.