Skip to content

Commit c5be1b4

Browse files
authored
Merge pull request #47 from moufmouf/objects_namespace
Fixing namespace of all classes in generated files
2 parents b5446e5 + af96b68 commit c5be1b4

18 files changed

+131
-157
lines changed

generated/functionsList.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,6 @@
542542
'header_register_callback',
543543
'inet_ntop',
544544
'openlog',
545-
'setrawcookie',
546545
'syslog',
547546
'oci_bind_array_by_name',
548547
'oci_bind_by_name',
@@ -874,7 +873,6 @@
874873
'session_regenerate_id',
875874
'session_register',
876875
'session_reset',
877-
'session_set_cookie_params',
878876
'session_unregister',
879877
'session_unset',
880878
'session_write_close',
@@ -1007,7 +1005,6 @@
10071005
'uopz_extend',
10081006
'uopz_implement',
10091007
'base64_decode',
1010-
'base64_encode',
10111008
'get_headers',
10121009
'import_request_variables',
10131010
'settype',

generated/gmp.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
/**
88
* Export a GMP number to a binary string
99
*
10-
* @param GMP|string|int $gmpnumber The GMP number being exported
10+
* @param \GMP|string|int $gmpnumber The GMP number being exported
1111
* @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.
1212
* @param int $options Default value is GMP_MSW_FIRST | GMP_NATIVE_ENDIAN.
1313
* @return string Returns a string .
1414
* @throws GmpException
1515
*
1616
*/
17-
function gmp_export(GMP $gmpnumber, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): string
17+
function gmp_export(\GMP $gmpnumber, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): string
1818
{
1919
error_clear_last();
2020
$result = \gmp_export($gmpnumber, $word_size, $options);
@@ -31,11 +31,11 @@ function gmp_export(GMP $gmpnumber, int $word_size = 1, int $options = GMP_MSW_F
3131
* @param string $data The binary string being imported
3232
* @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.
3333
* @param int $options Default value is GMP_MSW_FIRST | GMP_NATIVE_ENDIAN.
34-
* @return GMP Returns a GMP number .
34+
* @return \GMP Returns a GMP number .
3535
* @throws GmpException
3636
*
3737
*/
38-
function gmp_import(string $data, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): GMP
38+
function gmp_import(string $data, int $word_size = 1, int $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN): \GMP
3939
{
4040
error_clear_last();
4141
$result = \gmp_import($data, $word_size, $options);
@@ -49,12 +49,12 @@ function gmp_import(string $data, int $word_size = 1, int $options = GMP_MSW_FIR
4949
/**
5050
*
5151
*
52-
* @param GMP|string|int $seed The seed to be set for the gmp_random,
52+
* @param \GMP|string|int $seed The seed to be set for the gmp_random,
5353
* gmp_random_bits, and
5454
* gmp_random_range functions.
5555
*
5656
* 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.
57-
* @return GMP Returns NULL on success .
57+
* @return \GMP Returns NULL on success .
5858
* @throws GmpException
5959
*
6060
*/

generated/hash.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ function hash_hkdf(string $algo, string $ikm, int $length = 0, string $info = ''
4545
/**
4646
*
4747
*
48-
* @param HashContext $hcontext Hashing context returned by hash_init.
48+
* @param \HashContext $hcontext Hashing context returned by hash_init.
4949
* @param string $filename URL describing location of file to be hashed; Supports fopen wrappers.
50-
* @param HashContext|null $scontext Stream context as returned by stream_context_create.
50+
* @param \HashContext|null $scontext Stream context as returned by stream_context_create.
5151
* @throws HashException
5252
*
5353
*/
54-
function hash_update_file(HashContext $hcontext, string $filename, $scontext = null): void
54+
function hash_update_file(\HashContext $hcontext, string $filename, $scontext = null): void
5555
{
5656
error_clear_last();
5757
$result = \hash_update_file($hcontext, $filename, $scontext);

generated/network.php

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -478,45 +478,6 @@ function openlog(string $ident, int $option, int $facility): void
478478
}
479479

480480

481-
/**
482-
* setrawcookie is exactly the same as
483-
* setcookie except that the cookie value will not be
484-
* automatically urlencoded when sent to the browser.
485-
*
486-
* @param string $name
487-
* @param string $value
488-
* @param int $expire
489-
* @param string $path
490-
* @param string $domain
491-
* @param bool $secure
492-
* @param bool $httponly
493-
* @throws NetworkException
494-
*
495-
*/
496-
function setrawcookie(string $name, string $value = null, int $expire = 0, string $path = null, string $domain = null, bool $secure = false, bool $httponly = false): void
497-
{
498-
error_clear_last();
499-
if ($httponly !== false) {
500-
$result = \setrawcookie($name, $value, $expire, $path, $domain, $secure, $httponly);
501-
} elseif ($secure !== false) {
502-
$result = \setrawcookie($name, $value, $expire, $path, $domain, $secure);
503-
} elseif ($domain !== null) {
504-
$result = \setrawcookie($name, $value, $expire, $path, $domain);
505-
} elseif ($path !== null) {
506-
$result = \setrawcookie($name, $value, $expire, $path);
507-
} elseif ($expire !== 0) {
508-
$result = \setrawcookie($name, $value, $expire);
509-
} elseif ($value !== null) {
510-
$result = \setrawcookie($name, $value);
511-
} else {
512-
$result = \setrawcookie($name);
513-
}
514-
if ($result === false) {
515-
throw NetworkException::createFromPhpError();
516-
}
517-
}
518-
519-
520481
/**
521482
* syslog generates a log message that will be
522483
* distributed by the system logger.

generated/oci8.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ function oci_free_statement($statement): void
908908
* @param string $tdo Should be a valid named type (uppercase).
909909
* @param string $schema Should point to the scheme, where the named type was created. The name
910910
* of the current user is the default value.
911-
* @return OCI-Collection Returns a new OCICollection object .
911+
* @return \OCI-Collection Returns a new OCICollection object .
912912
* @throws Oci8Exception
913913
*
914914
*/
@@ -1058,7 +1058,7 @@ function oci_new_cursor($connection)
10581058
* @param int $type Valid values for type are:
10591059
* OCI_DTYPE_FILE, OCI_DTYPE_LOB and
10601060
* OCI_DTYPE_ROWID.
1061-
* @return OCI-Lob Returns a new LOB or FILE descriptor on success, FALSE on error.
1061+
* @return \OCI-Lob Returns a new LOB or FILE descriptor on success, FALSE on error.
10621062
* @throws Oci8Exception
10631063
*
10641064
*/

generated/session.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -153,51 +153,6 @@ function session_reset(): void
153153
}
154154

155155

156-
/**
157-
* Set cookie parameters defined in the php.ini file. The effect of this
158-
* function only lasts for the duration of the script. Thus, you need to
159-
* call session_set_cookie_params for every request and
160-
* before session_start is called.
161-
*
162-
* This function updates the runtime ini values of the corresponding PHP ini configuration
163-
* keys which can be retrieved with the ini_get.
164-
*
165-
* @param int $lifetime Lifetime of the
166-
* session cookie, defined in seconds.
167-
* @param string $path Path on the domain where
168-
* the cookie will work. Use a single slash ('/') for all paths on the
169-
* domain.
170-
* @param string|null $domain Cookie domain, for
171-
* example 'www.php.net'. To make cookies visible on all subdomains then
172-
* the domain must be prefixed with a dot like '.php.net'.
173-
* @param bool $secure If TRUE cookie will only be sent over
174-
* secure connections.
175-
* @param bool $httponly If set to TRUE then PHP will attempt to send the
176-
* httponly
177-
* flag when setting the session cookie.
178-
* @throws SessionException
179-
*
180-
*/
181-
function session_set_cookie_params(int $lifetime, string $path = null, string $domain = null, bool $secure = false, bool $httponly = false): void
182-
{
183-
error_clear_last();
184-
if ($httponly !== false) {
185-
$result = \session_set_cookie_params($lifetime, $path, $domain, $secure, $httponly);
186-
} elseif ($secure !== false) {
187-
$result = \session_set_cookie_params($lifetime, $path, $domain, $secure);
188-
} elseif ($domain !== null) {
189-
$result = \session_set_cookie_params($lifetime, $path, $domain);
190-
} elseif ($path !== null) {
191-
$result = \session_set_cookie_params($lifetime, $path);
192-
} else {
193-
$result = \session_set_cookie_params($lifetime);
194-
}
195-
if ($result === false) {
196-
throw SessionException::createFromPhpError();
197-
}
198-
}
199-
200-
201156
/**
202157
* session_unregister unregisters the global variable
203158
* named name from the current session.

generated/shmop.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function shmop_delete($shmid): void
2929
* shmop_open
3030
* @param int $start Offset from which to start reading
3131
* @param int $count The number of bytes to read.
32-
* 0 reads shmop_size($shmId) - $offset bytes.
32+
* 0 reads shmop_size($shmid) - $start bytes.
3333
* @return string Returns the data .
3434
* @throws ShmopException
3535
*

generated/simplexml.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
* document and makes it into a SimpleXML node. This new object can
1010
* then be used as a native SimpleXML element.
1111
*
12-
* @param DOMNode $node A DOM Element node
12+
* @param \DOMNode $node A DOM Element node
1313
* @param string $class_name You may use this optional parameter so that
1414
* simplexml_import_dom will return an object of
1515
* the specified class. That class should extend the
1616
* SimpleXMLElement class.
17-
* @return SimpleXMLElement Returns a SimpleXMLElement .
17+
* @return \SimpleXMLElement Returns a SimpleXMLElement .
1818
* @throws SimplexmlException
1919
*
2020
*/
21-
function simplexml_import_dom(DOMNode $node, string $class_name = "SimpleXMLElement"): SimpleXMLElement
21+
function simplexml_import_dom(\DOMNode $node, string $class_name = "SimpleXMLElement"): \SimpleXMLElement
2222
{
2323
error_clear_last();
2424
$result = \simplexml_import_dom($node, $class_name);
@@ -49,12 +49,12 @@ function simplexml_import_dom(DOMNode $node, string $class_name = "SimpleXMLElem
4949
* @param string $ns Namespace prefix or URI.
5050
* @param bool $is_prefix TRUE if ns is a prefix, FALSE if it's a URI;
5151
* defaults to FALSE.
52-
* @return SimpleXMLElement Returns an object of class SimpleXMLElement with
52+
* @return \SimpleXMLElement Returns an object of class SimpleXMLElement with
5353
* properties containing the data held within the XML document, .
5454
* @throws SimplexmlException
5555
*
5656
*/
57-
function simplexml_load_file(string $filename, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false): SimpleXMLElement
57+
function simplexml_load_file(string $filename, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false): \SimpleXMLElement
5858
{
5959
error_clear_last();
6060
$result = \simplexml_load_file($filename, $class_name, $options, $ns, $is_prefix);
@@ -78,12 +78,12 @@ function simplexml_load_file(string $filename, string $class_name = "SimpleXMLEl
7878
* @param string $ns Namespace prefix or URI.
7979
* @param bool $is_prefix TRUE if ns is a prefix, FALSE if it's a URI;
8080
* defaults to FALSE.
81-
* @return SimpleXMLElement Returns an object of class SimpleXMLElement with
81+
* @return \SimpleXMLElement Returns an object of class SimpleXMLElement with
8282
* properties containing the data held within the xml document, .
8383
* @throws SimplexmlException
8484
*
8585
*/
86-
function simplexml_load_string(string $data, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false): SimpleXMLElement
86+
function simplexml_load_string(string $data, string $class_name = "SimpleXMLElement", int $options = 0, string $ns = "", bool $is_prefix = false): \SimpleXMLElement
8787
{
8888
error_clear_last();
8989
$result = \simplexml_load_string($data, $class_name, $options, $ns, $is_prefix);

generated/url.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,6 @@ function base64_decode(string $data, bool $strict = false): string
2828
}
2929

3030

31-
/**
32-
* Encodes the given data with base64.
33-
*
34-
* This encoding is designed to make binary data survive transport through
35-
* transport layers that are not 8-bit clean, such as mail bodies.
36-
*
37-
* Base64-encoded data takes about 33% more space than the original
38-
* data.
39-
*
40-
* @param string $data The data to encode.
41-
* @return string The encoded data, as a string .
42-
* @throws UrlException
43-
*
44-
*/
45-
function base64_encode(string $data): string
46-
{
47-
error_clear_last();
48-
$result = \base64_encode($data);
49-
if ($result === false) {
50-
throw UrlException::createFromPhpError();
51-
}
52-
return $result;
53-
}
54-
55-
5631
/**
5732
* get_headers returns an array with the headers sent
5833
* by the server in response to a HTTP request.

generator/src/Method.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function getFunctionName(): string
4141
return $this->functionObject->methodname->__toString();
4242
}
4343

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

57-
return $type;
57+
return Type::toRootNamespace($type);
5858
}
5959

6060
/**
6161
* @return Parameter[]
6262
*/
63-
public function getFunctionParam(): array
63+
public function getParams(): array
6464
{
6565
if ($this->params === null) {
6666
if (!isset($this->functionObject->methodparam)) {
@@ -93,7 +93,7 @@ private function getDocBlock(): string
9393
$str .= "\n\n";
9494

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

@@ -196,7 +196,7 @@ public function getModuleName(): string
196196
*/
197197
public function isOverloaded(): bool
198198
{
199-
foreach ($this->getFunctionParam() as $parameter) {
199+
foreach ($this->getParams() as $parameter) {
200200
if ($parameter->isOptionalWithNoDefault() && !$parameter->isByReference()) {
201201
return true;
202202
}
@@ -207,7 +207,7 @@ public function isOverloaded(): bool
207207
public function cloneAndRemoveAParameter(): Method
208208
{
209209
$new = clone $this;
210-
$params = $this->getFunctionParam();
210+
$params = $this->getParams();
211211
\array_pop($params);
212212
$new->params = $params;
213213
return $new;

0 commit comments

Comments
 (0)