Skip to content

Commit

Permalink
[phpstorm-stubs] fix return types
Browse files Browse the repository at this point in the history
  • Loading branch information
isfedorov committed Oct 27, 2024
1 parent f8625ad commit a0e0091
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
12 changes: 6 additions & 6 deletions bz2/bz2.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ function bzclose($bz): bool {}
* @return int the error number as an integer.
*/
#[Pure]
#[LanguageLevelTypeAware(['8.1' => 'int', '8.0' => 'int|false'], default: 'int')]
function bzerrno($bz) {}
#[LanguageLevelTypeAware(['8.0' => 'int|false', '8.1' => 'int'], default: 'int')]
function bzerrno($bz):int {}

/**
* Returns a bzip2 error string
Expand All @@ -102,8 +102,8 @@ function bzerrno($bz) {}
* @return string a string containing the error message.
*/
#[Pure]
#[LanguageLevelTypeAware(['8.1' => 'string', '8.0' => 'string|false'], default: 'string')]
function bzerrstr($bz) {}
#[LanguageLevelTypeAware(['8.0' => 'string|false', '8.1' => 'string'], default: 'string')]
function bzerrstr($bz): string {}

/**
* Returns the bzip2 error number and error string in an array
Expand All @@ -117,9 +117,9 @@ function bzerrstr($bz) {}
* errstr entry.
*/
#[Pure]
#[LanguageLevelTypeAware(['8.1' => 'array', '8.0' => 'array|false'], default: 'array')]
#[ArrayShape(["errno" => "int", "errstr" => "string"])]
function bzerror($bz) {}
#[LanguageLevelTypeAware(['8.0' => 'array|false', '8.1' => 'array'], default: 'array')]
function bzerror($bz):array {}

/**
* Compress a string into bzip2 encoded data
Expand Down
5 changes: 4 additions & 1 deletion dom/dom.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
* </p>
* @return DOMElement|null The <b>DOMElement</b> node added or <b>NULL</b> if any errors occur.
*/
#[LanguageLevelTypeAware(['8.0' => 'DOMElement'], default: 'DOMElement|null')]
#[LanguageLevelTypeAware([
'8.0' => 'DOMElement',
'8.4' => 'DOMAttr|DOMElement'
], default: 'DOMElement|null')]
function dom_import_simplexml(object $node) {}

/**
Expand Down
2 changes: 1 addition & 1 deletion dom/dom_n.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class Mysql {}
/**
* @since 8.4
*/
function import_simplexml(object $node): \Dom\Element {}
function import_simplexml(object $node): Attr|Element {}

/**
* @since 8.4
Expand Down
2 changes: 1 addition & 1 deletion intl/intl.php
Original file line number Diff line number Diff line change
Expand Up @@ -7331,7 +7331,7 @@ public function getLocale(#[LanguageAware(['8.0' => 'int'], default: '')] $type)
#[Pure]
#[TentativeType]
public function getPartsIterator(
#[LanguageAware(['8.3' => 'string', '8.0' => 'int'], default: '')] #[EV([IntlPartsIterator::KEY_SEQUENTIAL, IntlPartsIterator::KEY_LEFT, IntlPartsIterator::KEY_RIGHT])] $type = IntlPartsIterator::KEY_SEQUENTIAL
#[LanguageAware(['8.0' => 'int', '8.3' => 'string'], default: '')] #[EV([IntlPartsIterator::KEY_SEQUENTIAL, IntlPartsIterator::KEY_LEFT, IntlPartsIterator::KEY_RIGHT])] $type = IntlPartsIterator::KEY_SEQUENTIAL
): IntlPartsIterator {}

/**
Expand Down
5 changes: 4 additions & 1 deletion openssl/openssl.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,10 @@ function openssl_pkcs12_read(string $pkcs12, &$certificates, string $passphrase)
* </p>
* @return OpenSSLCertificateSigningRequest|resource|false the CSR.
*/
#[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificateSigningRequest|false"], default: "resource|false")]
#[LanguageLevelTypeAware([
"8.0" => "OpenSSLCertificateSigningRequest|false",
"8.2" => "OpenSSLCertificateSigningRequest|bool"
], default: "resource|false")]
function openssl_csr_new(
array $distinguished_names,
#[LanguageLevelTypeAware(['8.0' => 'OpenSSLAsymmetricKey'], default: 'resource')] &$private_key,
Expand Down

0 comments on commit a0e0091

Please sign in to comment.