mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-26 11:48:49 +02:00
Improved typing and phpdoc type annotations
This commit is contained in:
parent
3817ba774d
commit
b7c8ca2a48
39 changed files with 189 additions and 129 deletions
|
@ -58,6 +58,10 @@ final class TwigCoreExtension extends AbstractExtension
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $enum_class
|
||||
* @phpstan-param class-string $enum_class
|
||||
*/
|
||||
public function getEnumCases(string $enum_class): array
|
||||
{
|
||||
if (!enum_exists($enum_class)) {
|
||||
|
@ -75,12 +79,8 @@ final class TwigCoreExtension extends AbstractExtension
|
|||
];
|
||||
}
|
||||
|
||||
public function toArray($object)
|
||||
public function toArray(object|array $object): array
|
||||
{
|
||||
if(! is_object($object) && ! is_array($object)) {
|
||||
throw new \InvalidArgumentException('The given variable is not an object or array!');
|
||||
}
|
||||
|
||||
//If it is already an array, we can just return it
|
||||
if(is_array($object)) {
|
||||
return $object;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue