-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BCB] Removed MissingClosureNativeReturnTypehintRule, no longer neede…
…d thanks to type inference
- Loading branch information
1 parent
1baa294
commit 1c34d8d
Showing
8 changed files
with
60 additions
and
286 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
137 changes: 0 additions & 137 deletions
137
src/Rules/Missing/MissingClosureNativeReturnTypehintRule.php
This file was deleted.
Oops, something went wrong.
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
55 changes: 55 additions & 0 deletions
55
tests/PHPStan/Analyser/data/missing-closure-native-return-typehint.php
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,55 @@ | ||
<?php | ||
|
||
namespace MissingClosureNativeReturnTypehint; | ||
|
||
class Foo | ||
{ | ||
|
||
public function doFoo() | ||
{ | ||
\PHPStan\Testing\assertType('void', (function () { | ||
|
||
})()); | ||
\PHPStan\Testing\assertType('void', (function () { | ||
return; | ||
})()); | ||
\PHPStan\Testing\assertType('Generator<int, 1, mixed, void>', (function (bool $bool) { | ||
if ($bool) { | ||
return; | ||
} else { | ||
yield 1; | ||
} | ||
})()); | ||
\PHPStan\Testing\assertType('1|null', (function (bool $bool) { | ||
if ($bool) { | ||
return; | ||
} else { | ||
return 1; | ||
} | ||
})()); | ||
\PHPStan\Testing\assertType('1', (function (): int { | ||
return 1; | ||
})()); | ||
\PHPStan\Testing\assertType('1|null', (function (bool $bool) { | ||
if ($bool) { | ||
return null; | ||
} else { | ||
return 1; | ||
} | ||
})()); | ||
\PHPStan\Testing\assertType('1', (function (bool $bool) { | ||
if ($bool) { | ||
return 1; | ||
} | ||
})()); | ||
|
||
\PHPStan\Testing\assertType('array(\'foo\' => \'bar\')', (function () { | ||
$array = [ | ||
'foo' => 'bar', | ||
]; | ||
|
||
return $array; | ||
})()); | ||
} | ||
|
||
} |
77 changes: 0 additions & 77 deletions
77
tests/PHPStan/Rules/Missing/MissingClosureNativeReturnTypehintRuleTest.php
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.