mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-29 21:14:29 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
6caf605fe2
commit
e01b06fb85
80 changed files with 173 additions and 218 deletions
|
@ -153,7 +153,7 @@ class FetchJoinORMAdapter extends ORMAdapter
|
|||
$query->setIdentifierPropertyPath($this->mapFieldToPropertyPath($identifier, $aliases));
|
||||
}
|
||||
|
||||
protected function getSimpleTotalCount(QueryBuilder $queryBuilder)
|
||||
protected function getSimpleTotalCount(QueryBuilder $queryBuilder): int
|
||||
{
|
||||
/** The paginator count queries can be rather slow, so when query for total count (100ms or longer),
|
||||
* just return the entity count.
|
||||
|
|
|
@ -191,8 +191,8 @@ class ORMAdapter extends AbstractAdapter
|
|||
;
|
||||
}
|
||||
|
||||
$query = $builder->getQuery();
|
||||
$event = new ORMAdapterQueryEvent($query);
|
||||
$q = $builder->getQuery();
|
||||
$event = new ORMAdapterQueryEvent($q);
|
||||
$state->getDataTable()->getEventDispatcher()->dispatch($event, ORMAdapterEvents::PRE_QUERY);
|
||||
|
||||
foreach ($query->iterate([], $this->hydrationMode) as $result) {
|
||||
|
@ -301,7 +301,7 @@ class ORMAdapter extends AbstractAdapter
|
|||
->setDefaults([
|
||||
'hydrate' => Query::HYDRATE_OBJECT,
|
||||
'query' => [],
|
||||
'criteria' => function (Options $options) {
|
||||
'criteria' => static function (Options $options) {
|
||||
return [new SearchCriteriaProvider()];
|
||||
},
|
||||
])
|
||||
|
@ -324,7 +324,9 @@ class ORMAdapter extends AbstractAdapter
|
|||
{
|
||||
if ($provider instanceof QueryBuilderProcessorInterface) {
|
||||
return $provider;
|
||||
} elseif (is_callable($provider)) {
|
||||
}
|
||||
|
||||
if (is_callable($provider)) {
|
||||
return new class($provider) implements QueryBuilderProcessorInterface {
|
||||
private $callable;
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class EntityColumn extends AbstractColumn
|
|||
|
||||
$resolver->setRequired('property');
|
||||
|
||||
$resolver->setDefault('field', function (Options $option) {
|
||||
$resolver->setDefault('field', static function (Options $option) {
|
||||
return $option['property'].'.name';
|
||||
});
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class IconLinkColumn extends AbstractColumn
|
|||
return $provider;
|
||||
}
|
||||
if (is_callable($provider)) {
|
||||
return call_user_func($provider, $value, $context);
|
||||
return $provider($value, $context);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -91,7 +91,7 @@ class IconLinkColumn extends AbstractColumn
|
|||
return $provider;
|
||||
}
|
||||
if (is_callable($provider)) {
|
||||
return call_user_func($provider, $value, $context);
|
||||
return $provider($value, $context);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -104,7 +104,7 @@ class IconLinkColumn extends AbstractColumn
|
|||
return $provider;
|
||||
}
|
||||
if (is_callable($provider)) {
|
||||
return call_user_func($provider, $value, $context);
|
||||
return $provider($value, $context);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -117,7 +117,7 @@ class IconLinkColumn extends AbstractColumn
|
|||
return $provider;
|
||||
}
|
||||
if (is_callable($provider)) {
|
||||
return call_user_func($provider, $value, $context);
|
||||
return $provider($value, $context);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -102,7 +102,7 @@ class LogDataTable implements DataTableTypeInterface
|
|||
$optionsResolver->setAllowedTypes('filter_elements', ['array', 'object']);
|
||||
$optionsResolver->setAllowedTypes('mode', 'string');
|
||||
|
||||
$optionsResolver->setNormalizer('filter_elements', function (Options $options, $value) {
|
||||
$optionsResolver->setNormalizer('filter_elements', static function (Options $options, $value) {
|
||||
if (!is_array($value)) {
|
||||
return [$value];
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ class LogDataTable implements DataTableTypeInterface
|
|||
|
||||
$dataTable->add('symbol', TextColumn::class, [
|
||||
'label' => '',
|
||||
'render' => function ($value, AbstractLogEntry $context) {
|
||||
'render' => static function ($value, AbstractLogEntry $context) {
|
||||
switch ($context->getLevelString()) {
|
||||
case LogLevel::DEBUG:
|
||||
$symbol = 'fa-bug';
|
||||
|
@ -191,7 +191,7 @@ class LogDataTable implements DataTableTypeInterface
|
|||
'label' => $this->translator->trans('log.level'),
|
||||
'visible' => 'system_log' === $options['mode'],
|
||||
'propertyPath' => 'levelString',
|
||||
'render' => function (string $value, AbstractLogEntry $context) {
|
||||
'render' => static function (string $value, AbstractLogEntry $context) {
|
||||
return $value;
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -118,7 +118,7 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
$optionsResolver->setAllowedTypes('search', ['null', 'string']);
|
||||
|
||||
//Configure search options
|
||||
$optionsResolver->setDefault('search_options', function (OptionsResolver $resolver): void {
|
||||
$optionsResolver->setDefault('search_options', static function (OptionsResolver $resolver): void {
|
||||
$resolver->setDefaults([
|
||||
'name' => true,
|
||||
'category' => true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue