1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-26 18:21:02 +00:00

Modernize to PHP 8.1

This commit is contained in:
Yassine Guedidi 2025-04-05 14:01:48 +02:00
parent ca018c77e3
commit 9e2720cddc
26 changed files with 48 additions and 52 deletions

View file

@ -350,7 +350,7 @@ class ConfigController extends AbstractController
$backupCodes = (new BackupCodes())->toArray();
$backupCodesHashed = array_map(
fn ($backupCode) => password_hash($backupCode, \PASSWORD_DEFAULT),
fn ($backupCode) => password_hash((string) $backupCode, \PASSWORD_DEFAULT),
$backupCodes
);

View file

@ -67,7 +67,7 @@ class EntryController extends AbstractController
$action = 'tag';
if (isset($values['tags'])) {
$labels = array_filter(explode(',', $values['tags']),
$labels = array_filter(explode(',', (string) $values['tags']),
function ($v) {
$v = trim($v);
@ -616,7 +616,7 @@ class EntryController extends AbstractController
*/
private function showEntries($type, Request $request, $page)
{
$searchTerm = (isset($request->query->all('search_entry')['term']) ? trim($request->query->all('search_entry')['term']) : '');
$searchTerm = (isset($request->query->all('search_entry')['term']) ? trim((string) $request->query->all('search_entry')['term']) : '');
$currentRoute = $request->query->get('currentRoute') ?? '';
$currentEntryId = $request->attributes->getInt('id');

View file

@ -45,10 +45,10 @@ class TagController extends AbstractController
$form->handleRequest($request);
$tags = $form->get('label')->getData() ?? '';
$tagsExploded = explode(',', $tags);
$tagsExploded = explode(',', (string) $tags);
// avoid too much tag to be added
if (\count($tagsExploded) >= NewTagType::MAX_TAGS || \strlen($tags) >= NewTagType::MAX_LENGTH) {
if (\count($tagsExploded) >= NewTagType::MAX_TAGS || \strlen((string) $tags) >= NewTagType::MAX_LENGTH) {
$message = $translator->trans('flashes.tag.notice.too_much_tags', [
'%tags%' => NewTagType::MAX_TAGS,
'%characters%' => NewTagType::MAX_LENGTH,
@ -250,7 +250,7 @@ class TagController extends AbstractController
// check to avoid duplicate tags creation
foreach ($this->entityManager->getUnitOfWork()->getScheduledEntityInsertions() as $entity) {
if ($entity instanceof Tag && strtolower($entity->getLabel()) === strtolower($filter)) {
if ($entity instanceof Tag && strtolower($entity->getLabel()) === strtolower((string) $filter)) {
continue 2;
}
$this->entityManager->persist($entry);