Skip to content

Commit 5cb1d75

Browse files
committed
refactor: remove false from return type of command() and BootstrapFCPATHTest::readOutput()
PHPStan 2.x reports "unusedType" error when functions/methods return type hints include false but the function/method never returns false. Since ob_get_contents() and ob_get_clean() are guaranteed to return strings because output buffering was started right before them, these methods/functions never return false.
1 parent 1bf87a1 commit 5cb1d75

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎system/Common.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function clean_path(string $path): string
119119
*
120120
* > command('migrate:create SomeMigration');
121121
*
122-
* @return false|string
122+
* @return string
123123
*/
124124
function command(string $command)
125125
{

‎tests/system/Test/BootstrapFCPATHTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private function fileContents(): string
100100
return $fileContents . 'echo FCPATH;' . PHP_EOL;
101101
}
102102

103-
private function readOutput(string $file): false|string
103+
private function readOutput(string $file): string
104104
{
105105
ob_start();
106106
system('php -f ' . $file);

0 commit comments

Comments
 (0)