-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Typed conditional returns for
non-empty-array
typed methods
- Loading branch information
Showing
2 changed files
with
95 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\StaticAnalysis\DBAL; | ||
|
||
use Doctrine\DBAL\Portability\Converter; | ||
|
||
/** @return false */ | ||
function convertNumericFalse(Converter $converter): bool | ||
{ | ||
return $converter->convertNumeric(false); | ||
} | ||
|
||
/** @return list<mixed> */ | ||
function convertNumericEmptyArray(Converter $converter): array | ||
{ | ||
return $converter->convertNumeric([]); | ||
} | ||
|
||
/** @return non-empty-list<mixed> */ | ||
function convertNumericNonEmptyArray(Converter $converter): array | ||
{ | ||
return $converter->convertNumeric(['foo']); | ||
} | ||
|
||
/** @return false */ | ||
function convertAssociativeFalse(Converter $converter): bool | ||
{ | ||
return $converter->convertAssociative(false); | ||
} | ||
|
||
/** @return array<string, mixed> */ | ||
function convertAssociativeEmptyArray(Converter $converter): array | ||
{ | ||
return $converter->convertAssociative([]); | ||
} | ||
|
||
/** @return non-empty-array<string, mixed> */ | ||
function convertAssociativeNonEmptyArray(Converter $converter): array | ||
{ | ||
return $converter->convertAssociative(['foo' => 'bar']); | ||
} | ||
|
||
/** @return list<list<mixed>> */ | ||
function convertAllNumericEmptyArray(Converter $converter): array | ||
{ | ||
return $converter->convertAllNumeric([[]]); | ||
} | ||
|
||
/** @return list<non-empty-list<mixed>> */ | ||
function convertAllNumericNonEmptyArray(Converter $converter): array | ||
{ | ||
return $converter->convertAllNumeric([['foo']]); | ||
} | ||
|
||
|
||
/** @return list<array<string, mixed>> */ | ||
function convertAllAssociativeEmptyArray(Converter $converter): array | ||
{ | ||
return $converter->convertAllAssociative([[]]); | ||
} | ||
|
||
/** @return list<non-empty-array<string, mixed>> */ | ||
function convertAllAssociativeNonEmptyArray(Converter $converter): array | ||
{ | ||
return $converter->convertAllAssociative([['foo' => 'bar']]); | ||
} | ||
|