Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Sep 10, 2020
1 parent aaede39 commit 00ad098
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class A {

function assignToA(string $s) {
$a = new A();
$a->foo = strpos("haystack", $s);
$a->foo = strpos($s, "haystack");
}
```
2 changes: 1 addition & 1 deletion docs/running_psalm/issues/UnusedPsalmSuppress.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ Emitted when `--find-unused-psalm-suppress` is turned on and Psalm cannot find a
<?php

/** @psalm-suppress InvalidArgument */
echo strpos("hello", "e");
echo strlen("hello");
```
2 changes: 1 addition & 1 deletion tests/IssueSuppressionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testIssueSuppressedOnStatement()
'somefile.php',
'<?php
/** @psalm-suppress InvalidArgument */
echo strpos("hello", "e");'
echo strlen("hello");'
);

$this->analyzeFile('somefile.php', new \Psalm\Context());
Expand Down
2 changes: 1 addition & 1 deletion tests/Template/FunctionTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ function example($x, $y): void {}
* @param int|false $x
*/
function($x): void {},
[strpos("str", "str")]
[rand(0, 1) ? 5 : false]
);',
],
'ignoreTooManyArrayArgs' => [
Expand Down
7 changes: 5 additions & 2 deletions tests/TypeReconciliation/ScopeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,14 @@ function a(): string {
],
'repeatAssertionWithOther' => [
'<?php
$a = rand(0, 10) ? "hello" : null;
function getString() : string {
return "hello";
}
$a = rand(0, 10) ? getString() : null;
if (rand(0, 10) > 1 || is_string($a)) {
if (is_string($a)) {
echo strpos("e", $a);
echo strpos($a, "e");
}
}',
'assertions' => [
Expand Down

0 comments on commit 00ad098

Please sign in to comment.