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

Question - Twig 3 Support #156

Closed
GameplayJDK opened this issue Nov 20, 2019 · 10 comments · Fixed by #158
Closed

Question - Twig 3 Support #156

GameplayJDK opened this issue Nov 20, 2019 · 10 comments · Fixed by #158

Comments

@GameplayJDK
Copy link

Hello everyone,

as twig 3.x was released, are there plans to support the new version? However, there are some deprecations in 2.x.

Had to fiddle a bit, when I tried to install twig-view into an project containing twig 3 in its lock file.

Thanks in advance

@l0gicgate
Copy link
Member

No plans yet. I'm open to it but considering we're in 3.x beta of this branch we would require a new major 4.x to use with Twig 3.

@GameplayJDK
Copy link
Author

At first glance it doesn't seem to break anything from the current 3.x branch. I'll try to use it with Twig 3 later and report back after that.

@GameplayJDK
Copy link
Author

So after checking out 3.x and changing the Twig version from ^2.8 to ^3.0, I ran the tests and as it seems it all still works out of the box. I didn't use the modified version inside a project though, just ran the tests.

diff --git a/composer.json b/composer.json
index d138a9a..99e76f8 100644
--- a/composer.json
+++ b/composer.json
@@ -21,7 +21,7 @@
         "php": "^7.1",
         "psr/http-message": "^1.0",
         "slim/slim": "^4.0",
-        "twig/twig": "^2.8"
+        "twig/twig": "^3.0"
     },
     "require-dev": {
         "phpunit/phpunit": "^7.5",

diff_tests

@GameplayJDK
Copy link
Author

I found a workaround for our project for now, but still would like to see this working out of the box without a "not-so-nice" hack.

The workaround is to alias the twig 3.0 package as 2.8 (which is required by twig-view), so it takes the new twig version for the older one and everything still works fine:

{
        "php": "^7.3",
        "slim/slim": "^4.0",
        "slim/twig-view": "^3.0.0-dev",
        "slim/psr7": "^0.6.0",
        "twig/twig": "3.0 as 2.8"
}

It does not have any impact on the functionality of this package to increase the version of twig.

Could you clarify, why a 4.x branch would be required for this rather small change? Or am I missing something here? @l0gicgate

@dennzo
Copy link

dennzo commented Nov 26, 2019

+1
I would like to use twig 3 aswell :)
It really does not seem to mess anything up in the current configuration.

@l0gicgate
Copy link
Member

l0gicgate commented Nov 26, 2019

@GameplayJDK because by requiring ^3.0 it will effectively break for everyone using 2.x versions of Twig which is what the majority of people are using at the moment.

We should instead do "twig/twig": "2 - 3" which would support >=2.0.0.0-dev <4.0.0.0-dev

@adamaveray
Copy link

Would changing the current version constraint of ^1.38|^2.7 to ^1.38|^2.7|^3.0 work? It appears that covers everything correctly.

@l0gicgate
Copy link
Member

@adamaveray I haven't tested with the 1.x version but yeah I think that should be fine! Who wants to PR this?

@GameplayJDK
Copy link
Author

I could do that, but not before monday. I won't have access to my pc before that. So if someone else is willing to do this, feel free to do so.

@adamaveray
Copy link

@GameplayJDK PR submitted! #158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants