Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to support php 8.1 and symfony 6.3 #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/Extension/TemplatingConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/Templating/Helper/AssetsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ 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;
}

if (!$this->container->has('request')) {
return $path;
}

if ('/' !== substr($path, 0, 1)) {
if (!str_starts_with($path, '/')) {
$path = '/' . $path;
}

Expand Down
6 changes: 1 addition & 5 deletions src/Templating/Helper/RouterHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down