1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Merge branch 'master' into add-missing-sodium-functions

# Conflicts:
#	dictionaries/CallMap_82_delta.php
This commit is contained in:
Alies Lapatsin 2022-12-10 01:47:55 +01:00
commit 0afe0d54f2
5 changed files with 40 additions and 4 deletions

View File

@ -6865,7 +6865,8 @@ return [
'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'],
@ -16761,6 +16762,7 @@ return [
'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'],
@ -16777,6 +16779,8 @@ return [
'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'],

View File

@ -21,8 +21,12 @@ return [
'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' => [

View File

@ -12626,7 +12626,7 @@ return [
'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'],

View File

@ -303,7 +303,10 @@ abstract class Atomic implements TypeNode
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) {

View File

@ -1154,6 +1154,31 @@ class ReturnTypeTest extends TestCase
'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',
],
];
}