phptools-docs
phptools-docs copied to clipboard
Documentation: Incorrect return type annotation in explode() function
- File: function.explode.php
- Line: 10
- Current implementation suggests
explode()might return a boolean value, which is incorrect
Description
There's an issue with the PHPDoc @return annotation for the explode() function. The current annotation incorrectly includes bool as a possible return type:
@return bool|string[] Returns an `array` of `string`s created by splitting...
However, according to PHP's official documentation and the function's implementation, explode() always returns an array (or throws a ValueError in PHP 8+ when the separator is an empty string).
Expected behavior
The @return annotation should only specify string[] or array as the return type, not bool.
The correct annotation should be:
@return string[] Returns an `array` of `string`s created by splitting...