diff --git a/composer.json b/composer.json index 56fae0c..81a800c 100644 --- a/composer.json +++ b/composer.json @@ -3,14 +3,14 @@ "description": "Provides templating support for Nice PHP framework applications", "license": "MIT", "require": { - "php": ">=5.4.0", - "symfony/config": "~2.3", - "symfony/dependency-injection": "~2.3", - "symfony/templating": "~2.3" + "php": ">=8.1.0", + "symfony/config": "~6.3", + "symfony/dependency-injection": "~6.3", + "symfony/templating": "~6.3" }, "require-dev": { - "phpunit/phpunit": "~3.7", - "nice/framework": "1.0.x-dev" + "phpunit/phpunit": "~10.3", + "nice/framework": "dev-php-and-symfony-update" }, "autoload": { "psr-4": { diff --git a/src/Extension/TemplatingConfiguration.php b/src/Extension/TemplatingConfiguration.php index e005f3c..8ddabba 100644 --- a/src/Extension/TemplatingConfiguration.php +++ b/src/Extension/TemplatingConfiguration.php @@ -21,8 +21,8 @@ class TemplatingConfiguration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('templating'); + $treeBuilder = new TreeBuilder('templating'); + $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() diff --git a/src/Templating/Helper/AssetsHelper.php b/src/Templating/Helper/AssetsHelper.php index 7f7396b..36246d4 100644 --- a/src/Templating/Helper/AssetsHelper.php +++ b/src/Templating/Helper/AssetsHelper.php @@ -38,7 +38,7 @@ public function __construct(ContainerInterface $container) */ public function getUrl($path) { - if (false !== strpos($path, '://') || 0 === strpos($path, '//')) { + if (str_contains($path, '://') || str_starts_with($path, '//')) { return $path; } @@ -46,7 +46,7 @@ public function getUrl($path) return $path; } - if ('/' !== substr($path, 0, 1)) { + if (!str_starts_with($path, '/')) { $path = '/' . $path; } diff --git a/src/Templating/Helper/RouterHelper.php b/src/Templating/Helper/RouterHelper.php index ed383a1..d674d07 100644 --- a/src/Templating/Helper/RouterHelper.php +++ b/src/Templating/Helper/RouterHelper.php @@ -146,11 +146,7 @@ public function getUrl($name, array $parameters = array()) protected function getCurrentRequest() { if (!$this->request) { - if ($this->container->isScopeActive('request')) { - $this->request = $this->container->get('request'); - } else { - throw new \RuntimeException('Unable to get "request" service'); - } + $this->request = $this->container->get('request'); } return $this->request;