Skip to content

Commit ce759bb

Browse files
authored
Update for symfony 5 (#20)
1 parent 2b35301 commit ce759bb

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">=5.3.9",
17-
"symfony/framework-bundle": "~2.3||3.*||4.*",
16+
"php": ">=7.0",
17+
"symfony/framework-bundle": "~2.3||3.*||4.*||5.*||6.*",
1818
"caxy/php-htmldiff": "~0.1"
1919
},
2020
"require-dev": {

src/DependencyInjection/Configuration.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ class Configuration implements ConfigurationInterface
1616
/**
1717
* {@inheritDoc}
1818
*/
19-
public function getConfigTreeBuilder()
19+
public function getConfigTreeBuilder(): TreeBuilder
2020
{
21-
$treeBuilder = new TreeBuilder();
22-
$rootNode = $treeBuilder->root('caxy_html_diff');
21+
$treeBuilder = new TreeBuilder('caxy_html_diff');
22+
$rootNode = $treeBuilder->getRootNode();
2323

2424
$rootNode
2525
->children()
@@ -52,10 +52,10 @@ public function getConfigTreeBuilder()
5252
*
5353
* @return ArrayNodeDefinition
5454
*/
55-
private function getDoctrineCacheDriverNode($name)
55+
private function getDoctrineCacheDriverNode($name): ArrayNodeDefinition
5656
{
57-
$treeBuilder = new TreeBuilder();
58-
$node = $treeBuilder->root($name);
57+
$treeBuilder = new TreeBuilder($name);
58+
$node = $treeBuilder->getRootNode();
5959
$node
6060
->canBeEnabled()
6161
->beforeNormalization()

src/Twig/HtmlDiffExtension.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Caxy\HtmlDiffBundle\Service\HtmlDiffService;
66

7-
class HtmlDiffExtension extends \Twig_Extension
7+
class HtmlDiffExtension extends \Twig\Extension\AbstractExtension
88
{
99
protected $container;
1010

@@ -15,10 +15,10 @@ public function __construct(HtmlDiffService $htmlDiff)
1515
$this->htmlDiff = $htmlDiff;
1616
}
1717

18-
public function getFunctions()
18+
public function getFunctions(): array
1919
{
2020
return array(
21-
new \Twig_SimpleFunction('htmldiff', array($this, 'htmlDiff'), array('is_safe' => array('html'))),
21+
new \Twig\TwigFunction('htmldiff', array($this, 'htmlDiff'), array('is_safe' => array('html'))),
2222
);
2323
}
2424

@@ -27,8 +27,8 @@ public function htmlDiff($a, $b)
2727
return $this->htmlDiff->diff((string) $a, (string) $b);
2828
}
2929

30-
public function getName()
30+
public function getName(): string
3131
{
3232
return 'caxy_htmldiff_extension';
3333
}
34-
}
34+
}

0 commit comments

Comments
 (0)