@@ -30,7 +30,7 @@ final class HashFunctionsReturnTypeExtension implements DynamicFunctionReturnTyp
3030 private const SUPPORTED_FUNCTIONS = [
3131 'hash ' => [
3232 'cryptographic ' => false ,
33- 'possiblyFalse ' => false ,
33+ 'possiblyFalse ' => true ,
3434 'binary ' => 2 ,
3535 ],
3636 'hash_file ' => [
@@ -40,12 +40,12 @@ final class HashFunctionsReturnTypeExtension implements DynamicFunctionReturnTyp
4040 ],
4141 'hash_hkdf ' => [
4242 'cryptographic ' => true ,
43- 'possiblyFalse ' => false ,
43+ 'possiblyFalse ' => true ,
4444 'binary ' => true ,
4545 ],
4646 'hash_hmac ' => [
4747 'cryptographic ' => true ,
48- 'possiblyFalse ' => false ,
48+ 'possiblyFalse ' => true ,
4949 'binary ' => 3 ,
5050 ],
5151 'hash_hmac_file ' => [
@@ -55,7 +55,7 @@ final class HashFunctionsReturnTypeExtension implements DynamicFunctionReturnTyp
5555 ],
5656 'hash_pbkdf2 ' => [
5757 'cryptographic ' => true ,
58- 'possiblyFalse ' => false ,
58+ 'possiblyFalse ' => true ,
5959 'binary ' => 5 ,
6060 ],
6161 ];
@@ -120,7 +120,7 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
120120 $ algorithmType = $ scope ->getType ($ functionCall ->getArgs ()[0 ]->value );
121121 $ constantAlgorithmTypes = $ algorithmType ->getConstantStrings ();
122122 if (count ($ constantAlgorithmTypes ) === 0 ) {
123- if ($ functionData ['possiblyFalse ' ]) {
123+ if ($ functionData ['possiblyFalse ' ] && ! $ this -> phpVersion -> throwsValueErrorForInternalFunctions () ) {
124124 return TypeUtils::toBenevolentUnion (TypeCombinator::union ($ stringReturnType , new ConstantBooleanType (false )));
125125 }
126126
0 commit comments