Fixed some more phpstan issues

This commit is contained in:
Jan Böhmer 2023-06-18 00:00:58 +02:00
parent 2f46fbfc7a
commit e8771ea118
77 changed files with 192 additions and 109 deletions

View file

@ -39,7 +39,7 @@ use Omines\DataTablesBundle\Adapter\Doctrine\FetchJoinORMAdapter;
*/
class CustomFetchJoinORMAdapter extends FetchJoinORMAdapter
{
public function getCount(QueryBuilder $queryBuilder, $identifier): ?int
public function getCount(QueryBuilder $queryBuilder, $identifier): int
{
$qb_without_group_by = clone $queryBuilder;
@ -50,6 +50,6 @@ class CustomFetchJoinORMAdapter extends FetchJoinORMAdapter
$paginator = new Paginator($qb_without_group_by);
return $paginator->count();
return $paginator->count() ?? 0;
}
}

View file

@ -41,13 +41,16 @@ class EntityColumn extends AbstractColumn
* @param mixed $value The single value of the column
* @return mixed
*/
public function normalize($value)
public function normalize($value): mixed
{
/** @var AbstractNamedDBElement $value */
return $value;
}
public function configureOptions(OptionsResolver $resolver): self
/**
* @return $this
*/
public function configureOptions(OptionsResolver $resolver): static
{
parent::configureOptions($resolver);

View file

@ -50,12 +50,15 @@ class IconLinkColumn extends AbstractColumn
* @param $value
* @return mixed
*/
public function normalize($value)
public function normalize($value): mixed
{
return $value;
}
public function configureOptions(OptionsResolver $resolver): self
/**
* @return $this
*/
public function configureOptions(OptionsResolver $resolver): static
{
parent::configureOptions($resolver);
$resolver->setDefaults([

View file

@ -79,6 +79,9 @@ class LocaleDateTimeColumn extends AbstractColumn
);
}
/**
* @return $this
*/
protected function configureOptions(OptionsResolver $resolver): self
{
parent::configureOptions($resolver);

View file

@ -36,7 +36,7 @@ class LogEntryExtraColumn extends AbstractColumn
* @param $value
* @return mixed
*/
public function normalize($value)
public function normalize($value): mixed
{
return $value;
}

View file

@ -52,11 +52,14 @@ class LogEntryTargetColumn extends AbstractColumn
* @param $value
* @return mixed
*/
public function normalize($value)
public function normalize($value): mixed
{
return $value;
}
/**
* @return $this
*/
public function configureOptions(OptionsResolver $resolver): self
{
parent::configureOptions($resolver);

View file

@ -37,7 +37,7 @@ class MarkdownColumn extends AbstractColumn
* @param mixed $value The single value of the column
* @return mixed
*/
public function normalize($value)
public function normalize($value): mixed
{
return $this->markdown->markForRendering($value, true);
}

View file

@ -43,7 +43,7 @@ class PartAttachmentsColumn extends AbstractColumn
* @param mixed $value The single value of the column
* @return mixed
*/
public function normalize($value)
public function normalize($value): mixed
{
return $value;
}
@ -79,6 +79,9 @@ class PartAttachmentsColumn extends AbstractColumn
return $tmp;
}
/**
* @return $this
*/
public function configureOptions(OptionsResolver $resolver): self
{
parent::configureOptions($resolver);

View file

@ -59,7 +59,7 @@ class RevertLogColumn extends AbstractColumn
* @param $value
* @return mixed
*/
public function normalize($value)
public function normalize($value): mixed
{
return $value;
}

View file

@ -29,6 +29,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class RowClassColumn extends AbstractColumn
{
/**
* @return $this
*/
public function configureOptions(OptionsResolver $resolver): self
{
parent::configureOptions($resolver);
@ -44,7 +47,7 @@ class RowClassColumn extends AbstractColumn
return $this;
}
public function initialize(string $name, int $index, array $options, DataTable $dataTable)
public function initialize(string $name, int $index, array $options, DataTable $dataTable): void
{
//The field name is always "$$rowClass" as this is the name the frontend controller expects
parent::initialize('$$rowClass', $index, $options, $dataTable); // TODO: Change the autogenerated stub

View file

@ -32,6 +32,9 @@ class SIUnitNumberColumn extends AbstractColumn
{
}
/**
* @return $this
*/
public function configureOptions(OptionsResolver $resolver): self
{
parent::configureOptions($resolver);

View file

@ -30,6 +30,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
*/
class SelectColumn extends AbstractColumn
{
/**
* @return $this
*/
public function configureOptions(OptionsResolver $resolver): self
{
parent::configureOptions($resolver);
@ -48,7 +51,7 @@ class SelectColumn extends AbstractColumn
/**
* @return mixed
*/
public function normalize($value)
public function normalize($value): mixed
{
return $value;
}

View file

@ -37,7 +37,7 @@ class TagsColumn extends AbstractColumn
* @param mixed $value The single value of the column
* @return mixed
*/
public function normalize($value)
public function normalize($value): mixed
{
if (empty($value)) {
return [];
@ -48,6 +48,10 @@ class TagsColumn extends AbstractColumn
public function render($tags, $context): string
{
if (!is_iterable($tags)) {
throw new \LogicException('TagsColumn::render() expects an iterable');
}
$html = '';
$count = 10;
foreach ($tags as $tag) {

View file

@ -29,19 +29,13 @@ use Doctrine\ORM\QueryBuilder;
class ParameterConstraint extends AbstractConstraint
{
/** @var string */
protected string $name;
protected string $name = '';
/** @var string */
protected string $symbol;
protected string $symbol = '';
/** @var string */
protected string $unit;
protected string $unit = '';
/** @var TextConstraint */
protected TextConstraint $value_text;
/** @var ParameterValueConstraint */
protected ParameterValueConstraint $value;
/** @var string The alias to use for the subquery */

View file

@ -123,7 +123,7 @@ class LogDataTable implements DataTableTypeInterface
'label' => 'log.timestamp',
'timeFormat' => 'medium',
'render' => fn(string $value, AbstractLogEntry $context): string => sprintf('<a href="%s">%s</a>',
$this->urlGenerator->generate('log_details', ['id' => $context->getId()]),
$this->urlGenerator->generate('log_details', ['id' => $context->getID()]),
$value
)
]);