Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tools #732

Merged
merged 2 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ parameters:
count: 1
path: tests/DependencyInjection/NucleosUserExtensionTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\TestCase\\:\\:createStub\\(\\)\\.$#"
count: 1
path: tests/Form/Type/ResettingFormTypeTest.php

-
message: "#^Method Nucleos\\\\UserBundle\\\\Tests\\\\Model\\\\BaseUserManagerTest\\:\\:getUserManager\\(\\) has parameter \\$args with no value type specified in iterable type array\\.$#"
count: 1
Expand Down
6 changes: 3 additions & 3 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.7.7@e028ba46ba0d7f9a78bc3201c251e137383e145f">
<file src="src/Action/UpdateSecurityAction.php">
<files psalm-version="5.16.0@2897ba636551a8cb61601cc26f6ccfbba6c36591">
<file src="src/Action/ResetAction.php">
<InvalidNullableReturnType>
<code>Response</code>
</InvalidNullableReturnType>
<NullableReturnStatement>
<code><![CDATA[$event->getResponse()]]></code>
</NullableReturnStatement>
</file>
<file src="src/Action/ResetAction.php">
<file src="src/Action/UpdateSecurityAction.php">
<InvalidNullableReturnType>
<code>Response</code>
</InvalidNullableReturnType>
Expand Down
5 changes: 5 additions & 0 deletions src/Action/RequestResetAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,17 @@

private readonly int $retryTtl;

/**
* @var UserProviderInterface<UserInterface>
*/
private readonly UserProviderInterface $userProvider;

private readonly TranslatorInterface $translator;

/**
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*
* @param UserProviderInterface<UserInterface> $userProvider
*/
public function __construct(
Environment $twig,
Expand Down Expand Up @@ -87,9 +92,9 @@
public function __invoke(Request $request): Response
{
$form = $this->createForm();
$form->handleRequest($request);

Check warning on line 95 in src/Action/RequestResetAction.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ public function __invoke(Request $request) : Response { $form = $this->createForm(); - $form->handleRequest($request); + if ($form->isSubmitted() && $form->isValid()) { $response = $this->process($request); $this->getFlashBag($request)?->add('success', $this->translator->trans('resetting.check_email', ['%tokenLifetime%' => ceil($this->retryTtl / 3600)], 'NucleosUserBundle'));

Check warning on line 95 in src/Action/RequestResetAction.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ public function __invoke(Request $request) : Response { $form = $this->createForm(); - $form->handleRequest($request); + if ($form->isSubmitted() && $form->isValid()) { $response = $this->process($request); $this->getFlashBag($request)?->add('success', $this->translator->trans('resetting.check_email', ['%tokenLifetime%' => ceil($this->retryTtl / 3600)], 'NucleosUserBundle'));

if ($form->isSubmitted() && $form->isValid()) {

Check warning on line 97 in src/Action/RequestResetAction.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "LogicalAndSingleSubExprNegation": --- Original +++ New @@ @@ { $form = $this->createForm(); $form->handleRequest($request); - if ($form->isSubmitted() && $form->isValid()) { + if ($form->isSubmitted() && !$form->isValid()) { $response = $this->process($request); $this->getFlashBag($request)?->add('success', $this->translator->trans('resetting.check_email', ['%tokenLifetime%' => ceil($this->retryTtl / 3600)], 'NucleosUserBundle')); if (null !== $response) {

Check warning on line 97 in src/Action/RequestResetAction.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "LogicalAndSingleSubExprNegation": --- Original +++ New @@ @@ { $form = $this->createForm(); $form->handleRequest($request); - if ($form->isSubmitted() && $form->isValid()) { + if ($form->isSubmitted() && !$form->isValid()) { $response = $this->process($request); $this->getFlashBag($request)?->add('success', $this->translator->trans('resetting.check_email', ['%tokenLifetime%' => ceil($this->retryTtl / 3600)], 'NucleosUserBundle')); if (null !== $response) {
$response = $this->process($request);

$this->getFlashBag($request)
Expand Down Expand Up @@ -190,11 +195,11 @@
private function createForm(): FormInterface
{
return $this->formFactory
->create(RequestPasswordFormType::class, null, [

Check warning on line 198 in src/Action/RequestResetAction.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } private function createForm() : FormInterface { - return $this->formFactory->create(RequestPasswordFormType::class, null, ['action' => $this->router->generate('nucleos_user_resetting_request'), 'method' => 'POST'])->add('save', SubmitType::class, ['label' => 'resetting.request.submit']); + return $this->formFactory->create(RequestPasswordFormType::class, null, ['method' => 'POST'])->add('save', SubmitType::class, ['label' => 'resetting.request.submit']); } }

Check warning on line 198 in src/Action/RequestResetAction.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } private function createForm() : FormInterface { - return $this->formFactory->create(RequestPasswordFormType::class, null, ['action' => $this->router->generate('nucleos_user_resetting_request'), 'method' => 'POST'])->add('save', SubmitType::class, ['label' => 'resetting.request.submit']); + return $this->formFactory->create(RequestPasswordFormType::class, null, ['method' => 'POST'])->add('save', SubmitType::class, ['label' => 'resetting.request.submit']); } }
'action' => $this->router->generate('nucleos_user_resetting_request'),
'method' => 'POST',
])
->add('save', SubmitType::class, [

Check warning on line 202 in src/Action/RequestResetAction.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } private function createForm() : FormInterface { - return $this->formFactory->create(RequestPasswordFormType::class, null, ['action' => $this->router->generate('nucleos_user_resetting_request'), 'method' => 'POST'])->add('save', SubmitType::class, ['label' => 'resetting.request.submit']); + return $this->formFactory->create(RequestPasswordFormType::class, null, ['action' => $this->router->generate('nucleos_user_resetting_request'), 'method' => 'POST'])->add('save', SubmitType::class, []); } }

Check warning on line 202 in src/Action/RequestResetAction.php

View workflow job for this annotation

GitHub Actions / run / Mutation Tests (8.3)

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } private function createForm() : FormInterface { - return $this->formFactory->create(RequestPasswordFormType::class, null, ['action' => $this->router->generate('nucleos_user_resetting_request'), 'method' => 'POST'])->add('save', SubmitType::class, ['label' => 'resetting.request.submit']); + return $this->formFactory->create(RequestPasswordFormType::class, null, ['action' => $this->router->generate('nucleos_user_resetting_request'), 'method' => 'POST'])->add('save', SubmitType::class, []); } }
'label' => 'resetting.request.submit',
])
;
Expand Down
4 changes: 1 addition & 3 deletions src/Event/GetResponseNullableUserEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@

namespace Nucleos\UserBundle\Event;

final class GetResponseNullableUserEvent extends GetResponseUserEvent
{
}
final class GetResponseNullableUserEvent extends GetResponseUserEvent {}
4 changes: 1 addition & 3 deletions src/Mailer/NoopResettingMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@

final class NoopResettingMailer implements ResettingMailer
{
public function sendResettingEmailMessage(UserInterface $user): void
{
}
public function sendResettingEmailMessage(UserInterface $user): void {}

Check warning on line 20 in src/Mailer/NoopResettingMailer.php

View check run for this annotation

Codecov / codecov/patch

src/Mailer/NoopResettingMailer.php#L20

Added line #L20 was not covered by tests
}
3 changes: 3 additions & 0 deletions src/Security/UserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
use Symfony\Component\Security\Core\User\UserInterface as SecurityUserInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;

/**
* @phpstan-implements UserProviderInterface<UserInterface>
*/
class UserProvider implements UserProviderInterface
{
protected UserManager $userManager;
Expand Down
1 change: 0 additions & 1 deletion src/Validator/Constraints/Pattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

/**
* @Annotation
*
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*/
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
Expand Down
4 changes: 1 addition & 3 deletions tests/App/Entity/TestGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@

use Nucleos\UserBundle\Model\Group;

class TestGroup extends Group
{
}
class TestGroup extends Group {}
4 changes: 1 addition & 3 deletions tests/App/Entity/TestUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@
/**
* @phpstan-extends User<GroupInterface>
*/
class TestUser extends User
{
}
class TestUser extends User {}
5 changes: 5 additions & 0 deletions vendor-bin/tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@
"phpstan/extension-installer": true
},
"bin-dir": "../../vendor/bin"
},
"extra": {
"symfony": {
"require": "6.4.*"
}
}
}
Loading
Loading