Skip to content

Commit

Permalink
Merge branch 'master' into add-missing-sodium-functions
Browse files Browse the repository at this point in the history
# Conflicts:
#	dictionaries/CallMap_82_delta.php
  • Loading branch information
alies-dev committed Dec 10, 2022
2 parents ce3be3b + 16cdeb9 commit 0afe0d5
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
6 changes: 5 additions & 1 deletion dictionaries/CallMap.php
Expand Up @@ -6865,7 +6865,8 @@
'libxml_disable_entity_loader' => ['bool', 'disable='=>'bool'],
'libxml_get_errors' => ['array<int,LibXMLError>'],
'libxml_get_last_error' => ['LibXMLError|false'],
'libxml_set_external_entity_loader' => ['bool', 'resolver_function'=>'callable'],
'libxml_get_external_entity_loader' => ['(callable(string,string,array{directory:?string,intSubName:?string,extSubURI:?string,extSubSystem:?string}):(resource|string|null))|null'],
'libxml_set_external_entity_loader' => ['bool', 'resolver_function'=>'(callable(string,string,array{directory:?string,intSubName:?string,extSubURI:?string,extSubSystem:?string}):(resource|string|null))|null'],
'libxml_set_streams_context' => ['void', 'context'=>'resource'],
'libxml_use_internal_errors' => ['bool', 'use_errors='=>'bool'],
'LimitIterator::__construct' => ['void', 'iterator'=>'Iterator', 'offset='=>'int', 'count='=>'int'],
Expand Down Expand Up @@ -16761,6 +16762,7 @@
'ZipArchive::addFromString' => ['bool', 'entryname'=>'string', 'content'=>'string'],
'ZipArchive::addGlob' => ['bool', 'pattern'=>'string', 'flags='=>'int', 'options='=>'array'],
'ZipArchive::addPattern' => ['bool', 'pattern'=>'string', 'path='=>'string', 'options='=>'array'],
'ZipArchive::clearError' => ['void'],
'ZipArchive::close' => ['bool'],
'ZipArchive::count' => ['int'],
'ZipArchive::createEmptyDir' => ['bool', 'dirname'=>'string'],
Expand All @@ -16777,6 +16779,8 @@
'ZipArchive::getNameIndex' => ['string|false', 'index'=>'int', 'flags='=>'int'],
'ZipArchive::getStatusString' => ['string|false'],
'ZipArchive::getStream' => ['resource|false', 'entryname'=>'string'],
'ZipArchive::getStreamIndex' => ['resource|false', 'index'=>'int', 'flags='=>'int'],
'ZipArchive::getStreamName' => ['resource|false', 'name'=>'string', 'flags='=>'int'],
'ZipArchive::isCompressionMethodSupported' => ['bool', 'method'=>'int', 'encode='=>'bool'],
'ZipArchive::isEncryptionMethodSupported' => ['bool', 'method'=>'int', 'encode='=>'bool'],
'ZipArchive::locateName' => ['int|false', 'filename'=>'string', 'flags='=>'int'],
Expand Down
6 changes: 5 additions & 1 deletion dictionaries/CallMap_82_delta.php
Expand Up @@ -21,8 +21,12 @@
'openssl_cipher_key_length' => ['positive-int|false', 'cipher_algo'=>'non-empty-string'],
'curl_upkeep' => ['bool', 'handle'=>'CurlHandle'],
'ini_parse_quantity' => ['int', 'shorthand'=>'non-empty-string'],
'sodium_crypto_stream_xchacha20_xor_ic' => ['string', 'message'=>'string', 'nonce'=>'non-empty-string', 'counter'=>'int', 'key'=>'non-empty-string'],
'libxml_get_external_entity_loader' => ['(callable(string,string,array{directory:?string,intSubName:?string,extSubURI:?string,extSubSystem:?string}):(resource|string|null))|null'],
'memory_reset_peak_usage' => ['void'],
'sodium_crypto_stream_xchacha20_xor_ic' => ['string', 'message'=>'string', 'nonce'=>'non-empty-string', 'counter'=>'int', 'key'=>'non-empty-string'],
'ZipArchive::clearError' => ['void'],
'ZipArchive::getStreamIndex' => ['resource|false', 'index'=>'int', 'flags='=>'int'],
'ZipArchive::getStreamName' => ['resource|false', 'name'=>'string', 'flags='=>'int'],
],

'changed' => [
Expand Down
2 changes: 1 addition & 1 deletion dictionaries/CallMap_historical.php
Expand Up @@ -12626,7 +12626,7 @@
'libxml_disable_entity_loader' => ['bool', 'disable='=>'bool'],
'libxml_get_errors' => ['array<int,LibXMLError>'],
'libxml_get_last_error' => ['LibXMLError|false'],
'libxml_set_external_entity_loader' => ['bool', 'resolver_function'=>'callable'],
'libxml_set_external_entity_loader' => ['bool', 'resolver_function'=>'(callable(string,string,array{directory:?string,intSubName:?string,extSubURI:?string,extSubSystem:?string}):(resource|string|null))|null'],
'libxml_set_streams_context' => ['void', 'context'=>'resource'],
'libxml_use_internal_errors' => ['bool', 'use_errors='=>'bool'],
'lineObj::__construct' => ['void'],
Expand Down
5 changes: 4 additions & 1 deletion src/Psalm/Type/Atomic.php
Expand Up @@ -303,7 +303,10 @@ private static function createInner(
return $analysis_php_version_id !== null ? new TNamedObject($value) : new TNumeric();

case 'true':
return $analysis_php_version_id !== null ? new TNamedObject($value) : new TTrue();
if ($analysis_php_version_id === null || $analysis_php_version_id >= 8_02_00) {
return new TTrue();
}
return new TNamedObject($value);

case 'false':
if ($analysis_php_version_id === null || $analysis_php_version_id >= 8_00_00) {
Expand Down
25 changes: 25 additions & 0 deletions tests/ReturnTypeTest.php
Expand Up @@ -1154,6 +1154,31 @@ function f(object $p): Stringable {
'ignored_issues' => [],
'php_version' => '8.0',
],
'newReturnTypesInPhp82' => [
'code' => '<?php
function alwaysTrue(): true {
return true;
}
function alwaysFalse(): false {
return false;
}
function alwaysNull(): null {
return null;
}
$true = alwaysTrue();
$false = alwaysFalse();
$null = alwaysNull();
',
'assertions' => [
'$true===' => 'true',
'$false===' => 'false',
'$null===' => 'null',
],
'ignored_issues' => [],
'php_version' => '8.2',
],
];
}

Expand Down

0 comments on commit 0afe0d5

Please sign in to comment.