PHP8 "static" return type #107
                
     Open
            
            
          
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Hi! I just upgraded
psr/http-messageto^2.0and my IDE started yelling at me because my library already requires a minimum of PHP 8.1 and i was already using the newstaticreturn type.Here, I'm proposing a v3.0 that requires a minimum of PHP 8.0:
staticmixedtypes have been addedarray|string) have been addedThis update would make the PSR-7 interfaces finally fully typed and I am asking (no I am begging) for a swift review and release ideally before PHP 9 arrives. Thanks!
Edit: I am very well aware that this would break compatibility with v2.0. However, the issue is not the BC break of this PR but the fact that v2.0 was released 3 months ago (2023-04-17) and PHP 8.0 was released almost 3 years ago (2020-11-06), so missing
staticwas not just an oversight, but a collective failure.So how to proceed? The easiest "fix" for damage control would be to just remove the <interface> return types from the current v2.0 and re-tag it, so that future installs just ignore the return type while maintaining compatibility in both directions. As an alternative, limit v2,0 to PHP
^7.2.