Skip to content

Commit

Permalink
minor #1458 Misc minor fixes (javiereguiluz)
Browse files Browse the repository at this point in the history
This PR was merged into the main branch.

Discussion
----------

Misc minor fixes

Found with PHPStorm "inspect code" feature.

Commits
-------

a46453f Misc minor fixes
  • Loading branch information
javiereguiluz committed Nov 24, 2023
2 parents f59041d + a46453f commit d802a81
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Form/PostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
// of the form handling process.
// See https://symfony.com/doc/current/form/events.html
->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) {
/** @var Post */
/** @var Post $post */
$post = $event->getData();
if (null === $post->getSlug() && null !== $post->getTitle()) {
$post->setSlug($this->slugger->slug($post->getTitle())->lower());
Expand Down
3 changes: 1 addition & 2 deletions src/Repository/PostRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ public function findBySearchQuery(string $query, int $limit = Paginator::PAGE_SI
*/
private function extractSearchTerms(string $searchQuery): array
{
$searchQuery = u($searchQuery)->replaceMatches('/[[:space:]]+/', ' ')->trim();
$terms = array_unique($searchQuery->split(' '));
$terms = array_unique(u($searchQuery)->replaceMatches('/[[:space:]]+/', ' ')->trim()->split(' '));

// ignore the search terms that are too short
return array_filter($terms, static function ($term) {
Expand Down
5 changes: 1 addition & 4 deletions src/Twig/SourceCodeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,7 @@ public function linkSourceFile(Environment $twig, string $file, int $line): stri
);
}

/**
* @param string|TemplateWrapper $template
*/
public function showSourceCode(Environment $twig, $template): string
public function showSourceCode(Environment $twig, string|TemplateWrapper $template): string
{
return $twig->render('debug/source_code.html.twig', [
'controller' => $this->getController(),
Expand Down

0 comments on commit d802a81

Please sign in to comment.