Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions generated/functionsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@
'header_register_callback',
'inet_ntop',
'openlog',
'setrawcookie',
'syslog',
'oci_bind_array_by_name',
'oci_bind_by_name',
Expand Down Expand Up @@ -874,7 +873,6 @@
'session_regenerate_id',
'session_register',
'session_reset',
'session_set_cookie_params',
'session_unregister',
'session_unset',
'session_write_close',
Expand Down Expand Up @@ -1007,7 +1005,6 @@
'uopz_extend',
'uopz_implement',
'base64_decode',
'base64_encode',
'get_headers',
'import_request_variables',
'settype',
Expand Down
12 changes: 6 additions & 6 deletions generated/gmp.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
/**
* Export a GMP number to a binary string
*
* @param GMP|string|int $gmpnumber The GMP number being exported
* @param \GMP|string|int $gmpnumber The GMP number being exported
* @param int $word_size Default value is 1. The number of bytes in each chunk of binary data. This is mainly used in conjunction with the options parameter.
* @param int $options Default value is GMP_MSW_FIRST | GMP_NATIVE_ENDIAN.
* @return string Returns a string .
* @throws GmpException
*
*/
function gmp_export(GMP $gmpnumber, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): string
function gmp_export(\GMP $gmpnumber, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): string
{
error_clear_last();
$result = \gmp_export($gmpnumber, $word_size, $options);
Expand All @@ -31,11 +31,11 @@ function gmp_export(GMP $gmpnumber, int $word_size = 1, int $options = GMP_MSW_F
* @param string $data The binary string being imported
* @param int $word_size Default value is 1. The number of bytes in each chunk of binary data. This is mainly used in conjunction with the options parameter.
* @param int $options Default value is GMP_MSW_FIRST | GMP_NATIVE_ENDIAN.
* @return GMP Returns a GMP number .
* @return \GMP Returns a GMP number .
* @throws GmpException
*
*/
function gmp_import(string $data, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): GMP
function gmp_import(string $data, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): \GMP
{
error_clear_last();
$result = \gmp_import($data, $word_size, $options);
Expand All @@ -49,12 +49,12 @@ function gmp_import(string $data, int $word_size = 1, int $options = GMP_MSW_FIR
/**
*
*
* @param GMP|string|int $seed The seed to be set for the gmp_random,
* @param \GMP|string|int $seed The seed to be set for the gmp_random,
* gmp_random_bits, and
* gmp_random_range functions.
*
* Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string provided that it is possible to convert the latter to a number.
* @return GMP Returns NULL on success .
* @return \GMP Returns NULL on success .
* @throws GmpException
*
*/
Expand Down
6 changes: 3 additions & 3 deletions generated/hash.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ function hash_hkdf(string $algo, string $ikm, int $length = 0, string $info = ''
/**
*
*
* @param HashContext $hcontext Hashing context returned by hash_init.
* @param \HashContext $hcontext Hashing context returned by hash_init.
* @param string $filename URL describing location of file to be hashed; Supports fopen wrappers.
* @param HashContext|null $scontext Stream context as returned by stream_context_create.
* @param \HashContext|null $scontext Stream context as returned by stream_context_create.
* @throws HashException
*
*/
function hash_update_file(HashContext $hcontext, string $filename, $scontext = null): void
function hash_update_file(\HashContext $hcontext, string $filename, $scontext = null): void
{
error_clear_last();
$result = \hash_update_file($hcontext, $filename, $scontext);
Expand Down
39 changes: 0 additions & 39 deletions generated/network.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,45 +478,6 @@ function openlog(string $ident, int $option, int $facility): void
}


/**
* setrawcookie is exactly the same as
* setcookie except that the cookie value will not be
* automatically urlencoded when sent to the browser.
*
* @param string $name
* @param string $value
* @param int $expire
* @param string $path
* @param string $domain
* @param bool $secure
* @param bool $httponly
* @throws NetworkException
*
*/
function setrawcookie(string $name, string $value = null, int $expire = 0, string $path = null, string $domain = null, bool $secure = false, bool $httponly = false): void
{
error_clear_last();
if ($httponly !== false) {
$result = \setrawcookie($name, $value, $expire, $path, $domain, $secure, $httponly);
} elseif ($secure !== false) {
$result = \setrawcookie($name, $value, $expire, $path, $domain, $secure);
} elseif ($domain !== null) {
$result = \setrawcookie($name, $value, $expire, $path, $domain);
} elseif ($path !== null) {
$result = \setrawcookie($name, $value, $expire, $path);
} elseif ($expire !== 0) {
$result = \setrawcookie($name, $value, $expire);
} elseif ($value !== null) {
$result = \setrawcookie($name, $value);
} else {
$result = \setrawcookie($name);
}
if ($result === false) {
throw NetworkException::createFromPhpError();
}
}


/**
* syslog generates a log message that will be
* distributed by the system logger.
Expand Down
4 changes: 2 additions & 2 deletions generated/oci8.php
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ function oci_free_statement($statement): void
* @param string $tdo Should be a valid named type (uppercase).
* @param string $schema Should point to the scheme, where the named type was created. The name
* of the current user is the default value.
* @return OCI-Collection Returns a new OCICollection object .
* @return \OCI-Collection Returns a new OCICollection object .
* @throws Oci8Exception
*
*/
Expand Down Expand Up @@ -1058,7 +1058,7 @@ function oci_new_cursor($connection)
* @param int $type Valid values for type are:
* OCI_DTYPE_FILE, OCI_DTYPE_LOB and
* OCI_DTYPE_ROWID.
* @return OCI-Lob Returns a new LOB or FILE descriptor on success, FALSE on error.
* @return \OCI-Lob Returns a new LOB or FILE descriptor on success, FALSE on error.
* @throws Oci8Exception
*
*/
Expand Down
45 changes: 0 additions & 45 deletions generated/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,51 +153,6 @@ function session_reset(): void
}


/**
* Set cookie parameters defined in the php.ini file. The effect of this
* function only lasts for the duration of the script. Thus, you need to
* call session_set_cookie_params for every request and
* before session_start is called.
*
* This function updates the runtime ini values of the corresponding PHP ini configuration
* keys which can be retrieved with the ini_get.
*
* @param int $lifetime Lifetime of the
* session cookie, defined in seconds.
* @param string $path Path on the domain where
* the cookie will work. Use a single slash ('/') for all paths on the
* domain.
* @param string|null $domain Cookie domain, for
* example 'www.php.net'. To make cookies visible on all subdomains then
* the domain must be prefixed with a dot like '.php.net'.
* @param bool $secure If TRUE cookie will only be sent over
* secure connections.
* @param bool $httponly If set to TRUE then PHP will attempt to send the
* httponly
* flag when setting the session cookie.
* @throws SessionException
*
*/
function session_set_cookie_params(int $lifetime, string $path = null, string $domain = null, bool $secure = false, bool $httponly = false): void
{
error_clear_last();
if ($httponly !== false) {
$result = \session_set_cookie_params($lifetime, $path, $domain, $secure, $httponly);
} elseif ($secure !== false) {
$result = \session_set_cookie_params($lifetime, $path, $domain, $secure);
} elseif ($domain !== null) {
$result = \session_set_cookie_params($lifetime, $path, $domain);
} elseif ($path !== null) {
$result = \session_set_cookie_params($lifetime, $path);
} else {
$result = \session_set_cookie_params($lifetime);
}
if ($result === false) {
throw SessionException::createFromPhpError();
}
}


/**
* session_unregister unregisters the global variable
* named name from the current session.
Expand Down
2 changes: 1 addition & 1 deletion generated/shmop.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function shmop_delete($shmid): void
* shmop_open
* @param int $start Offset from which to start reading
* @param int $count The number of bytes to read.
* 0 reads shmop_size($shmId) - $offset bytes.
* 0 reads shmop_size($shmid) - $start bytes.
* @return string Returns the data .
* @throws ShmopException
*
Expand Down
14 changes: 7 additions & 7 deletions generated/simplexml.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
* document and makes it into a SimpleXML node. This new object can
* then be used as a native SimpleXML element.
*
* @param DOMNode $node A DOM Element node
* @param \DOMNode $node A DOM Element node
* @param string $class_name You may use this optional parameter so that
* simplexml_import_dom will return an object of
* the specified class. That class should extend the
* SimpleXMLElement class.
* @return SimpleXMLElement Returns a SimpleXMLElement .
* @return \SimpleXMLElement Returns a SimpleXMLElement .
* @throws SimplexmlException
*
*/
function simplexml_import_dom(DOMNode $node, string $class_name = "SimpleXMLElement"): SimpleXMLElement
function simplexml_import_dom(\DOMNode $node, string $class_name = "SimpleXMLElement"): \SimpleXMLElement
{
error_clear_last();
$result = \simplexml_import_dom($node, $class_name);
Expand Down Expand Up @@ -49,12 +49,12 @@ function simplexml_import_dom(DOMNode $node, string $class_name = "SimpleXMLElem
* @param string $ns Namespace prefix or URI.
* @param bool $is_prefix TRUE if ns is a prefix, FALSE if it's a URI;
* defaults to FALSE.
* @return SimpleXMLElement Returns an object of class SimpleXMLElement with
* @return \SimpleXMLElement Returns an object of class SimpleXMLElement with
* properties containing the data held within the XML document, .
* @throws SimplexmlException
*
*/
function simplexml_load_file(string $filename, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false): SimpleXMLElement
function simplexml_load_file(string $filename, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false): \SimpleXMLElement
{
error_clear_last();
$result = \simplexml_load_file($filename, $class_name, $options, $ns, $is_prefix);
Expand All @@ -78,12 +78,12 @@ function simplexml_load_file(string $filename, string $class_name = "SimpleXMLEl
* @param string $ns Namespace prefix or URI.
* @param bool $is_prefix TRUE if ns is a prefix, FALSE if it's a URI;
* defaults to FALSE.
* @return SimpleXMLElement Returns an object of class SimpleXMLElement with
* @return \SimpleXMLElement Returns an object of class SimpleXMLElement with
* properties containing the data held within the xml document, .
* @throws SimplexmlException
*
*/
function simplexml_load_string(string $data, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false): SimpleXMLElement
function simplexml_load_string(string $data, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false): \SimpleXMLElement
{
error_clear_last();
$result = \simplexml_load_string($data, $class_name, $options, $ns, $is_prefix);
Expand Down
25 changes: 0 additions & 25 deletions generated/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,6 @@ function base64_decode(string $data, bool $strict = false): string
}


/**
* Encodes the given data with base64.
*
* This encoding is designed to make binary data survive transport through
* transport layers that are not 8-bit clean, such as mail bodies.
*
* Base64-encoded data takes about 33% more space than the original
* data.
*
* @param string $data The data to encode.
* @return string The encoded data, as a string .
* @throws UrlException
*
*/
function base64_encode(string $data): string
{
error_clear_last();
$result = \base64_encode($data);
if ($result === false) {
throw UrlException::createFromPhpError();
}
return $result;
}


/**
* get_headers returns an array with the headers sent
* by the server in response to a HTTP request.
Expand Down
16 changes: 8 additions & 8 deletions generator/src/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function getFunctionName(): string
return $this->functionObject->methodname->__toString();
}

public function getFunctionType(): string
public function getReturnType(): string
{
// If the function returns a boolean, since false is for error, true is for success.
// Let's replace this with a "void".
Expand All @@ -54,13 +54,13 @@ public function getFunctionType(): string
return 'mixed';
}

return $type;
return Type::toRootNamespace($type);
}

/**
* @return Parameter[]
*/
public function getFunctionParam(): array
public function getParams(): array
{
if ($this->params === null) {
if (!isset($this->functionObject->methodparam)) {
Expand Down Expand Up @@ -93,7 +93,7 @@ private function getDocBlock(): string
$str .= "\n\n";

$i=1;
foreach ($this->getFunctionParam() as $parameter) {
foreach ($this->getParams() as $parameter) {
$str .= '@param '.$parameter->getBestType().' $'.$parameter->getParameter().' ';
$str .= $this->getStringForXPath("(//docbook:refsect1[@role='parameters']//docbook:varlistentry)[$i]//docbook:para")."\n";
$i++;
Expand Down Expand Up @@ -157,9 +157,9 @@ private function getBestReturnType(): ?string
$phpStanFunction = $this->getPhpStanData();
// Get the type from PhpStan database first, then from the php doc.
if ($phpStanFunction !== null) {
return $phpStanFunction->getReturnType();
return Type::toRootNamespace($phpStanFunction->getReturnType());
} else {
return $this->getFunctionType();
return Type::toRootNamespace($this->getReturnType());
}
}

Expand Down Expand Up @@ -196,7 +196,7 @@ public function getModuleName(): string
*/
public function isOverloaded(): bool
{
foreach ($this->getFunctionParam() as $parameter) {
foreach ($this->getParams() as $parameter) {
if ($parameter->isOptionalWithNoDefault() && !$parameter->isByReference()) {
return true;
}
Expand All @@ -207,7 +207,7 @@ public function isOverloaded(): bool
public function cloneAndRemoveAParameter(): Method
{
$new = clone $this;
$params = $this->getFunctionParam();
$params = $this->getParams();
\array_pop($params);
$new->params = $params;
return $new;
Expand Down
3 changes: 2 additions & 1 deletion generator/src/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public function __construct(\SimpleXMLElement $parameter, ?PhpStanFunction $phpS
*/
public function getType(): string
{
return $this->parameter->type->__toString();
$type = $this->parameter->type->__toString();
return Type::toRootNamespace($type);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion generator/src/PhpStanFunctions/PhpStanParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

namespace Safe\PhpStanFunctions;

use Safe\Type;

class PhpStanParameter
{
/**
Expand Down Expand Up @@ -63,7 +65,7 @@ public function getName(): string
*/
public function getType(): string
{
return $this->type;
return Type::toRootNamespace($this->type);
}

/**
Expand Down
Loading