Applied symplify rules to codebase.

This commit is contained in:
Jan Böhmer 2020-01-05 22:49:00 +01:00
parent 2f20d90041
commit 388e847b17
136 changed files with 1370 additions and 789 deletions

View file

@ -24,7 +24,10 @@ declare(strict_types=1);
namespace App\DataTables\Column;
use DateTime;
use DateTimeInterface;
use IntlDateFormatter;
use Locale;
use Omines\DataTablesBundle\Column\AbstractColumn;
use Symfony\Component\OptionsResolver\OptionsResolver;
@ -38,8 +41,8 @@ class LocaleDateTimeColumn extends AbstractColumn
{
if (null === $value) {
return $this->options['nullValue'];
} elseif (! $value instanceof \DateTimeInterface) {
$value = new \DateTime((string) $value);
} elseif (! $value instanceof DateTimeInterface) {
$value = new DateTime((string) $value);
}
$formatValues = [
@ -51,7 +54,7 @@ class LocaleDateTimeColumn extends AbstractColumn
];
$formatter = IntlDateFormatter::create(
\Locale::getDefault(),
Locale::getDefault(),
$formatValues[$this->options['dateFormat']],
$formatValues[$this->options['timeFormat']],
$value->getTimezone()

View file

@ -30,6 +30,7 @@ use App\Services\Attachments\AttachmentManager;
use App\Services\EntityURLGenerator;
use App\Services\FAIconGenerator;
use Omines\DataTablesBundle\Column\AbstractColumn;
use RuntimeException;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PartAttachmentsColumn extends AbstractColumn
@ -60,7 +61,7 @@ class PartAttachmentsColumn extends AbstractColumn
public function render($value, $context)
{
if (! $context instanceof Part) {
throw new \RuntimeException('$context must be a Part object!');
throw new RuntimeException('$context must be a Part object!');
}
$tmp = '';
$attachments = $context->getAttachments()->filter(function (Attachment $attachment) {