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

Compatibility with newer psr libraries #87

Open
jbboehr opened this issue Apr 4, 2021 · 8 comments
Open

Compatibility with newer psr libraries #87

jbboehr opened this issue Apr 4, 2021 · 8 comments

Comments

@jbboehr
Copy link
Owner

jbboehr commented Apr 4, 2021

Currently there is a 2.0 out of psr/container and psr/link which require PHP 8.0 and are not compatible with the libraries we test against. We should review other PSR repos for newer versions develop an upgrade plan.

See #84

@jbboehr
Copy link
Owner Author

jbboehr commented Apr 4, 2021

  • simple-cache - no code changes since 1.0
  • log - no code changes since 1.0
  • http-message - no code changes since 1.0
  • container - 2.0.1 released [diff]
  • http-client - no code changes since 1.0
  • event-dispatcher - no code changes since 1.0
  • cache - 3.0.0 released [diff]
  • link - 2.0.1 released [diff]
  • http-factory - no code changes since 1.0
  • http-server-middleware - no code changes since 1.0
  • http-server-handler - no code changes since 1.0

@jbboehr
Copy link
Owner Author

jbboehr commented Apr 4, 2021

Proposal: branch master off to 1.x, new master (2.x) requires PHP 8.0 and supports the newer psr interfaces.

@erickcomp
Copy link

The PSR-11 version 2.0.0 added the bool return type to the has method of the ContainerInterface;

https://github.com/php-fig/container/releases/tag/2.0.0

Does this have any incompatibilities with current implementation?
I think a change could be made to the container interface so it matches the psr 2.0.0 and make it available for PHP 7

Thanks for your work!

@jbboehr
Copy link
Owner Author

jbboehr commented Apr 13, 2021

@erickcomp Yeah, it's super not backwards compatible for implementing libraries. I would have to have a 2.0 for PHP7 and a 3.0 for the other PSRs, was hoping to minimize the number of major versions of the repo. Especially since there isn't a good way of managing versions of the extension like you can libraries with composer.

@jbboehr
Copy link
Owner Author

jbboehr commented Apr 22, 2021

Change in plans: I will investigate shipping all major versions of each PSR simultaneously, selectable via an INI setting.

For example we will define PsrExt\Cache\v1\CacheInterface, PsrExt\Cache\v2\CacheInterface, PsrExt\Cache\v3\CacheInterface. A system INI setting psr.cache_version will decide which interface is aliased to Psr\Cache\CacheInterface. Perhaps we can have options "" (off) v1 v2 v3 or maybe I'll just make it an integer [0, 3].

In v2.0 the default will still be v1 of each of the PSRs. The class entries exported in the headers as they are now will remain and will point to the aliased class. We will also export class entries for each version in their own headers.

Thoughts and feedback appreciated!

@erickcomp
Copy link

Change in plans: I will investigate shipping all major versions of each PSR simultaneously, selectable via an INI setting.

For example we will define PsrExt\Cache\v1\CacheInterface, PsrExt\Cache\v2\CacheInterface, PsrExt\Cache\v3\CacheInterface. A system INI setting psr.cache_version will decide which interface is aliased to Psr\Cache\CacheInterface. Perhaps we can have options "" (off) v1 v2 v3 or maybe I'll just make it an integer [0, 3].

In v2.0 the default will still be v1 of each of the PSRs. The class entries exported in the headers as they are now will remain and will point to the aliased class. We will also export class entries for each version in their own headers.

Thoughts and feedback appreciated!

Awesome! Good for fine tuning between projects.
One thing that bugs me out is the fact that the PSR's are inconsistent among themselves. Some of them put type hints on PHPDoc, some put them in the code. They should update the PSR's to make things more consistent about coding standards.

Thank you for your efforts!

@jbboehr
Copy link
Owner Author

jbboehr commented Apr 23, 2021

One thing that bugs me out is the fact that the PSR's are inconsistent among themselves. Some of them put type hints on PHPDoc, some put them in the code.

I wasn't and am not involved in PHP-FIG, but this is most likely due to them targeting the oldest current supported version of PHP when they were authored. And they are updating them, some of them at least, which is what's causing me quite some trouble :)

@SvenRtbg
Copy link

In general, providing the PSR interfaces version zoo via an extension is impossible in a consistent way. Composer probably isn't aware that this extension is installed, so the extension will provide a different version of the interface than the software expects and is installing. Combining all PSR interfaces into one extension multiplies the problems because you have to provide all versions combined will all versions. Selecting the versions via PHP INI settings isn't really helping in case one single PHP configuration is expected to power multiple applications that require different interface versions.

And there are practical problems with class_alias() apparantly, that trigger unexpected errors like this: laminas/laminas-servicemanager#124 (comment)

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

3 participants