Skip to content

Commit

Permalink
Regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Oct 3, 2022
1 parent 35cac5a commit a57127c
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
Expand Up @@ -162,4 +162,28 @@ public function testBug7952(): void
$this->analyse([__DIR__ . '/data/bug-7952.php'], []);
}

public function testBug8058(): void
{
if (PHP_VERSION_ID < 80200) {
$this->markTestSkipped('Test requires PHP 8.2');
}

$this->analyse([__DIR__ . '/../Methods/data/bug-8058.php'], []);
}

public function testBug8058b(): void
{
if (PHP_VERSION_ID >= 80200) {
$this->markTestSkipped('Test requires PHP before 8.2');
}

$this->analyse([__DIR__ . '/../Methods/data/bug-8058.php'], [
[
'Function mysqli_execute_query not found.',
13,
'Learn more at https://phpstan.org/user-guide/discovering-symbols',
],
]);
}

}
29 changes: 29 additions & 0 deletions tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php
Expand Up @@ -2628,4 +2628,33 @@ public function testBug7600(): void
$this->analyse([__DIR__ . '/data/bug-7600.php'], []);
}

public function testBug8058(): void
{
if (PHP_VERSION_ID < 80200) {
$this->markTestSkipped('Test requires PHP 8.2');
}
$this->checkThisOnly = false;
$this->checkNullables = false;
$this->checkUnionTypes = false;
$this->checkExplicitMixed = false;
$this->analyse([__DIR__ . '/data/bug-8058.php'], []);
}

public function testBug8058b(): void
{
if (PHP_VERSION_ID >= 80200) {
$this->markTestSkipped('Test requires PHP before 8.2');
}
$this->checkThisOnly = false;
$this->checkNullables = false;
$this->checkUnionTypes = false;
$this->checkExplicitMixed = false;
$this->analyse([__DIR__ . '/data/bug-8058.php'], [
[
'Call to an undefined method mysqli::execute_query().',
11,
],
]);
}

}
15 changes: 15 additions & 0 deletions tests/PHPStan/Rules/Methods/data/bug-8058.php
@@ -0,0 +1,15 @@
<?php

namespace Bug8058;

use function PHPStan\Testing\assertType;

class Foo
{
public function syntaxError(\mysqli $mysqli, string $s): void
{
$mysqli->execute_query($s);

\mysqli_execute_query($mysqli, $s);
}
}

0 comments on commit a57127c

Please sign in to comment.