Skip to content

Commit b51a26f

Browse files
committed
Make functions present in functionMap but not in PhpStorm stubs known
1 parent c1ca0c4 commit b51a26f

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/Reflection/Runtime/RuntimeReflectionProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ private function getCustomFunction(\PhpParser\Node\Name $nameNode, ?Scope $scope
302302
public function resolveFunctionName(\PhpParser\Node\Name $nameNode, ?Scope $scope): ?string
303303
{
304304
return $this->resolveName($nameNode, function (string $name): bool {
305-
$exists = function_exists($name);
305+
$exists = function_exists($name) || $this->nativeFunctionReflectionProvider->findFunctionReflection($name) !== null;
306306
if ($exists) {
307307
if ($this->phpStormStubsSourceStubber->isPresentFunction($name) === false) {
308308
return false;

tests/PHPStan/Analyser/AnalyserIntegrationTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,12 @@ public function testBug4288(): void
374374
$this->assertSame(10, $nativeProperty->getDefaultValue());
375375
}
376376

377+
public function testBug4702(): void
378+
{
379+
$errors = $this->runAnalyse(__DIR__ . '/data/bug-4702.php');
380+
$this->assertCount(0, $errors);
381+
}
382+
377383
/**
378384
* @param string $file
379385
* @return \PHPStan\Analyser\Error[]
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
$archive = 'test.rar';
4+
$password = '1323';
5+
6+
$archive = rar_open($archive, $password);

0 commit comments

Comments
 (0)