mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +00:00
Modernize to PHP 7.4
This commit is contained in:
parent
ce8ed589d5
commit
4168727f36
21 changed files with 31 additions and 75 deletions
|
@ -107,9 +107,7 @@ class ImportCommand extends Command
|
|||
|
||||
// Turning off doctrine default logs queries for saving memory
|
||||
$middlewares = $this->entityManager->getConnection()->getConfiguration()->getMiddlewares();
|
||||
$middlewaresWithoutLogging = array_filter($middlewares, function (Middleware $middleware) {
|
||||
return !$middleware instanceof LoggingMiddleware;
|
||||
});
|
||||
$middlewaresWithoutLogging = array_filter($middlewares, fn (Middleware $middleware) => !$middleware instanceof LoggingMiddleware);
|
||||
$this->entityManager->getConnection()->getConfiguration()->setMiddlewares($middlewaresWithoutLogging);
|
||||
|
||||
if ($input->getOption('useUserId')) {
|
||||
|
|
|
@ -132,9 +132,7 @@ class EntryRestController extends WallabagRestController
|
|||
}
|
||||
|
||||
if (false === $returnId) {
|
||||
$results = array_map(function ($v) {
|
||||
return null !== $v;
|
||||
}, $results);
|
||||
$results = array_map(fn ($v) => null !== $v, $results);
|
||||
}
|
||||
|
||||
$results = $this->replaceUrlHashes($results, $urlHashMap);
|
||||
|
|
|
@ -367,9 +367,7 @@ class ConfigController extends AbstractController
|
|||
|
||||
$backupCodes = (new BackupCodes())->toArray();
|
||||
$backupCodesHashed = array_map(
|
||||
function ($backupCode) {
|
||||
return password_hash($backupCode, \PASSWORD_DEFAULT);
|
||||
},
|
||||
fn ($backupCode) => password_hash($backupCode, \PASSWORD_DEFAULT),
|
||||
$backupCodes
|
||||
);
|
||||
|
||||
|
|
|
@ -89,9 +89,7 @@ abstract class WallabagMigration extends AbstractMigration
|
|||
*/
|
||||
protected function generateIdentifierName(array $columnNames, string $prefix = ''): string
|
||||
{
|
||||
$hash = implode('', array_map(static function ($column): string {
|
||||
return dechex(crc32($column));
|
||||
}, $columnNames));
|
||||
$hash = implode('', array_map(static fn ($column): string => dechex(crc32($column)), $columnNames));
|
||||
|
||||
return strtoupper(substr($prefix . '_' . $hash, 0, $this->platform->getMaxIdentifierLength()));
|
||||
}
|
||||
|
|
|
@ -34,9 +34,7 @@ class AuthenticatorProvider implements ExpressionFunctionProviderInterface
|
|||
function (): void {
|
||||
throw new \Exception('Not supported');
|
||||
},
|
||||
function (array $arguments, $uri) {
|
||||
return $this->requestHtmlFunctionClient->request('GET', $uri)->getContent();
|
||||
}
|
||||
fn (array $arguments, $uri) => $this->requestHtmlFunctionClient->request('GET', $uri)->getContent()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,12 +28,8 @@ class ClientType extends AbstractType
|
|||
|
||||
$builder->get('redirect_uris')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function ($originalUri) {
|
||||
return $originalUri;
|
||||
},
|
||||
function ($submittedUri) {
|
||||
return [$submittedUri];
|
||||
}
|
||||
fn ($originalUri) => $originalUri,
|
||||
fn ($submittedUri) => [$submittedUri]
|
||||
))
|
||||
;
|
||||
}
|
||||
|
|
|
@ -294,9 +294,7 @@ class DownloadImages
|
|||
preg_match_all($pattern, $srcsetAttribute, $matches);
|
||||
|
||||
$srcset = \call_user_func_array('array_merge', $matches);
|
||||
$srcsetUrls = array_map(function ($src) {
|
||||
return trim(explode(' ', $src, 2)[0]);
|
||||
}, $srcset);
|
||||
$srcsetUrls = array_map(fn ($src) => trim(explode(' ', $src, 2)[0]), $srcset);
|
||||
$urls = array_merge($srcsetUrls, $urls);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,13 +40,11 @@ abstract class HtmlImport extends AbstractImport
|
|||
return false;
|
||||
}
|
||||
|
||||
$entries = $hrefs->each(function (Crawler $node) {
|
||||
return [
|
||||
'url' => $node->attr('href'),
|
||||
'tags' => $node->attr('tags'),
|
||||
'created_at' => $node->attr('add_date'),
|
||||
];
|
||||
});
|
||||
$entries = $hrefs->each(fn (Crawler $node) => [
|
||||
'url' => $node->attr('href'),
|
||||
'tags' => $node->attr('tags'),
|
||||
'created_at' => $node->attr('add_date'),
|
||||
]);
|
||||
|
||||
if ($this->producer) {
|
||||
$this->parseEntriesForProducer($entries);
|
||||
|
|
|
@ -56,13 +56,11 @@ class PocketHtmlImport extends HtmlImport
|
|||
return false;
|
||||
}
|
||||
|
||||
$entries = $hrefs->each(function (Crawler $node) {
|
||||
return [
|
||||
'url' => $node->attr('href'),
|
||||
'tags' => $node->attr('tags'),
|
||||
'created_at' => $node->attr('time_added'),
|
||||
];
|
||||
});
|
||||
$entries = $hrefs->each(fn (Crawler $node) => [
|
||||
'url' => $node->attr('href'),
|
||||
'tags' => $node->attr('tags'),
|
||||
'created_at' => $node->attr('time_added'),
|
||||
]);
|
||||
|
||||
if ($this->producer) {
|
||||
$this->parseEntriesForProducer($entries);
|
||||
|
|
|
@ -289,9 +289,7 @@ class EntryRepository extends ServiceEntityRepository
|
|||
|
||||
if ('metadata' === $detail) {
|
||||
$fieldNames = $this->getClassMetadata()->getFieldNames();
|
||||
$fields = array_filter($fieldNames, function ($k) {
|
||||
return 'content' !== $k;
|
||||
});
|
||||
$fields = array_filter($fieldNames, fn ($k) => 'content' !== $k);
|
||||
$qb->select(\sprintf('partial e.{%s}', implode(',', $fields)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue