-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incremented numeric-string should change to int/float
- Loading branch information
Showing
8 changed files
with
98 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace Bug10122; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
function doFoo():void | ||
{ | ||
function(string $s) { | ||
assertType('(float|int|string)', ++$s); | ||
}; | ||
function(string $s) { | ||
assertType('(float|int|string)', --$s); | ||
}; | ||
function(string $s) { | ||
assertType('string', $s++); | ||
assertType('(float|int|string)', $s); | ||
}; | ||
function(string $s) { | ||
assertType('string', $s--); | ||
assertType('(float|int|string)', $s); | ||
}; | ||
|
||
function(float $f) { | ||
assertType('float', ++$f); | ||
}; | ||
function(float $f) { | ||
assertType('float', --$f); | ||
}; | ||
function(float $f) { | ||
assertType('float', $f++); | ||
}; | ||
function(float $f) { | ||
assertType('float', $f--); | ||
}; | ||
} | ||
|
||
/** @param numeric-string $ns */ | ||
function doNumericString(string $ns) { | ||
function() use ($ns) { | ||
assertType('(float|int)', ++$ns); | ||
}; | ||
function() use ($ns) { | ||
assertType('(float|int)', --$ns); | ||
}; | ||
function() use ($ns) { | ||
assertType('numeric-string', $ns++); | ||
assertType('(float|int)', $ns); | ||
}; | ||
function() use ($ns) { | ||
assertType('numeric-string', $ns--); | ||
assertType('(float|int)', $ns); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Bug10187; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
function inc(string $n): string | ||
{ | ||
$before = $n; | ||
$after = ++$n; | ||
assertType('array{n: (float|int|string), before: string, after: (float|int|string)}', compact('n', 'before', 'after')); | ||
|
||
return (string)$after; // No warnings expected here | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters