nategood / httpful

A Chainable, REST Friendly, PHP HTTP Client. A sane alternative to cURL.
MIT License
1.74k stars 298 forks source link

Support for PHP 7.2 to 8.2 #305

Closed sosherof closed 4 months ago

sosherof commented 1 year ago

This branch has updates to add support for PHP 8.2. Rector and testing were used to ensure backward compatibility down to PHP 7.2. The main issues were:

  1. Missing class properties - dynamic property creation is no longer supported.
  2. Return type hinting is required for implemented methods. In most cases, returns types were simply added. However, three methods in the Response\Headers class returned type mixed. The "mixed" type isn't supported in 7.2 so those 3 methods got the "#[\ReturnTypeWillChange]" flag, which causes PHP 8 to suppress the warning.
  3. Implemented some of the other suggestions Rector made, mostly around array declaration and comparison statements.
JPaulMora commented 9 months ago

I have tried your fork and it's working properly