Greetings PHP-FIG,

>From my understanding this project is to add parameter and return types to 
some of the interfaces defined in PSRs before those exists in PHP.


First, adding parameter types is the easiest and also, in my mind, the most 
important type information to add, as it is impossible to add a more 
specific type from a mixed type as it goes against LSP.
This is easy to add as it doesn't break compatibility with current 
implementations, as parameter types can be widened. 
Adding parameter types can be tagged as a version 1.1.0 because semver 
allows to upgrade dependencies in minor version. i.e. updating the PHP 
version is a dependency update.

Determining whether the change is a patch level or minor level modification 
> depends on whether you updated your dependencies in order to fix a bug or 
> introduce new functionality. I would usually expect additional code for the 
> latter instance, in which case it’s obviously a minor level increment.


See FAQ on https://semver.org/

Secondly adding return types, this cannot be done in a BC compatible way as 
having a wider (i.e contravarient) return type breaks LSP.
However, I would argue that with the imminent release of PHP 7.4 this is a 
non-issue.
Indeed PHP 7.4 comes with the feature of contravarient parameter types (i.e 
type widening) and covarient return types (i.e limiting the return type).
This means that a library will be able to add return types even though the 
PSR interface doesn't specify a return type if it decides to only support 
PHP 7.4 as a minimum version, which IMHO is bound to happen as there are a 
ton of features bundled with this release of PHP.

I hope that everyone can agree that adding parameter types in a minor 
version of the PSR spec and leaving return types alone is a better plan 
than, IMHO, the various other proposals which seem unnecessary complicated.

Best regards

George Peter Banyard

 

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to php-fig+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/e184deca-19fb-49a5-b963-9afc21dcb2de%40googlegroups.com.
              • ... Alexandru Pătrănescu
              • ... 'Edward Almasy' via PHP Framework Interoperability Group
              • ... Adrien Crivelli
              • ... Alexandru Pătrănescu
              • ... 'Alexander Makarow' via PHP Framework Interoperability Group
              • ... Alexandru Pătrănescu
              • ... Alessandro Lai
              • ... Adrien Crivelli
              • ... Alessandro Lai
              • ... Alexandru Pătrănescu
  • Re: [BYLAW] P... G. P. B.

Reply via email to