Skip to content

Commit

Permalink
Updated type hint for user errors to allow nulls.
Browse files Browse the repository at this point in the history
  • Loading branch information
hexydec committed Jul 8, 2022
1 parent b9039c8 commit a268efb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/htmldoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ public function valid() : bool {
*
* @param string $url The address of the HTML file to retrieve
* @param resource $context A resource object made with stream_context_create()
* @param string &$error A reference to any user error that is generated
* @param ?string &$error A reference to any user error that is generated
* @return string|false The loaded HTML, or false on error
*/
public function open(string $url, $context = null, string &$error = null) {
public function open(string $url, $context = null, ?string &$error = null) {

// check resource
if ($context !== null && !\is_resource($context)) {
Expand Down Expand Up @@ -230,10 +230,10 @@ public function open(string $url, $context = null, string &$error = null) {
*
* @param string $html A string containing valid HTML
* @param string $charset The charset of the document
* @param string &$error A reference to any user error that is generated
* @param ?string &$error A reference to any user error that is generated
* @return bool Whether the input HTML was parsed
*/
public function load(string $html, string $charset = null, &$error = null) : bool {
public function load(string $html, string $charset = null, ?string &$error = null) : bool {

// detect the charset
if ($charset || ($charset = $this->getCharsetFromHtml($html)) !== null) {
Expand Down

0 comments on commit a268efb

Please sign in to comment.