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

Nette 2 vs. 3 #88

Open
slepic opened this issue Dec 4, 2019 · 1 comment
Open

Nette 2 vs. 3 #88

slepic opened this issue Dec 4, 2019 · 1 comment

Comments

@slepic
Copy link

slepic commented Dec 4, 2019

Hi there,

I just wanted to ask what is the reason for this:

"nette/di": "~2.4.10 || ~3.0",
"nette/caching": "~3.0",
"nette/http": "~2.4.7 || ~3.0",
"nette/utils": "~2.5 || ~3.0",

I mean why is nette/caching required in 3.0 while the others still allow 2.4/5?

We have a project with nette 2.4 (and still quite some work before we can move to 3.0).
nette/database is on 2.4.8 which requires nette/caching ^2.2 which is then a conflict.

So my question is: Is nette/caching really needed in 3.0 or would ^2.4 be also acceptable? If it could work with 2.4, I would like to ask to change the composer.json accordingly.

As a side note, I want to point out the difference between ~ and ^ in the versioning syntax and suggest that ^ is preferred. I think we were actually having this discussion in some other kdyby package issue already...

Just to provide a bigger picture. This conflict is preventing me right now from upgrading PHP to 7.4 prior to upgrading nette to 3.0. And i believe if nette/caching was required as ^2.4 || ^3.0 I could then upgrade PHP before nette. Question is whether kdyby/redis 5.0 can actualy work with nette/caching ^2.4?

If you have no idea about the reasoning, I am willing to try it out on my own, but I'd first like to get some insight from you, guys.

Thanks in advance.

@Spamercz
Copy link
Member

Spamercz commented Dec 5, 2019

Hi, thanks for great question.

We were in similiar position and wanted to give you option to upgrade packages as you can, one by one. That is why we left compatibility with 2.4, where possible.

But with Nette/Caching this was not that case. Difference is with types in 3.0. When we upgraded to Nette/Caching 3.0 we had to change signature of methods to comply with Nette.

For example this method https://github.com/Kdyby/Redis/blob/master/src/Kdyby/Redis/RedisStorage.php#L176
Has to have same typed arguments and return type as this Nette interaface.
https://github.com/nette/caching/blob/master/src/Caching/IStorage.php#L33
When this change was implemented, RedisStorage wasn't compatible with Nette/Caching 2.4.

To resolve this you would have to make new RedisStorage implementation just for 2.4 with different types and implement this on your project. And this overhead just wasnt worth it.

To side note ~ can be more strict with minor versions, if needed. And in lot of cases it was better solution. But I am not strictly for this, if you know about package where ^ can be applied I dont have problem if you send PR.

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

No branches or pull requests

2 participants