Your project must not use PHP super globals
- Read doc
- Productivity
- Critical
More information: https://insight.symfony.com/what-we-analyse/symfony.use_super_globals
- public function __invoke(SendContactEmail $message): void
- {
- $email = (new Email())
- ->from($message->getEmail())
- ->to($_ENV['EMAIL_TO'])
- ->subject("Portfolio contact from {$message->getName()}")
- ->html("
- <h2>New contact from your portfolio</h2>
- <p><strong>Name:</strong> {$message->getName()}</p>
- <p><strong>Email:</strong> {$message->getEmail()}</p>
Your project files must be encoded in UTF-8
- Read doc
- Reputation
- Critical
More information: https://insight.symfony.com/what-we-analyse/web.non_utf8_encoding
Your project must provide a favicon in its public directory
- Read doc
- Reputation
- Critical
More information: https://insight.symfony.com/what-we-analyse/web.missing_favicon
-
public
- images
- index.php
- robots.txt
- site.webmanifest
Your project error pages must be customised 2
- Read doc
- Reputation
- Critical
More information: https://insight.symfony.com/what-we-analyse/symfony.configuration.error_pages_should_be_customised
Your project must not contain invalid function or method calls 11
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_call
- public function __invoke(SendContactEmail $message): void
- {
- $email = (new Email())
- ->from($message->getEmail())
- ->to($_ENV['EMAIL_TO'])
- ->subject("Portfolio contact from {$message->getName()}")
- ->html("
- <h2>New contact from your portfolio</h2>
- <p><strong>Name:</strong> {$message->getName()}</p>
- <p><strong>Email:</strong> {$message->getEmail()}</p>
- $this->mailer->send($email);
- $contact = $this->contactRepository->find($message->getContactId());
- if ($contact) {
- $contact->setStatus('sent');
- $this->entityManager->flush();
- }
- }
- }
- $username = $input->getArgument('username');
- $password = $input->getArgument('password');
- $user = new User();
- $user->setUsername($username);
- $user->setRoles(['ROLE_ADMIN']);
- $user->setPassword(
- $this->passwordHasher->hashPassword($user, $password)
- );
- $user = new User();
- $user->setUsername($username);
- $user->setRoles(['ROLE_ADMIN']);
- $user->setPassword(
- $this->passwordHasher->hashPassword($user, $password)
- );
- $this->entityManager->persist($user);
- $this->entityManager->flush();
- $files = [$files];
- }
- $uploaded = [];
- foreach ($files as $file) {
- $image = $imageUploadService->upload($file);
- $uploaded[] = [
- 'id' => $image->getId(),
- 'filename' => $image->getFilename(),
- 'url' => $request->getSchemeAndHttpHost() . '/images/' . $image->getFilename(),
- 'uploaded_at' => $image->getUploadedAt()->format('Y-m-d H:i:s'),
- return;
- }
- $contact = $this->contactRepository->find($message->getContactId());
- if ($contact) {
- $contact->setStatus('failed');
- $this->entityManager->flush();
- }
- }
- }
- default => throw new BadRequestHttpException('Unsupported image type.'),
- };
- // Preserve transparency for PNG and GIF
- if (in_array($mime, ['image/png', 'image/gif'])) {
- imagepalettetotruecolor($source);
- imagealphablending($source, true);
- imagesavealpha($source, true);
- }
- imagewebp($source, $outputPath, 85);
- };
- // Preserve transparency for PNG and GIF
- if (in_array($mime, ['image/png', 'image/gif'])) {
- imagepalettetotruecolor($source);
- imagealphablending($source, true);
- imagesavealpha($source, true);
- }
- imagewebp($source, $outputPath, 85);
- imagedestroy($source);
- // Preserve transparency for PNG and GIF
- if (in_array($mime, ['image/png', 'image/gif'])) {
- imagepalettetotruecolor($source);
- imagealphablending($source, true);
- imagesavealpha($source, true);
- }
- imagewebp($source, $outputPath, 85);
- imagedestroy($source);
- }
- imagepalettetotruecolor($source);
- imagealphablending($source, true);
- imagesavealpha($source, true);
- }
- imagewebp($source, $outputPath, 85);
- imagedestroy($source);
- }
- }
- imagealphablending($source, true);
- imagesavealpha($source, true);
- }
- imagewebp($source, $outputPath, 85);
- imagedestroy($source);
- }
- }
Your project must not contain invalid instantiations 5
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.invalid_instantiation
- use App\Kernel;
- require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
- return function (array $context) {
- return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
- };
- $this->entityManager->persist($data);
- $this->entityManager->flush();
- $this->bus->dispatch(new SendContactEmail(
- $data->getName(),
- $data->getEmail(),
- $data->getMessage(),
- $data->getId(),
- ));
- $this->entityManager->persist($data);
- $this->entityManager->flush();
- $this->bus->dispatch(new SendContactEmail(
- $data->getName(),
- $data->getEmail(),
- $data->getMessage(),
- $data->getId(),
- ));
- return $data;
- $this->entityManager->flush();
- $this->bus->dispatch(new SendContactEmail(
- $data->getName(),
- $data->getEmail(),
- $data->getMessage(),
- $data->getId(),
- ));
- return $data;
- }
- $this->bus->dispatch(new SendContactEmail(
- $data->getName(),
- $data->getEmail(),
- $data->getMessage(),
- $data->getId(),
- ));
- return $data;
- }
- }
Your project should use return types 2
- Read doc
- Reliability
- Major
More information: https://insight.symfony.com/what-we-analyse/php.missing_return_typehint
- {
- $this->companyName = $companyName;
- return $this;
- }
- public function getTasks(): Collection { return $this->tasks; }
- public function addTask(Task $task): static
- {
- if (!$this->tasks->contains($task)) {
- $this->tasks->add($task);
- {
- $this->image = $image;
- return $this;
- }
- public function getTechnologies(): Collection { return $this->technologies; }
- public function addTechnology(Technology $technology): static
- {
- if (!$this->technologies->contains($technology)) {
- $this->technologies->add($technology);
Text files should end with a valid new line character.
- Read doc
- Productivity
- Info
More information: https://insight.symfony.com/what-we-analyse/missing_e_o_l