Skip to content

Commit

Permalink
Regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jul 12, 2022
1 parent 2cd83b2 commit a838bb4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -573,4 +573,18 @@ public function testConditionalTypesInference(): void
]);
}

public function testBug6697(): void
{
$this->checkAlwaysTrueCheckTypeFunctionCall = true;
$this->treatPhpDocTypesAsCertain = true;
$this->analyse([__DIR__ . '/data/bug-6697.php'], []);
}

public function testBug6443(): void
{
$this->checkAlwaysTrueCheckTypeFunctionCall = true;
$this->treatPhpDocTypesAsCertain = true;
$this->analyse([__DIR__ . '/data/bug-6443.php'], []);
}

}
23 changes: 23 additions & 0 deletions tests/PHPStan/Rules/Comparison/data/bug-6443.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Bug6443;

/**
* String utilities for frequent tasks
*/
class StringUtils
{
public static function stringify(
mixed $anyValue,
string $arrayConcatChar = ", "
): string {
// this cases are always empty strings
if ($anyValue === null || (is_array($anyValue) && !$anyValue)) {
return "";
}
if (is_array($anyValue)) {
return implode($arrayConcatChar, $anyValue);
}
return "blub";
}
}
5 changes: 5 additions & 0 deletions tests/PHPStan/Rules/Comparison/data/bug-6697.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

namespace Bug6697;

$result = \is_subclass_of( '\\My\\Namespace\\MyClass', '\\My\\Namespace\\MyBaseClass', true);

0 comments on commit a838bb4

Please sign in to comment.