Skip to content

Commit 4313835

Browse files
committed
Merge branch 2.2.x into 2.3.x
2 parents 81fcc40 + 7546cd6 commit 4313835

5 files changed

Lines changed: 101 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Rules\Functions;
4+
5+
use PHPStan\Rules\FunctionCallParametersCheck;
6+
use PHPStan\Rules\NullsafeCheck;
7+
use PHPStan\Rules\PhpDoc\UnresolvableTypeHelper;
8+
use PHPStan\Rules\Properties\PropertyReflectionFinder;
9+
use PHPStan\Rules\Rule;
10+
use PHPStan\Rules\RuleLevelHelper;
11+
use PHPStan\Testing\RuleTestCase;
12+
13+
/**
14+
* @extends RuleTestCase<CallToFunctionParametersRule>
15+
*/
16+
class CallToFunctionParametersRulePhp74Test extends RuleTestCase
17+
{
18+
19+
protected function getRule(): Rule
20+
{
21+
$broker = self::createReflectionProvider();
22+
return new CallToFunctionParametersRule(
23+
$broker,
24+
new FunctionCallParametersCheck(
25+
new RuleLevelHelper(
26+
$broker,
27+
checkNullables: true,
28+
checkThisOnly: false,
29+
checkUnionTypes: true,
30+
checkExplicitMixed: true,
31+
checkImplicitMixed: true,
32+
checkBenevolentUnionTypes: false,
33+
discoveringSymbolsTip: true,
34+
),
35+
new NullsafeCheck(),
36+
new UnresolvableTypeHelper(),
37+
new PropertyReflectionFinder(),
38+
$broker,
39+
checkArgumentTypes: true,
40+
checkArgumentsPassedByReference: true,
41+
checkExtraArguments: true,
42+
checkMissingTypehints: true,
43+
),
44+
);
45+
}
46+
47+
public function testBug15139(): void
48+
{
49+
$this->analyse([__DIR__ . '/data/bug-15139.php'], []);
50+
}
51+
52+
public function testBug15141(): void
53+
{
54+
$this->analyse([__DIR__ . '/data/bug-15141.php'], []);
55+
}
56+
57+
public function testBug15185(): void
58+
{
59+
$this->analyse([__DIR__ . '/data/bug-15185.php'], []);
60+
}
61+
62+
public static function getAdditionalConfigFiles(): array
63+
{
64+
return [
65+
__DIR__ . '/data/call-to-function-php74.neon',
66+
];
67+
}
68+
69+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Bug15139;
4+
5+
$curl = curl_init();
6+
assert(is_resource($curl));
7+
$result = curl_exec($curl);
8+
$curl_info = curl_getinfo($curl);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Bug15141;
4+
5+
$content = '';
6+
$finfo = finfo_open(FILEINFO_MIME_TYPE);
7+
if ($finfo === FALSE) {
8+
throw new \RuntimeException('Cannot create finfo instance.');
9+
}
10+
11+
$type = (string) finfo_buffer($finfo, $content);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug15185;
4+
5+
use function PHPStan\dumpType;
6+
use function PHPStan\Testing\assertType;
7+
8+
$handle = curl_init();
9+
10+
if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ), true ) ) {
11+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
parameters:
2+
phpVersion: 70400

0 commit comments

Comments
 (0)