Skip to content

Commit

Permalink
Fix "Deprecated: Non-static method should not be called statically" (#16
Browse files Browse the repository at this point in the history
)

* fix callable notation. change to \Class:method
  • Loading branch information
TypicalFence authored and juliangut committed Nov 9, 2018
1 parent 0726a07 commit de57d5e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Mapping/Driver/AnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ protected function getRouteMetadata(
->setMiddleware($annotation->getMiddleware())
->setMethods($annotation->getMethods())
->setXmlHttpRequest($annotation->isXmlHttpRequest())
->setInvokable([$class->name, $method->name])
->setInvokable($class->name . ':' . $method->name)
->setPriority($annotation->getPriority());

if ($annotation->getPattern() !== null) {
Expand Down
2 changes: 1 addition & 1 deletion src/Mapping/Driver/MappingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected function getGroupMetadata(array $mapping, GroupMetadata $parentGroup =
*
* @return RouteMetadata
*/
protected function getRouteMetadata(array $mapping, GroupMetadata $group = null): RouteMetadata
protected function getRouteMetadata($mapping, GroupMetadata $group = null): RouteMetadata
{
$route = (new RouteMetadata())
->setMethods($this->getMethods($mapping))
Expand Down
8 changes: 4 additions & 4 deletions tests/Routing/Mapping/Driver/AnnotationDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function testRoutes()
self::assertEquals('four', $route->getName());
self::assertEquals(['GET'], $route->getMethods());
self::assertEquals(
['Jgut\Slim\Routing\Tests\Files\Annotation\Valid\DependentRoute', 'actionFour'],
'Jgut\Slim\Routing\Tests\Files\Annotation\Valid\DependentRoute:actionFour',
$route->getInvokable()
);
self::assertEquals(0, $route->getPriority());
Expand All @@ -147,7 +147,7 @@ public function testRoutes()
self::assertNull($route->getName());
self::assertEquals(['GET'], $route->getMethods());
self::assertEquals(
['Jgut\Slim\Routing\Tests\Files\Annotation\Valid\GroupedRoute', 'actionTwo'],
'Jgut\Slim\Routing\Tests\Files\Annotation\Valid\GroupedRoute:actionTwo',
$route->getInvokable()
);
self::assertEquals(0, $route->getPriority());
Expand All @@ -160,7 +160,7 @@ public function testRoutes()
self::assertNull($route->getName());
self::assertEquals(['GET'], $route->getMethods());
self::assertEquals(
['Jgut\Slim\Routing\Tests\Files\Annotation\Valid\GroupedRoute', 'actionThree'],
'Jgut\Slim\Routing\Tests\Files\Annotation\Valid\GroupedRoute:actionThree',
$route->getInvokable()
);
self::assertEquals(0, $route->getPriority());
Expand All @@ -173,7 +173,7 @@ public function testRoutes()
self::assertEquals('one', $route->getName());
self::assertEquals(['GET', 'POST'], $route->getMethods());
self::assertEquals(
['Jgut\Slim\Routing\Tests\Files\Annotation\Valid\SingleRoute', 'actionOne'],
'Jgut\Slim\Routing\Tests\Files\Annotation\Valid\SingleRoute:actionOne',
$route->getInvokable()
);
self::assertEquals(-10, $route->getPriority());
Expand Down
16 changes: 8 additions & 8 deletions tests/Routing/Mapping/Driver/MappingTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function testRoutes()
'methods' => ['GET'],
'pattern' => '/four',
'middleware' => ['fourMiddleware'],
'invokable' => ['FourRoute', 'actionFour'],
'invokable' => 'FourRoute' . ':' . 'actionFour',
],
],
],
Expand All @@ -183,15 +183,15 @@ public function testRoutes()
'methods' => ['GET'],
'pattern' => '/two/{id}',
'middleware' => ['twoMiddleware'],
'invokable' => ['TwoRoute', 'actionTwo'],
'invokable' => 'TwoRoute' . ':' . 'actionTwo',
],
[
'methods' => ['GET'],
'pattern' => '/three/{id}',
'placeholders' => [
'id' => '\d+',
],
'invokable' => ['ThreeRoute', 'actionThree'],
'invokable' => 'ThreeRoute' . ':' . 'actionThree',
],
],
],
Expand All @@ -208,7 +208,7 @@ public function testRoutes()
'id' => 'int',
],
'middleware' => ['oneMiddleware'],
'invokable' => ['OneRoute', 'actionOne'],
'invokable' => 'OneRoute' . ':' . 'actionOne',
],
]));
/* @var \Jgut\Mapping\Driver\AbstractMappingDriver $driver */
Expand All @@ -220,7 +220,7 @@ public function testRoutes()
self::assertEquals('four', $route->getName());
self::assertEquals(['GET'], $route->getMethods());
self::assertEquals(0, $route->getPriority());
self::assertEquals(['FourRoute', 'actionFour'], $route->getInvokable());
self::assertEquals('FourRoute' . ':' . 'actionFour', $route->getInvokable());
self::assertEquals('four', $route->getPattern());
self::assertEquals([], $route->getPlaceholders());
self::assertEquals(['fourMiddleware'], $route->getMiddleware());
Expand All @@ -230,7 +230,7 @@ public function testRoutes()
self::assertNull($route->getName());
self::assertEquals(['GET'], $route->getMethods());
self::assertEquals(0, $route->getPriority());
self::assertEquals(['TwoRoute', 'actionTwo'], $route->getInvokable());
self::assertEquals('TwoRoute' . ':' . 'actionTwo', $route->getInvokable());
self::assertEquals('two/{id}', $route->getPattern());
self::assertEquals([], $route->getPlaceholders());
self::assertEquals(['twoMiddleware'], $route->getMiddleware());
Expand All @@ -239,7 +239,7 @@ public function testRoutes()
self::assertInstanceOf(RouteMetadata::class, $route);
self::assertEquals('', $route->getName());
self::assertEquals(['GET'], $route->getMethods());
self::assertEquals(['ThreeRoute', 'actionThree'], $route->getInvokable());
self::assertEquals('ThreeRoute' . ':' . 'actionThree', $route->getInvokable());
self::assertEquals(0, $route->getPriority());
self::assertEquals('three/{id}', $route->getPattern());
self::assertEquals(['id' => '\d+'], $route->getPlaceholders());
Expand All @@ -250,7 +250,7 @@ public function testRoutes()
self::assertEquals('one', $route->getName());
self::assertEquals(['GET', 'POST'], $route->getMethods());
self::assertEquals(-10, $route->getPriority());
self::assertEquals(['OneRoute', 'actionOne'], $route->getInvokable());
self::assertEquals('OneRoute' . ':' . 'actionOne', $route->getInvokable());
self::assertEquals('one/{id}', $route->getPattern());
self::assertEquals(['id' => 'numeric'], $route->getPlaceholders());
self::assertEquals(['oneMiddleware'], $route->getMiddleware());
Expand Down

0 comments on commit de57d5e

Please sign in to comment.