httpful
httpful copied to clipboard
Warnings in PHP 8.1
Can you add return types for PHP 8.1 to remove warnings?
In that line https://github.com/nategood/httpful/blob/master/src/Httpful/Response/Headers.php#L47 return type bool
should be added to do that.
Now it ends up with:
Method "ArrayAccess::offsetUnset()" might add "void" as a native return type declaration in the future. Do the same in implementation "Httpful\Response\Headers" now to avoid errors or add an explicit @return annotation to suppress this message.
Return type of Httpful\Response\Headers::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Return type of Httpful\Response\Headers::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
- Other methods defined in
\ArrayAccess
and\Countable
also should be fixed.
can confirm. Also lines: https://github.com/nategood/httpful/blob/0cded3ea97ba905600de9ceb9ef13f3ab681587c/src/Httpful/Response/Headers.php#L56 https://github.com/nategood/httpful/blob/0cded3ea97ba905600de9ceb9ef13f3ab681587c/src/Httpful/Response/Headers.php#L66
and others has issues
Why do I have this as a fatal error instead of a warning :-( Is there any fork that is fixing this already?
Any updates or solutions on this? :/
Current errors I get are:
Deprecated: Return type of Httpful\Response\Headers::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in c:\examplesite\vendor\httpful-master\src\Httpful\Response\Headers.php on line 47
Deprecated: Return type of Httpful\Response\Headers::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in c:\examplesite\vendor\httpful-master\src\Httpful\Response\Headers.php on line 56
Deprecated: Return type of Httpful\Response\Headers::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in c:\examplesite\vendor\httpful-master\src\Httpful\Response\Headers.php on line 66
Deprecated: Return type of Httpful\Response\Headers::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in c:\examplesite\vendor\httpful-master\src\Httpful\Response\Headers.php on line 75
Deprecated: Return type of Httpful\Response\Headers::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in c:\examplesite\vendor\httpful-master\src\Httpful\Response\Headers.php on line 83
I'm also having this issue. Fixed it by adding #[\ReturnTypeWillChange] in the code a bunch of times but will keep an eye here for the definitive fix.
Issue resolved in latest build.