Skip to content

Commit 3b85d43

Browse files
authored
Merge branch refs/heads/1.12.x into 2.0.x
2 parents 47707a8 + 3592cf0 commit 3b85d43

File tree

10 files changed

+20
-275
lines changed

10 files changed

+20
-275
lines changed

conf/config.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,11 +1386,6 @@ services:
13861386
tags:
13871387
- phpstan.broker.dynamicFunctionReturnTypeExtension
13881388

1389-
-
1390-
class: PHPStan\Type\Php\CurlInitReturnTypeExtension
1391-
tags:
1392-
- phpstan.broker.dynamicFunctionReturnTypeExtension
1393-
13941389
-
13951390
class: PHPStan\Type\Php\DateFunctionReturnTypeHelper
13961391

resources/functionMap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,7 @@
14941494
'curl_exec' => ['bool|string', 'ch'=>'resource'],
14951495
'curl_file_create' => ['CURLFile', 'filename'=>'string', 'mimetype='=>'string', 'postfilename='=>'string'],
14961496
'curl_getinfo' => ['mixed', 'ch'=>'resource', 'option='=>'int'],
1497-
'curl_init' => ['resource|false', 'url='=>'string'],
1497+
'curl_init' => ['__benevolent<resource|false>', 'url='=>'string'],
14981498
'curl_multi_add_handle' => ['int', 'mh'=>'resource', 'ch'=>'resource'],
14991499
'curl_multi_close' => ['void', 'mh'=>'resource'],
15001500
'curl_multi_errno' => ['int', 'mh'=>'resource'],

resources/functionMap_php80delta.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
'ceil' => ['float', 'number'=>'float'],
3232
'com_load_typelib' => ['bool', 'typelib_name'=>'string', 'case_insensitive='=>'true'],
3333
'count_chars' => ['array<int,int>|string', 'input'=>'string', 'mode='=>'int'],
34+
'curl_init' => ['__benevolent<CurlHandle|false>', 'url='=>'string'],
3435
'date_add' => ['DateTime', 'object'=>'DateTime', 'interval'=>'DateInterval'],
3536
'date_date_set' => ['DateTime', 'object'=>'DateTime', 'year'=>'int', 'month'=>'int', 'day'=>'int'],
3637
'date_diff' => ['DateInterval', 'obj1'=>'DateTimeInterface', 'obj2'=>'DateTimeInterface', 'absolute='=>'bool'],
@@ -169,6 +170,7 @@
169170
'convert_cyr_string' => ['string', 'str'=>'string', 'from'=>'string', 'to'=>'string'],
170171
'com_load_typelib' => ['bool', 'typelib_name'=>'string', 'case_insensitive='=>'bool'],
171172
'count_chars' => ['array<int,int>|false|string', 'input'=>'string', 'mode='=>'int'],
173+
'curl_init' => ['__benevolent<resource|false>', 'url='=>'string'],
172174
'date_add' => ['DateTime|false', 'object'=>'DateTime', 'interval'=>'DateInterval'],
173175
'date_date_set' => ['DateTime|false', 'object'=>'DateTime', 'year'=>'int', 'month'=>'int', 'day'=>'int'],
174176
'date_diff' => ['DateInterval|false', 'obj1'=>'DateTimeInterface', 'obj2'=>'DateTimeInterface', 'absolute='=>'bool'],

src/Type/Php/CurlInitReturnTypeExtension.php

Lines changed: 0 additions & 102 deletions
This file was deleted.

tests/PHPStan/Analyser/AnalyserIntegrationTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,12 @@ public function testBug11511(): void
14431443
$this->assertSame('Access to an undefined property object::$bar.', $errors[0]->getMessage());
14441444
}
14451445

1446+
public function testBug11640(): void
1447+
{
1448+
$errors = $this->runAnalyse(__DIR__ . '/data/bug-11640.php');
1449+
$this->assertNoErrors($errors);
1450+
}
1451+
14461452
/**
14471453
* @param string[]|null $allAnalysedFiles
14481454
* @return Error[]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug11640;
4+
5+
$ch = curl_init('https://example.com');
6+
7+
if (!$ch) {
8+
9+
}

tests/PHPStan/Reflection/SignatureMap/Php8SignatureMapProviderTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use PHPStan\Reflection\PassedByReference;
1313
use PHPStan\Testing\PHPStanTestCase;
1414
use PHPStan\Type\ArrayType;
15+
use PHPStan\Type\BenevolentUnionType;
1516
use PHPStan\Type\BooleanType;
1617
use PHPStan\Type\CallableType;
1718
use PHPStan\Type\ClassStringType;
@@ -59,7 +60,7 @@ public function dataFunctions(): array
5960
'variadic' => false,
6061
],
6162
],
62-
new UnionType([
63+
new BenevolentUnionType([
6364
new ObjectType('CurlHandle'),
6465
new ConstantBooleanType(false),
6566
]),

tests/PHPStan/Type/Php/CurlInitReturnTypeExtensionTest.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

tests/PHPStan/Type/Php/data/curl-init-php-7.php

Lines changed: 0 additions & 65 deletions
This file was deleted.

tests/PHPStan/Type/Php/data/curl-init-php-8.php

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)