app:ly lint (php)

This commit is contained in:
Simon Vieille 2025-02-24 11:40:17 +01:00
commit 78f7bdd5ef
57 changed files with 156 additions and 246 deletions

View file

@ -1,30 +0,0 @@
[OK] Consuming messages from transport "async".
// The worker will automatically exit once it has received a stop signal via
// the messenger:stop-workers command.
// Quit the worker with CONTROL-C.
// Re-run the command with a -vv option to see logs about consumed messages.
[OK] Consuming messages from transport "async".
// The worker will automatically exit once it has received a stop signal via
// the messenger:stop-workers command.
// Quit the worker with CONTROL-C.
// Re-run the command with a -vv option to see logs about consumed messages.
[OK] Consuming messages from transport "async".
// The worker will automatically exit once it has received a stop signal via
// the messenger:stop-workers command.
// Quit the worker with CONTROL-C.
// Re-run the command with a -vv option to see logs about consumed messages.

View file

@ -29,7 +29,7 @@ class DateRangeAnalytic extends BaseDateRangeAnalytic
foreach ($entities as $key => $entity) {
if ('view' === $type) {
if ($this->path === null || str_starts_with($entity->getPath(), $this->path)) {
if (null === $this->path || str_starts_with($entity->getPath(), $this->path)) {
$newEntities[] = $entity;
}
}

View file

@ -36,7 +36,7 @@ class InfluxDB
public function isAvailable(): bool
{
return $this->getClient() !== null;
return null !== $this->getClient();
}
public function getClient(): ?Client

View file

@ -14,7 +14,7 @@ class TTRssClient
$result = @file_get_contents('https://tiny.deblan.org/deblan_api/?itemsPerPage=10&page='.$page);
if ($result) {
$result = str_replace('\\u0092', "'", $result);
$result = str_replace('\u0092', "'", $result);
$result = str_replace(''', "'", $result);
return json_decode($result, true);

View file

@ -127,14 +127,14 @@ class PostAdminController extends CrudController
},
])
->setBatchAction('index', 'delete', 'Delete', function (EntityInterface $entity, EntityManager $manager) {
$manager->delete($entity);
})
$manager->delete($entity);
})
->setBatchAction('index', 'draft', 'Statut : publier', function (EntityInterface $entity, EntityManager $manager) {
$manager->update($entity->setStatus(Post::PUBLISHED));
})
$manager->update($entity->setStatus(Post::PUBLISHED));
})
->setBatchAction('index', 'publish', 'Statut : brouillon', function (EntityInterface $entity, EntityManager $manager) {
$manager->update($entity->setStatus(Post::DRAFT));
})
$manager->update($entity->setStatus(Post::DRAFT));
})
;
}
@ -152,16 +152,16 @@ class PostAdminController extends CrudController
$entityManager,
$request,
function (Entity $entity, Form $form, Request $request) use ($fileUpload) {
$directory = 'uploads/post/'.date('Y');
$directory = 'uploads/post/'.date('Y');
$fileUpload->handleForm(
$form->get('image')->getData(),
$directory,
function ($filename) use ($entity, $directory) {
$entity->setImage($directory.'/'.$filename);
}
);
}
$fileUpload->handleForm(
$form->get('image')->getData(),
$directory,
function ($filename) use ($entity, $directory) {
$entity->setImage($directory.'/'.$filename);
}
);
}
);
}
@ -173,16 +173,16 @@ class PostAdminController extends CrudController
$entityManager,
$request,
function (Entity $entity, Form $form, Request $request) use ($fileUpload) {
$directory = 'uploads/post/'.date('Y');
$directory = 'uploads/post/'.date('Y');
$fileUpload->handleForm(
$form->get('image')->getData(),
$directory,
function ($filename) use ($entity, $directory) {
$entity->setImage($directory.'/'.$filename);
}
);
}
$fileUpload->handleForm(
$form->get('image')->getData(),
$directory,
function ($filename) use ($entity, $directory) {
$entity->setImage($directory.'/'.$filename);
}
);
}
);
}
@ -234,7 +234,7 @@ class PostAdminController extends CrudController
->setQuickVideo($opengraph['videos'][0]['url'] ?? null)
->setQuickVideoWidth($opengraph['videos'][0]['width'] ?? null)
->setQuickVideoHeight($opengraph['videos'][0]['height'] ?? null)
;
;
$entityManager->update($entity);
@ -283,7 +283,7 @@ class PostAdminController extends CrudController
'slug' => '-',
]))
->setNode($node)
;
;
return $this->render('blog/post_admin/stats.html.twig', [
'range' => $range,

View file

@ -7,20 +7,19 @@ use App\Core\Controller\Site\PageController;
use App\Core\Manager\EntityManager;
use App\Core\Site\SiteRequest;
use App\Core\Site\SiteStore;
use App\Core\Twig\Extension\BuilderExtension;
use App\Core\Twig\Extension\EditorJsExtension;
use App\Entity\Blog\Category;
use App\Entity\Blog\Post;
use App\Factory\Blog\CommentFactory;
use App\Form\Blog\UserCommentType;
use App\Manager\PostFollowManager;
use App\Markdown\Parser\Post as PostParser;
use App\Repository\Blog\PostRepositoryQuery;
use App\UrlGenerator\PostGenerator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use App\Factory\Blog\PostFollowFactory;
use App\Manager\PostFollowManager;
use App\Core\Twig\Extension\EditorJsExtension;
use App\Core\Twig\Extension\BuilderExtension;
class PostController extends PageController
{
@ -150,14 +149,13 @@ class PostController extends PageController
]);
}
public function tag(string $tag, int $page = 1): Response
{
}
public function tag(string $tag, int $page = 1): Response {}
public function createQuery(bool $isPreview = false): PostRepositoryQuery
{
$query = $this->postQuery->create()
->orderBy('.publishedAt', 'DESC');
->orderBy('.publishedAt', 'DESC')
;
if (!$isPreview) {
$query->published();
@ -170,15 +168,14 @@ class PostController extends PageController
PostParser $parser,
EditorJsExtension $editorJsExtension,
BuilderExtension $builderExtension
): Response
{
): Response {
$entities = $this->createQuery()->paginate(1, 20);
$items = [];
foreach ($entities as $entity) {
if ($entity->getContentFormat() === 'editorjs') {
if ('editorjs' === $entity->getContentFormat()) {
$description = $editorJsExtension->buildHtml($entity->getContent());
} elseif ($entity->getContentFormat() === 'builder') {
} elseif ('builder' === $entity->getContentFormat()) {
$description = $builderExtension->buildHtml($entity->getContent());
} else {
$description = $parser->transformMarkdown($entity->getContent());

View file

@ -4,10 +4,10 @@ namespace App\Controller;
use App\Core\Controller\Site\PageController;
use App\Core\Notification\MailNotifier;
use App\Core\Setting\SettingManager;
use App\Form\ContactType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use App\Core\Setting\SettingManager;
class ContactController extends PageController
{

View file

@ -3,10 +3,10 @@
namespace App\Controller;
use App\Core\Controller\Dashboard\DashboardAdminController as Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use App\Repository\Blog\PostRepositoryQuery;
use App\Repository\ProjectRepositoryQuery;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
#[Route(path: '/admin')]
class DashboardAdminController extends Controller
@ -15,8 +15,7 @@ class DashboardAdminController extends Controller
public function index(
PostRepositoryQuery $postQuery,
ProjectRepositoryQuery $projectQuery
): Response
{
): Response {
$posts = $postQuery->create()
->orderBy('.id', 'DESC')
->paginate(1, 4)

View file

@ -7,6 +7,7 @@ use App\Core\Crud\CrudConfiguration;
use App\Core\Crud\Field;
use App\Core\Entity\EntityInterface;
use App\Core\Manager\EntityManager;
use App\Entity\Project;
use App\Entity\Project as Entity;
use App\Factory\ProjectFactory as Factory;
use App\Form\ProjectType as Type;
@ -15,7 +16,6 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Routing\Annotation\Route;
use App\Entity\Project;
class ProjectAdminController extends CrudController
{
@ -114,13 +114,13 @@ class ProjectAdminController extends CrudController
'attr' => ['class' => 'miw-100'],
])
->setBatchAction('index', 'delete', 'Delete', function(EntityInterface $entity, EntityManager $manager) {
->setBatchAction('index', 'delete', 'Delete', function (EntityInterface $entity, EntityManager $manager) {
$manager->delete($entity);
})
->setBatchAction('index', 'draft', 'Statut : publier', function(EntityInterface $entity, EntityManager $manager) {
->setBatchAction('index', 'draft', 'Statut : publier', function (EntityInterface $entity, EntityManager $manager) {
$manager->update($entity->setStatus(Project::PUBLISHED));
})
->setBatchAction('index', 'publish', 'Statut : brouillon', function(EntityInterface $entity, EntityManager $manager) {
->setBatchAction('index', 'publish', 'Statut : brouillon', function (EntityInterface $entity, EntityManager $manager) {
$manager->update($entity->setStatus(Project::DRAFT));
})
;

View file

@ -110,7 +110,7 @@ class StlMeshAdminController extends CrudController
'attr' => ['class' => 'col-md-12'],
])
->setBatchAction('index', 'delete', 'Delete', function(EntityInterface $entity, EntityManager $manager) {
->setBatchAction('index', 'delete', 'Delete', function (EntityInterface $entity, EntityManager $manager) {
$manager->delete($entity);
})
;

View file

@ -2,13 +2,11 @@
namespace App\Controller;
use App\Api\TTRssClient;
use App\Core\Controller\Site\PageController;
use App\Markdown\Parser\Post as PostParser;
use Symfony\Component\HttpFoundation\Response;
use App\Repository\StlMeshRepositoryQuery;
use App\Entity\StlMesh;
use App\Repository\StlMeshRepositoryQuery;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\Routing\Annotation\Route;
@ -18,7 +16,8 @@ class StlMeshController extends PageController
{
$pager = $query->create()
->orderBy('.sortOrder')
->paginate(1, 200);
->paginate(1, 200)
;
return $this->defaultRender($this->siteRequest->getPage()->getTemplate(), [
'pager' => $pager,

View file

@ -2,9 +2,7 @@
namespace App\Controller;
use App\Api\TTRssClient;
use App\Core\Controller\Site\PageController;
use App\Markdown\Parser\Post as PostParser;
use Symfony\Component\HttpFoundation\Response;
class TextController extends PageController

View file

@ -7,9 +7,6 @@ use Symfony\Component\DependencyInjection\Extension\Extension;
class AppExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = $this->getConfiguration($configs, $container);
@ -18,9 +15,6 @@ class AppExtension extends Extension
$container->setParameter('app', $config);
}
/**
* {@inheritdoc}
*/
public function getConfiguration(array $configs, ContainerBuilder $container)
{
return new Configuration();

View file

@ -55,6 +55,16 @@ class Comment implements EntityInterface
$this->postFollows = new ArrayCollection();
}
public function __toString()
{
return sprintf(
'[%s] (%s) %s',
$this->getAuthor(),
$this->getCreatedAt()->format('d/m/Y'),
substr($this->getContent(), 0, 20).'…'
);
}
public function getId(): ?int
{
return $this->id;
@ -195,19 +205,6 @@ class Comment implements EntityInterface
return 'https://cdn.libravatar.org/avatar/'.$hash.'?s=90&d=retro';
}
/**
* {@inheritdoc}
*/
public function __toString()
{
return sprintf(
'[%s] (%s) %s',
$this->getAuthor(),
$this->getCreatedAt()->format('d/m/Y'),
substr($this->getContent(), 0, 20).'…'
);
}
/**
* @return Collection|PostFollow[]
*/

View file

@ -202,7 +202,7 @@ class Post implements EntityInterface
}
/**
* @return Collection|Category[]
* @return Category[]|Collection
*/
public function getCategories(): Collection
{

View file

@ -5,6 +5,4 @@ namespace App\Entity\Page;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
class CategoriesPage extends TitledPage
{
}
class CategoriesPage extends TitledPage {}

View file

@ -5,6 +5,4 @@ namespace App\Entity\Page;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
class CategoryPage extends TitledPage
{
}
class CategoryPage extends TitledPage {}

View file

@ -5,6 +5,4 @@ namespace App\Entity\Page;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
class ContactPage extends SimplePage
{
}
class ContactPage extends SimplePage {}

View file

@ -5,6 +5,4 @@ namespace App\Entity\Page;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
class LinksPage extends SimplePage
{
}
class LinksPage extends SimplePage {}

View file

@ -5,6 +5,4 @@ namespace App\Entity\Page;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
class MeshPage extends SimplePage
{
}
class MeshPage extends SimplePage {}

View file

@ -5,6 +5,4 @@ namespace App\Entity\Page;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
class PostPage extends TitledPage
{
}
class PostPage extends TitledPage {}

View file

@ -5,6 +5,4 @@ namespace App\Entity\Page;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
class PostsPage extends TitledPage
{
}
class PostsPage extends TitledPage {}

View file

@ -5,6 +5,4 @@ namespace App\Entity\Page;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
class SearchPage extends TitledPage
{
}
class SearchPage extends TitledPage {}

View file

@ -4,10 +4,9 @@ namespace App\Entity\Page;
use App\Core\Entity\Site\Page\Block;
use App\Core\Entity\Site\Page\FileBlock;
use App\Form\Type\SimpleMdTextareaBlockType;
use App\Form\MarkdownBlockType;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Form\FormBuilderInterface;
use App\Form\MarkdownBlockType;
#[ORM\Entity]
class SimplePage extends TitledPage

View file

@ -3,11 +3,10 @@
namespace App\Entity\Page;
use App\Core\Entity\Site\Page\Block;
use App\Core\Entity\Site\Page\FileBlock;
use App\Core\Entity\Site\Page\Page;
use App\Core\Form\Site\Page\TextareaBlockType;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Form\FormBuilderInterface;
use App\Core\Entity\Site\Page\Page;
#[ORM\Entity]
class TextPage extends Page

View file

@ -13,8 +13,8 @@ class Project implements EntityInterface
{
use Timestampable;
const DRAFT = 0;
const PUBLISHED = 1;
public const DRAFT = 0;
public const PUBLISHED = 1;
#[ORM\Id]
#[ORM\GeneratedValue]

View file

@ -2,9 +2,9 @@
namespace App\Entity;
use App\Core\Entity\EntityInterface;
use App\Repository\StlMeshRepository;
use Doctrine\ORM\Mapping as ORM;
use App\Core\Entity\EntityInterface;
#[ORM\Entity(repositoryClass: StlMeshRepository::class)]
class StlMesh implements EntityInterface
@ -86,7 +86,7 @@ class StlMesh implements EntityInterface
{
$this->files = (array) $this->files;
usort($this->files, function($a, $b) {
usort($this->files, function ($a, $b) {
if ($a['position'] > $b['position']) {
return 1;
}

View file

@ -50,9 +50,7 @@ class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFact
#[ORM\Column(type: 'boolean', options: ['default' => 0])]
private $isWriter;
public function __construct()
{
}
public function __construct() {}
public function __toString()
{

View file

@ -13,9 +13,7 @@ use Symfony\Component\Messenger\MessageBusInterface;
*/
class StatListener
{
public function __construct(protected MessageBusInterface $bus)
{
}
public function __construct(protected MessageBusInterface $bus) {}
public function onKernelRequest(RequestEvent $event)
{

View file

@ -4,12 +4,12 @@ namespace App\EventSubscriber;
use App\Core\Event\Setting\SettingEvent;
use App\Core\EventSubscriber\SettingEventSubscriber as EventSubscriber;
use App\Core\Form\FileManager\FilePickerType;
use App\Core\Form\Type\TinymceTextareaType;
use App\Core\Setting\SettingManager;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use App\Core\Form\FileManager\FilePickerType;
use App\Core\Form\Type\TinymceTextareaType;
/**
* class SettingEventSubscriber.

View file

@ -9,6 +9,4 @@ use App\Core\Factory\UserFactory as BaseUserFactory;
*
* @author Simon Vieille <simon@deblan.fr>
*/
class UserFactory extends BaseUserFactory
{
}
class UserFactory extends BaseUserFactory {}

View file

@ -3,6 +3,8 @@
namespace App\Form\Blog;
use App\Entity\Blog\Category;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
@ -10,8 +12,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\NotBlank;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
class CategoryType extends AbstractType
{

View file

@ -2,7 +2,6 @@
namespace App\Form\Blog;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

View file

@ -2,8 +2,13 @@
namespace App\Form\Blog;
use App\Core\Form\FileManager\FilePickerType;
use App\Core\Form\Type\BuilderType;
use App\Core\Form\Type\CollectionType as MurphCollectionType;
use App\Core\Form\Type\EditorJsTextareaType;
use App\Entity\Blog\Category;
use App\Entity\Blog\Post;
use App\Form\MarkdownType;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
@ -21,12 +26,6 @@ use Symfony\Component\Validator\Constraints\Image;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Range;
use Symfony\Component\Validator\Constraints\Url;
use App\Form\Type\SimpleMdTextareaType;
use App\Core\Form\Type\EditorJsTextareaType;
use App\Core\Form\FileManager\FilePickerType;
use App\Core\Form\Type\CollectionType as MurphCollectionType;
use App\Form\MarkdownType;
use App\Core\Form\Type\BuilderType;
class PostType extends AbstractType
{

View file

@ -3,7 +3,9 @@
namespace App\Form\Blog;
use App\Entity\Blog\Comment;
use Gregwar\CaptchaBundle\Type\CaptchaType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
@ -14,8 +16,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\Url;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Gregwar\CaptchaBundle\Type\CaptchaType;
class UserCommentType extends AbstractType
{

View file

@ -2,6 +2,7 @@
namespace App\Form;
use Gregwar\CaptchaBundle\Type\CaptchaType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
@ -10,7 +11,6 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
use Gregwar\CaptchaBundle\Type\CaptchaType;
class ContactType extends AbstractType
{

View file

@ -3,10 +3,10 @@
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Form\Extension\Core\Type\TextType;
class ProjectLinkType extends AbstractType
{

View file

@ -2,13 +2,13 @@
namespace App\Form;
use App\Core\Form\FileManager\FilePickerType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use App\Core\Form\FileManager\FilePickerType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Form\Extension\Core\Type\TextType;
class StlFileType extends AbstractType
{

View file

@ -8,9 +8,6 @@ use Symfony\Component\Form\FormView;
class SimpleMdTextareaType extends TextareaType
{
/**
* {@inheritdoc}
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
if (!isset($view->vars['attr']['data-simplemde'])) {

View file

@ -4,6 +4,4 @@ namespace App\Form;
use App\Core\Form\UserType as BaseUserType;
class UserType extends BaseUserType
{
}
class UserType extends BaseUserType {}

View file

@ -11,15 +11,9 @@ use Knp\Bundle\MarkdownBundle\Parser\MarkdownParser;
*/
class Post extends MarkdownParser
{
/**
* {@inheritdoc}
*/
//protected $id_class_attr_catch_re = '\{((?'.'>[ ]*[#.a-z][-_:a-zA-Z0-9="\'\/\*-]+){1,})[ ]*\}';
// protected $id_class_attr_catch_re = '\{((?'.'>[ ]*[#.a-z][-_:a-zA-Z0-9="\'\/\*-]+){1,})[ ]*\}';
protected $id_class_attr_catch_re = '\{([^\}]+)\}';
/**
* {@inheritdoc}
*/
public function transformMarkdown($text)
{
$html = parent::transformMarkdown($text);
@ -27,9 +21,6 @@ class Post extends MarkdownParser
return str_replace(' role="doc-endnote"', '', $html);
}
/**
* {@inheritdoc}
*/
protected function doExtraAttributes($tag_name, $attr, $defaultIdValue = null, $classes = [])
{
if (empty($attr) && !$defaultIdValue && empty($classes)) {
@ -102,8 +93,11 @@ class Post extends MarkdownParser
$codeblock
);
$codeblock = preg_replace_callback('/^\n+/',
[$this, '_doFencedCodeBlocks_newlines'], $codeblock);
$codeblock = preg_replace_callback(
'/^\n+/',
[$this, '_doFencedCodeBlocks_newlines'],
$codeblock
);
$classes = [];
if ('' != $classname) {

View file

@ -4,9 +4,7 @@ namespace App\Message;
final class PageViewMessage
{
public function __construct(public int $time)
{
}
public function __construct(public int $time) {}
public function getTime(): int
{

View file

@ -2,17 +2,15 @@
namespace App\MessageHandler;
use App\Message\PageViewMessage;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use App\Api\InfluxDB;
use InfluxDB2\WriteType;
use App\Message\PageViewMessage;
use InfluxDB2\Point;
use InfluxDB2\WriteType;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
final class PageViewMessageHandler implements MessageHandlerInterface
{
public function __construct(protected InfluxDB $influxDB)
{
}
public function __construct(protected InfluxDB $influxDB) {}
public function __invoke(PageViewMessage $message)
{

View file

@ -9,8 +9,8 @@ use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<AppEntityBlogPost>
*
* @method AppEntityBlogPost|null find($id, $lockMode = null, $lockVersion = null)
* @method AppEntityBlogPost|null findOneBy(array $criteria, array $orderBy = null)
* @method null|AppEntityBlogPost find($id, $lockMode = null, $lockVersion = null)
* @method null|AppEntityBlogPost findOneBy(array $criteria, array $orderBy = null)
* @method AppEntityBlogPost[] findAll()
* @method AppEntityBlogPost[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
@ -39,28 +39,28 @@ class AppEntityBlogPostRepository extends ServiceEntityRepository
}
}
// /**
// * @return AppEntityBlogPost[] Returns an array of AppEntityBlogPost objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('a')
// ->andWhere('a.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('a.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// /**
// * @return AppEntityBlogPost[] Returns an array of AppEntityBlogPost objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('a')
// ->andWhere('a.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('a.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?AppEntityBlogPost
// {
// return $this->createQueryBuilder('a')
// ->andWhere('a.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
// public function findOneBySomeField($value): ?AppEntityBlogPost
// {
// return $this->createQueryBuilder('a')
// ->andWhere('a.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View file

@ -7,8 +7,8 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Comment|null find($id, $lockMode = null, $lockVersion = null)
* @method Comment|null findOneBy(array $criteria, array $orderBy = null)
* @method null|Comment find($id, $lockMode = null, $lockVersion = null)
* @method null|Comment findOneBy(array $criteria, array $orderBy = null)
* @method Comment[] findAll()
* @method Comment[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/

View file

@ -3,8 +3,8 @@
namespace App\Repository\Blog;
use App\Core\Repository\RepositoryQuery;
use Knp\Component\Pager\PaginatorInterface;
use App\Repository\Blog\PostFollowRepository as Repository;
use Knp\Component\Pager\PaginatorInterface;
class PostFollowRepositoryQuery extends RepositoryQuery
{

View file

@ -151,7 +151,7 @@ class PostRepositoryQuery extends RepositoryQuery
}
}
$matches = array_filter($matches, function($match) use ($keywords) {
$matches = array_filter($matches, function ($match) use ($keywords) {
return (100 * $match['count'] / count($keywords)) > 80;
});

View file

@ -9,8 +9,8 @@ use Doctrine\ORM\ORMException;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Project|null find($id, $lockMode = null, $lockVersion = null)
* @method Project|null findOneBy(array $criteria, array $orderBy = null)
* @method null|Project find($id, $lockMode = null, $lockVersion = null)
* @method null|Project findOneBy(array $criteria, array $orderBy = null)
* @method Project[] findAll()
* @method Project[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/

View file

@ -3,9 +3,9 @@
namespace App\Repository;
use App\Core\Repository\RepositoryQuery;
use Knp\Component\Pager\PaginatorInterface;
use App\Repository\ProjectRepository as Repository;
use App\Entity\Project;
use App\Repository\ProjectRepository as Repository;
use Knp\Component\Pager\PaginatorInterface;
class ProjectRepositoryQuery extends RepositoryQuery
{

View file

@ -7,8 +7,8 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method StlMesh|null find($id, $lockMode = null, $lockVersion = null)
* @method StlMesh|null findOneBy(array $criteria, array $orderBy = null)
* @method null|StlMesh find($id, $lockMode = null, $lockVersion = null)
* @method null|StlMesh findOneBy(array $criteria, array $orderBy = null)
* @method StlMesh[] findAll()
* @method StlMesh[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/

View file

@ -3,8 +3,8 @@
namespace App\Repository;
use App\Core\Repository\RepositoryQuery;
use Knp\Component\Pager\PaginatorInterface;
use App\Repository\StlMeshRepository as Repository;
use Knp\Component\Pager\PaginatorInterface;
class StlMeshRepositoryQuery extends RepositoryQuery
{

View file

@ -6,9 +6,8 @@ use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface
{

View file

@ -135,10 +135,12 @@ class BlogExtension extends AbstractExtension
'#<code langage=\'([^\']*)\'>(.*)</code>#isU',
],
function ($data) {
$lang = strtolower(str_replace(
['console', 'texte', 'apache'],
['bash', 'text', 'html'],
$data[1])
$lang = strtolower(
str_replace(
['console', 'texte', 'apache'],
['bash', 'text', 'html'],
$data[1]
)
);
$class = 'language-'.$lang;

View file

@ -30,9 +30,9 @@ class ColorExtension extends AbstractExtension
return sprintf(
'#%s%s%s',
strlen($red) != 2 ? '0'.$red : $red,
strlen($green) != 2 ? '0'.$green : $green,
strlen($blue) != 2 ? '0'.$blue : $blue,
2 != strlen($red) ? '0'.$red : $red,
2 != strlen($green) ? '0'.$green : $green,
2 != strlen($blue) ? '0'.$blue : $blue,
);
}
}

View file

@ -21,7 +21,7 @@ class LazyLoadExtension extends AbstractExtension
public function lazyLoad($text)
{
$text = preg_replace_callback(
return preg_replace_callback(
'`<img src="([^"]+)" alt="([^"]+)" />`isU',
function ($data) {
$lazy = sprintf('<img class="lazy-img" src="#" data-src="%s" alt="%s" />', $data[1], $data[2]);
@ -31,7 +31,5 @@ class LazyLoadExtension extends AbstractExtension
},
$text
);
return $text;
}
}

View file

@ -4,7 +4,6 @@ namespace App\Twig\Extension;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;
class TypoExtension extends AbstractExtension
{

View file

@ -3,7 +3,6 @@
namespace App\UrlGenerator;
use App\Core\Entity\Site\Node;
use App\Entity\Blog\Category;
use App\Repository\Blog\CategoryRepositoryQuery;
use App\Repository\Blog\PostRepositoryQuery;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;