Fixed some errors introduced by earlier typings

This commit is contained in:
Jan Böhmer 2023-06-18 16:01:28 +02:00
parent b7c8ca2a48
commit cbdf0a9392
6 changed files with 6 additions and 18 deletions

View file

@ -79,8 +79,6 @@ abstract class AttachmentContainingDBElement extends AbstractNamedDBElement impl
/**
* Gets all attachments associated with this element.
*
* @phpstan-return Collection<int, AT>
*/
public function getAttachments(): Collection
{

View file

@ -141,10 +141,10 @@ abstract class AbstractLogEntry extends AbstractDBElement
#[ORM\Column(type: Types::STRING)]
protected string $username = '';
/** @var \DateTimeInterface|null The datetime the event associated with this log entry has occured
/** @var \DateTimeInterface The datetime the event associated with this log entry has occured
*/
#[ORM\Column(name: 'datetime', type: Types::DATETIME_MUTABLE)]
protected ?\DateTimeInterface $timestamp = null;
protected \DateTimeInterface $timestamp;
/** @var int The priority level of the associated level. 0 is highest, 7 lowest
*/
@ -249,7 +249,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
/**
* Returns the timestamp when the event that caused this log entry happened.
*/
public function getTimestamp(): \DateTimeInterface|null
public function getTimestamp(): \DateTimeInterface
{
return $this->timestamp;
}

View file

@ -43,7 +43,7 @@ class StructuralElementFromNameDenormalizer implements DenormalizerInterface
}
/**
* @template T
* @template T of AbstractStructuralDBElement
* @phpstan-param class-string<T> $type
* @phpstan-return T|null
*/

View file

@ -60,9 +60,7 @@ final class LabelGenerator
}
/**
* @param object|object[] $elements An element or an array of elements for which labels should be generated
*
* @return null|string
* @param object|object[] $elements An element or an array of elements for which labels should be generated
*/
public function generateLabel(LabelOptions $options, object|array $elements): string
{

View file

@ -38,7 +38,7 @@ final class TwigCoreExtension extends AbstractExtension
{
}
public function getFunctions()
public function getFunctions(): array
{
return [
/* Returns the enum cases as values */

View file

@ -65,12 +65,4 @@ class TwigCoreExtensionTest extends WebTestCase
$this->assertEqualsCanonicalizing(['test' => 1, 'test4' => 7], $this->service->toArray($obj));
}
public function testToArrayException(): void
{
//When passing a simple scalar value a exception should be thrown.
$this->expectException(\InvalidArgumentException::class);
$this->service->toArray(1);
}
}