[CORE][I18n] Fixing 'file_get_contents(): Argument #1 () must be of type string, Symfony\Component\Finder\SplFileInfo given' error by using Symfony's Finder to iterate through existing files

This commit is contained in:
Eliseu Amaro 2022-01-22 19:16:35 +00:00
parent 6b1c6f603e
commit e4a3438d55
Signed by: eliseuamaro
GPG Key ID: 96DA09D4B97BC2D5
5 changed files with 25 additions and 12 deletions

View File

@ -16,9 +16,9 @@
{% if notes is defined %}
<header class="feed-header">
{% if page_title is defined %}
<h1 class="heading-no-margin">{{ page_title | trans }}</h1>
<span class="section-title">{{ page_title | trans }}</span>
{% else %}
<h3 class="heading-no-margin">{{ 'Notes' | trans }}</h3>
<span class="section-title">{{ 'Notes' | trans }}</span>
{% endif %}
<nav class="feed-actions">
<details class="feed-actions-details">
@ -50,6 +50,10 @@
{% endblock current_note %}
{% endfor %}
</section>
{% else %}
<section class="feed h-feed hfeed notes" tabindex="0" role="feed">
<span>{% trans %}No notes here...{% endtrans %}</span>
</section>
{% endif %}
{% endif %}
{% endblock body %}

8
composer.lock generated
View File

@ -12582,12 +12582,12 @@
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "cac291fde5db3a668d39700e4af63b67ed220c53"
"reference": "649dea45d6490e93a80cdb543c13b28468b6d133"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/cac291fde5db3a668d39700e4af63b67ed220c53",
"reference": "cac291fde5db3a668d39700e4af63b67ed220c53",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/649dea45d6490e93a80cdb543c13b28468b6d133",
"reference": "649dea45d6490e93a80cdb543c13b28468b6d133",
"shasum": ""
},
"require": {
@ -12639,7 +12639,7 @@
"type": "tidelift"
}
],
"time": "2022-01-21T08:16:01+00:00"
"time": "2022-01-22T10:13:49+00:00"
},
{
"name": "phpunit/php-code-coverage",

View File

@ -175,7 +175,7 @@ class Favourite extends FeedController
return [
'_template' => 'collection/notes.html.twig',
'page_title' => 'Favourites feed.',
'page_title' => 'Favourites',
'notes' => $notes,
];
}

View File

@ -133,7 +133,13 @@
.feed-header {
display: flex;
margin-bottom: var(--m);
margin-top: var(--s);
margin-bottom: var(--s);
align-items: center;
}
.feed-header .section-title {
font-size: 1.383rem;
}
.feed-header .feed-actions {

View File

@ -95,7 +95,7 @@ class TransExtractor extends AbstractFileExtractor implements ExtractorInterface
/**
* Prefix for new found message.
*/
private string $prefix = '';
private string $prefix = ' ';
/**
* {@inheritDoc}
@ -106,10 +106,13 @@ class TransExtractor extends AbstractFileExtractor implements ExtractorInterface
return;
}
$files = $this->extractFiles($dir);
foreach ($files as $file) {
$this->parseTokens(token_get_all(file_get_contents($file)), $catalog, $file);
// Find all files in the current directory
$finder = new Finder();
$finder->files()->in($dir);
foreach ($finder as $file) {
$absoluteFilePath = $file->getRealPath();
$this->parseTokens(token_get_all(file_get_contents($absoluteFilePath)), $catalog, $absoluteFilePath);
gc_mem_caches();
}
}