Skip to content

Commit 7dcd8cf

Browse files
authored
Add return type hints (#6)
This adds a few return type hints to address deprecation notices and be forwards-compatible with future Symfony versions. These changes are compatible even with PHP 7.2.
1 parent 7b61693 commit 7dcd8cf

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/JMS/ObjectRouting/Metadata/ClassMetadata.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function merge(MergeableInterface $object): void
3939
$this->routes = array_merge($this->routes, $object->routes);
4040
}
4141

42-
public function serialize()
42+
public function serialize(): string
4343
{
4444
return serialize(
4545
array(
@@ -49,7 +49,7 @@ public function serialize()
4949
);
5050
}
5151

52-
public function unserialize($str)
52+
public function unserialize($str): void
5353
{
5454
list(
5555
$this->routes,

src/JMS/ObjectRouting/Twig/RoutingExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ public function __construct(ObjectRouter $router)
1515
$this->router = $router;
1616
}
1717

18-
public function getFunctions()
18+
public function getFunctions(): array
1919
{
2020
return [
2121
new TwigFunction('object_path', [$this, 'path']),
2222
new TwigFunction('object_url', [$this, 'url']),
2323
];
2424
}
2525

26-
public function url($type, $object, array $extraParams = [])
26+
public function url($type, $object, array $extraParams = []): string
2727
{
2828
return $this->router->generate($type, $object, true, $extraParams);
2929
}
3030

31-
public function path($type, $object, array $extraParams = [])
31+
public function path($type, $object, array $extraParams = []): string
3232
{
3333
return $this->router->generate($type, $object, false, $extraParams);
3434
}

0 commit comments

Comments
 (0)