Skip to content

Commit

Permalink
fixed psalm issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bidi47 committed Feb 12, 2024
1 parent e6c3e64 commit 2a3e831
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 8 deletions.
9 changes: 4 additions & 5 deletions config/autoload/doctrine.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
use Frontend\App\Resolver\EntityListenerResolver;
use Ramsey\Uuid\Doctrine\UuidBinaryOrderedTimeType;
use Ramsey\Uuid\Doctrine\UuidBinaryType;
use Ramsey\Uuid\Doctrine\UuidType;
Expand All @@ -23,28 +22,28 @@
],
],
'doctrine' => [
'connection' => [
'connection' => [
'orm_default' => [
'doctrine_mapping_types' => [
UuidBinaryType::NAME => 'binary',
UuidBinaryOrderedTimeType::NAME => 'binary',
],
],
],
'driver' => [
'driver' => [
// default metadata driver, aggregates all other drivers into a single one.
// Override `orm_default` only if you know what you're doing
'orm_default' => [
'class' => MappingDriverChain::class,
'drivers' => [],
],
],
'types' => [
'types' => [
UuidType::NAME => UuidType::class,
UuidBinaryType::NAME => UuidBinaryType::class,
UuidBinaryOrderedTimeType::NAME => UuidBinaryOrderedTimeType::class,
],
'fixtures' => getcwd() . '/data/doctrine/fixtures',
'fixtures' => getcwd() . '/data/doctrine/fixtures',
],
'resultCacheLifetime' => 600,
];
2 changes: 1 addition & 1 deletion src/Contact/src/Controller/ContactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public function formAction(): ResponseInterface
$this->messenger->addError('Missing recaptcha');
return new RedirectResponse($request->getUri(), 303);
}

$data['subject'] = $data['subject'] ?: $this->config['application']['name'] . ' Contact';
$form->setData($data);
if ($form->isValid()) {
/** @var array $dataForm */
$dataForm = $form->getData();
$result = $this->messageService->processMessage($dataForm);

Expand Down
2 changes: 2 additions & 0 deletions src/Contact/src/Form/ContactForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
use Laminas\Form\Element\Text;
use Laminas\Form\Element\Textarea;
use Laminas\Form\Form;
use Laminas\Form\FormInterface;
use Laminas\InputFilter\InputFilterInterface;

/** @template-extends Form<FormInterface> */
class ContactForm extends Form
{
protected InputFilterInterface $inputFilter;
Expand Down
11 changes: 9 additions & 2 deletions src/User/src/Controller/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ public function requestResetPasswordAction(): ResponseInterface
return new RedirectResponse($this->getRequest()->getUri(), 303);
}

$user = $this->userService->findOneBy(['identity' => $form->getData()['identity']]);
/** @var array $data */
$data = $form->getData();
$user = $this->userService->findOneBy(['identity' => $data['identity']]);

Check warning on line 139 in src/User/src/Controller/AccountController.php

View check run for this annotation

Codecov / codecov/patch

src/User/src/Controller/AccountController.php#L138-L139

Added lines #L138 - L139 were not covered by tests
if (! $user instanceof User) {
$this->messenger->addInfo(Message::MAIL_SENT_RESET_PASSWORD, 'request-reset');
return new RedirectResponse($this->getRequest()->getUri());
Expand Down Expand Up @@ -201,10 +203,12 @@ public function resetPasswordAction(): ResponseInterface
return new RedirectResponse($this->getRequest()->getUri(), 303);
}

/** @var array $data */
$data = $form->getData();

Check warning on line 207 in src/User/src/Controller/AccountController.php

View check run for this annotation

Codecov / codecov/patch

src/User/src/Controller/AccountController.php#L207

Added line #L207 was not covered by tests
try {
$this->userService->updateUser(
$resetPasswordRequest->markAsCompleted()->getUser(),
$form->getData()
$data

Check warning on line 211 in src/User/src/Controller/AccountController.php

View check run for this annotation

Codecov / codecov/patch

src/User/src/Controller/AccountController.php#L211

Added line #L211 was not covered by tests
);
$this->debugBar->stackData();
} catch (Exception $exception) {
Expand Down Expand Up @@ -299,6 +303,7 @@ public function detailsAction(): ResponseInterface
if (RequestMethodInterface::METHOD_POST === $this->request->getMethod()) {
$form->setData($this->request->getParsedBody());
if ($form->isValid()) {
/** @var array $userData */
$userData = $form->getData();
try {
$this->userService->updateUser($user, $userData);
Expand Down Expand Up @@ -363,6 +368,7 @@ public function changePasswordAction(): ResponseInterface
if (RequestMethodInterface::METHOD_POST === $this->request->getMethod()) {
$form->setData($this->request->getParsedBody());
if ($form->isValid()) {
/** @var array $userData */
$userData = $form->getData();
try {
$this->userService->updateUser($user, $userData);
Expand Down Expand Up @@ -416,6 +422,7 @@ public function deleteAccountAction(): ResponseInterface
if (RequestMethodInterface::METHOD_POST === $this->request->getMethod()) {
$form->setData($this->request->getParsedBody());
if ($form->isValid()) {
/** @var array $userData */
$userData = $form->getData();
try {
$this->userService->updateUser($user, $userData);
Expand Down
2 changes: 2 additions & 0 deletions src/User/src/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function loginAction(): ResponseInterface
if ($form->isValid()) {
/** @var AuthenticationAdapter $adapter */
$adapter = $this->authenticationService->getAdapter();
/** @var array $data */
$data = $form->getData();
$adapter->setIdentity($data['identity'])->setCredential($data['password']);
$authResult = $this->authenticationService->authenticate();
Expand Down Expand Up @@ -146,6 +147,7 @@ public function registerAction(): ResponseInterface
if (RequestMethodInterface::METHOD_POST === $this->getRequest()->getMethod()) {
$form->setData($this->getRequest()->getParsedBody());
if ($form->isValid()) {
/** @var array $userData */
$userData = $form->getData();
try {
/** @var User $user */
Expand Down
2 changes: 2 additions & 0 deletions src/User/src/Form/LoginForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
use Laminas\Form\Element\Password;
use Laminas\Form\Element\Submit;
use Laminas\Form\Form;
use Laminas\Form\FormInterface;
use Laminas\InputFilter\InputFilterInterface;

/** @template-extends Form<FormInterface> */
class LoginForm extends Form
{
protected InputFilterInterface $inputFilter;
Expand Down
2 changes: 2 additions & 0 deletions src/User/src/Form/ProfileDeleteForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
use Frontend\User\InputFilter\ProfileDeleteInputFilter;
use Laminas\Form\Element\Submit;
use Laminas\Form\Form;
use Laminas\Form\FormInterface;
use Laminas\InputFilter\InputFilterInterface;

/** @template-extends Form<FormInterface> */
class ProfileDeleteForm extends Form
{
protected InputFilterInterface $inputFilter;
Expand Down
2 changes: 2 additions & 0 deletions src/User/src/Form/ProfileDetailsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
use Frontend\User\InputFilter\UserDetailInputFilter;
use Laminas\Form\Element\Submit;
use Laminas\Form\Form;
use Laminas\Form\FormInterface;
use Laminas\InputFilter\InputFilter;
use Laminas\InputFilter\InputFilterInterface;

/** @template-extends Form<FormInterface> */
class ProfileDetailsForm extends Form
{
protected InputFilterInterface $inputFilter;
Expand Down
2 changes: 2 additions & 0 deletions src/User/src/Form/ProfilePasswordForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
use Laminas\Form\Element\Password;
use Laminas\Form\Element\Submit;
use Laminas\Form\Form;
use Laminas\Form\FormInterface;
use Laminas\InputFilter\InputFilterInterface;

/** @template-extends Form<FormInterface> */
class ProfilePasswordForm extends Form
{
protected InputFilterInterface $inputFilter;
Expand Down
2 changes: 2 additions & 0 deletions src/User/src/Form/RegisterForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
use Laminas\Form\Element\Password;
use Laminas\Form\Element\Submit;
use Laminas\Form\Form;
use Laminas\Form\FormInterface;
use Laminas\InputFilter\InputFilterInterface;

/** @template-extends Form<FormInterface> */
class RegisterForm extends Form
{
protected InputFilterInterface $inputFilter;
Expand Down
2 changes: 2 additions & 0 deletions src/User/src/Form/RequestResetPasswordForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
use Laminas\Form\Element\Email;
use Laminas\Form\Element\Submit;
use Laminas\Form\Form;
use Laminas\Form\FormInterface;
use Laminas\InputFilter\InputFilterInterface;

/** @template-extends Form<FormInterface> */
class RequestResetPasswordForm extends Form
{
protected InputFilterInterface $inputFilter;
Expand Down
2 changes: 2 additions & 0 deletions src/User/src/Form/ResetPasswordForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
use Laminas\Form\Element\Password;
use Laminas\Form\Element\Submit;
use Laminas\Form\Form;
use Laminas\Form\FormInterface;
use Laminas\InputFilter\InputFilterInterface;

/** @template-extends Form<FormInterface> */
class ResetPasswordForm extends Form
{
protected InputFilterInterface $inputFilter;
Expand Down
2 changes: 2 additions & 0 deletions src/User/src/Form/UploadAvatarForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
use Frontend\User\Fieldset\AvatarFieldset;
use Laminas\Form\Element\Submit;
use Laminas\Form\Form;
use Laminas\Form\FormInterface;
use Laminas\InputFilter\InputFilterInterface;

/** @template-extends Form<FormInterface> */
class UploadAvatarForm extends Form
{
protected InputFilterInterface $inputFilter;
Expand Down

0 comments on commit 2a3e831

Please sign in to comment.