diff --git a/generated/functionsList.php b/generated/functionsList.php index 26ca7d76..4a4954e9 100644 --- a/generated/functionsList.php +++ b/generated/functionsList.php @@ -1027,6 +1027,7 @@ 'uopz_implement', 'base64_decode', 'get_headers', + 'parse_url', 'settype', 'xdiff_file_bdiff', 'xdiff_file_bpatch', diff --git a/generated/ibmDb2.php b/generated/ibmDb2.php index c936bdaa..c47dd89a 100644 --- a/generated/ibmDb2.php +++ b/generated/ibmDb2.php @@ -35,7 +35,7 @@ * @return mixed When db2_autocommit receives only the * connection parameter, it returns the current state * of AUTOCOMMIT for the requested connection as an integer value. A value of - * 0 indicates that AUTOCOMMIT is off, while a value of 1 indicates that + * DB2_AUTOCOMMIT_OFF indicates that AUTOCOMMIT is off, while a value of DB2_AUTOCOMMIT_ON indicates that * AUTOCOMMIT is on. * * When db2_autocommit receives both the diff --git a/generated/url.php b/generated/url.php index b0c2b4f4..56c08b55 100644 --- a/generated/url.php +++ b/generated/url.php @@ -55,3 +55,90 @@ function get_headers(string $url, int $format = 0, $context = null): array } return $result; } + + +/** + * This function parses a URL and returns an associative array containing any + * of the various components of the URL that are present. + * The values of the array elements are not URL decoded. + * + * This function is not meant to validate + * the given URL, it only breaks it up into the above listed parts. Partial + * URLs are also accepted, parse_url tries its best to + * parse them correctly. + * + * @param string $url The URL to parse. Invalid characters are replaced by + * _. + * @param int $component Specify one of PHP_URL_SCHEME, + * PHP_URL_HOST, PHP_URL_PORT, + * PHP_URL_USER, PHP_URL_PASS, + * PHP_URL_PATH, PHP_URL_QUERY + * or PHP_URL_FRAGMENT to retrieve just a specific + * URL component as a string (except when + * PHP_URL_PORT is given, in which case the return + * value will be an integer). + * @return mixed On seriously malformed URLs, parse_url. + * + * If the component parameter is omitted, an + * associative array is returned. At least one element will be + * present within the array. Potential keys within this array are: + * + * + * + * scheme - e.g. http + * + * + * + * + * host + * + * + * + * + * port + * + * + * + * + * user + * + * + * + * + * pass + * + * + * + * + * path + * + * + * + * + * query - after the question mark ? + * + * + * + * + * fragment - after the hashmark # + * + * + * + * + * If the component parameter is specified, + * parse_url returns a string (or an + * integer, in the case of PHP_URL_PORT) + * instead of an array. If the requested component doesn't exist + * within the given URL, NULL will be returned. + * @throws UrlException + * + */ +function parse_url(string $url, int $component = -1) +{ + error_clear_last(); + $result = \parse_url($url, $component); + if ($result === false) { + throw UrlException::createFromPhpError(); + } + return $result; +} diff --git a/generator/src/DocPage.php b/generator/src/DocPage.php index 96354836..1c859c52 100644 --- a/generator/src/DocPage.php +++ b/generator/src/DocPage.php @@ -56,6 +56,9 @@ public function detectFalsyFunction(): bool if (preg_match('/&false;\s+otherwise/m', $file) && !preg_match('/(returns\s+&true;|&true;\s+on\s+success|&true;\s+if)/im', $file)) { return true; } + if (preg_match('/may\s+return\s+&false;/m', $file) && !preg_match('/(returns\s+&true;|&true;\s+on\s+success|&true;\s+if)/im', $file)) { + return true; + } if (preg_match('/&false;\s+if\s+an\s+error\s+occurred/m', $file)) { return true; } diff --git a/generator/src/Method.php b/generator/src/Method.php index 19c40a40..fd216bb5 100644 --- a/generator/src/Method.php +++ b/generator/src/Method.php @@ -132,6 +132,7 @@ private function stripReturnFalseText(string $string): string { $string = \strip_tags($string); $string = $this->removeString($string, 'or FALSE on failure'); + $string = $this->removeString($string, 'may return FALSE'); $string = $this->removeString($string, 'and FALSE on failure'); $string = $this->removeString($string, 'on success, or FALSE otherwise'); $string = $this->removeString($string, 'or FALSE on error'); diff --git a/rector-migrate.yml b/rector-migrate.yml index fa7f832e..e55e4213 100644 --- a/rector-migrate.yml +++ b/rector-migrate.yml @@ -1028,6 +1028,7 @@ services: uopz_implement: 'Safe\uopz_implement' base64_decode: 'Safe\base64_decode' get_headers: 'Safe\get_headers' + parse_url: 'Safe\parse_url' settype: 'Safe\settype' xdiff_file_bdiff: 'Safe\xdiff_file_bdiff' xdiff_file_bpatch: 'Safe\xdiff_file_bpatch'