Skip to content

Commit

Permalink
feature #2163 more leftover routing deprecations (Tobion)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.x branch.

Discussion
----------

more leftover routing deprecations

Add some leftover deprecations from #2152 for #1954

Commits
-------

66f35fe more leftover routing deprecations
  • Loading branch information
xabbuh committed Apr 18, 2020
2 parents beada34 + 66f35fe commit df71215
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Controller/Annotations/NamePrefix.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@

namespace FOS\RestBundle\Controller\Annotations;

@trigger_error(sprintf('The %s\NamePrefix annotation is deprecated since FOSRestBundle 2.8.', __NAMESPACE__), E_USER_DEPRECATED);

use Doctrine\Common\Annotations\Annotation;

/**
* NamePrefix Route annotation class.
*
* @Annotation
* @Target("CLASS")
*
* @deprecated since 2.8
*/
class NamePrefix extends Annotation
{
Expand Down
4 changes: 4 additions & 0 deletions Controller/Annotations/NoRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@

namespace FOS\RestBundle\Controller\Annotations;

@trigger_error(sprintf('The %s\NoRoute annotation is deprecated since FOSRestBundle 2.8.', __NAMESPACE__), E_USER_DEPRECATED);

/**
* No Route annotation class.
*
* @Annotation
* @Target({"METHOD","CLASS"})
*
* @deprecated since 2.8
*/
class NoRoute extends Route
{
Expand Down
4 changes: 4 additions & 0 deletions Controller/Annotations/Prefix.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@

namespace FOS\RestBundle\Controller\Annotations;

@trigger_error(sprintf('The %s\Prefix annotation is deprecated since FOSRestBundle 2.8.', __NAMESPACE__), E_USER_DEPRECATED);

use Doctrine\Common\Annotations\Annotation;

/**
* Prefix Route annotation class.
*
* @Annotation
* @Target("CLASS")
*
* @deprecated since 2.8
*/
class Prefix extends Annotation
{
Expand Down
10 changes: 4 additions & 6 deletions Tests/Request/ParamReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
namespace FOS\RestBundle\Tests\Request;

use FOS\RestBundle\Controller\Annotations\ParamInterface;
use FOS\RestBundle\Controller\Annotations\NamePrefix;
use FOS\RestBundle\Controller\Annotations\View;
use FOS\RestBundle\Request\ParamReader;
use Doctrine\Common\Annotations\AnnotationReader;
use FOS\RestBundle\Tests\Fixtures\Controller\ParamsAnnotatedController;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Validator\Constraints\NotNull;

/**
* ParamReader test.
*
* @author Alexander <iam.asm89@gmail.com>
*/
class ParamReaderTest extends TestCase
Expand All @@ -47,7 +45,7 @@ protected function setUp(): void
->willReturn('bar');
$methodAnnotations[] = $bar;

$methodAnnotations[] = new NamePrefix([]);
$methodAnnotations[] = new View([]);

$annotationReader
->expects($this->any())
Expand All @@ -70,7 +68,7 @@ protected function setUp(): void
->willReturn('micz');
$classAnnotations[] = $mikz;

$classAnnotations[] = new NamePrefix([]);
$classAnnotations[] = new View([]);

$annotationReader
->expects($this->any())
Expand All @@ -85,7 +83,7 @@ protected function setUp(): void
*/
public function testReadsOnlyParamAnnotations()
{
$annotations = $this->paramReader->read(new \ReflectionClass(__CLASS__), 'setup');
$annotations = $this->paramReader->read(new \ReflectionClass(__CLASS__), 'setUp');

$this->assertCount(4, $annotations);

Expand Down
3 changes: 3 additions & 0 deletions UPGRADING-2.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Upgrading From 2.7 To 2.8

* The following classes are marked as `deprecated`, they will be removed in 3.0:

* `FOS\RestBundle\Controller\Annotations\NamePrefix`
* `FOS\RestBundle\Controller\Annotations\NoRoute`
* `FOS\RestBundle\Controller\Annotations\Prefix`
* `FOS\RestBundle\Controller\Annotations\RouteResource`
* `FOS\RestBundle\Controller\Annotations\Version`
* `FOS\RestBundle\Routing\Loader\DirectoryRouteLoader`
Expand Down

0 comments on commit df71215

Please sign in to comment.