Fixed some deprecations.

This commit is contained in:
Jan Böhmer 2022-08-14 19:09:07 +02:00
parent 4fa8eef1bf
commit 5fd608f42a
59 changed files with 202 additions and 165 deletions

View file

@ -66,6 +66,7 @@ class EntityColumn extends AbstractColumn
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
*
* @param mixed $value The single value of the column
* @return mixed
*/
public function normalize($value)
{
@ -73,7 +74,7 @@ class EntityColumn extends AbstractColumn
return $value;
}
public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): self
{
parent::configureOptions($resolver);

View file

@ -28,12 +28,16 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class IconLinkColumn extends AbstractColumn
{
/**
* @param $value
* @return mixed
*/
public function normalize($value)
{
return $value;
}
public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): self
{
parent::configureOptions($resolver);
$resolver->setDefaults([
@ -51,7 +55,7 @@ class IconLinkColumn extends AbstractColumn
return $this;
}
public function render($value, $context)
public function render($value, $context): string
{
$href = $this->getHref($value, $context);
$icon = $this->getIcon($value, $context);

View file

@ -55,7 +55,12 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
*/
class LocaleDateTimeColumn extends AbstractColumn
{
public function normalize($value)
/**
* @param $value
* @return bool|mixed|string
* @throws \Exception
*/
public function normalize($value): string
{
if (null === $value) {
return $this->options['nullValue'];
@ -81,7 +86,7 @@ class LocaleDateTimeColumn extends AbstractColumn
return $formatter->format($value->getTimestamp());
}
protected function configureOptions(OptionsResolver $resolver)
protected function configureOptions(OptionsResolver $resolver): self
{
parent::configureOptions($resolver);

View file

@ -57,12 +57,16 @@ class LogEntryExtraColumn extends AbstractColumn
$this->formatter = $formatter;
}
/**
* @param $value
* @return mixed
*/
public function normalize($value)
{
return $value;
}
public function render($value, $context)
public function render($value, $context): string
{
return $this->formatter->format($context);
}

View file

@ -78,12 +78,16 @@ class LogEntryTargetColumn extends AbstractColumn
$this->translator = $translator;
}
/**
* @param $value
* @return mixed
*/
public function normalize($value)
{
return $value;
}
public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): self
{
parent::configureOptions($resolver);
$resolver->setDefault('show_associated', true);
@ -92,7 +96,7 @@ class LogEntryTargetColumn extends AbstractColumn
return $this;
}
public function render($value, $context)
public function render($value, $context): string
{
if ($context instanceof UserNotAllowedLogEntry && $this->options['showAccessDeniedPath']) {
return htmlspecialchars($context->getPath());

View file

@ -58,6 +58,7 @@ class MarkdownColumn extends AbstractColumn
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
*
* @param mixed $value The single value of the column
* @return mixed
*/
public function normalize($value)
{

View file

@ -68,13 +68,14 @@ class PartAttachmentsColumn extends AbstractColumn
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
*
* @param mixed $value The single value of the column
* @return mixed
*/
public function normalize($value)
{
return $value;
}
public function render($value, $context)
public function render($value, $context): string
{
if (!$context instanceof Part) {
throw new RuntimeException('$context must be a Part object!');
@ -107,7 +108,7 @@ class PartAttachmentsColumn extends AbstractColumn
return $tmp;
}
public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): self
{
parent::configureOptions($resolver);

View file

@ -42,12 +42,16 @@ class RevertLogColumn extends AbstractColumn
$this->security = $security;
}
/**
* @param $value
* @return mixed
*/
public function normalize($value)
{
return $value;
}
public function render($value, $context)
public function render($value, $context): string
{
if (
$context instanceof CollectionElementDeleted

View file

@ -58,6 +58,7 @@ class TagsColumn extends AbstractColumn
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
*
* @param mixed $value The single value of the column
* @return mixed
*/
public function normalize($value)
{
@ -68,7 +69,7 @@ class TagsColumn extends AbstractColumn
return explode(',', $value);
}
public function render($tags, $context)
public function render($tags, $context): string
{
$html = '';
$count = 10;