mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Fix static checks on symfony 6 - continuation
This commit is contained in:
parent
c364b25be3
commit
18c888a6a9
10 changed files with 39 additions and 39 deletions
|
|
@ -26,7 +26,8 @@
|
|||
"HWI\\Bundle\\OAuthBundle\\Connect\\AccountConnectorInterface",
|
||||
"HWI\\Bundle\\OAuthBundle\\OAuth\\Response\\UserResponseInterface",
|
||||
"HWI\\Bundle\\OAuthBundle\\Security\\Core\\User\\OAuthAwareUserProviderInterface",
|
||||
"League\\Flysystem\\FilesystemOperator"
|
||||
"League\\Flysystem\\FilesystemOperator",
|
||||
"Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface"
|
||||
],
|
||||
"php-core-extensions" : [
|
||||
"Core",
|
||||
|
|
|
|||
16
psalm.xml
16
psalm.xml
|
|
@ -90,10 +90,7 @@
|
|||
<referencedClass name="Payum\Core\Action\GatewayAwareAction" />
|
||||
<referencedClass name="Payum\Core\Security\GenericTokenFactoryInterface" />
|
||||
<referencedClass name="Sylius\Component\Core\Calculator\ProductVariantPriceCalculatorInterface" />
|
||||
<referencedClass name="Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent" /> <!-- deprected in Symfony 4.4 -->
|
||||
<referencedClass name="Symfony\Component\HttpKernel\EventListener\ExceptionListener" /> <!-- deprected in Symfony 4.4 -->
|
||||
<referencedClass name="Symfony\Component\Routing\RouteCollectionBuilder" /> <!-- deprecated in Symfony 5.1 -->
|
||||
<referencedClass name="Symfony\Component\Security\Core\Role\Role" /> <!-- deprecated in Symfony 4.3 -->
|
||||
<referencedClass name="Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler" /> <!-- deprecated in Symfony 5.1 -->
|
||||
<referencedClass name="Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface" /> <!-- deprecated in Symfony 5.3 -->
|
||||
<referencedClass name="Symfony\Component\Security\Core\Encoder\EncoderAwareInterface" /> <!-- deprecated in Symfony 5.3 -->
|
||||
|
|
@ -105,7 +102,6 @@
|
|||
<errorLevel type="info">
|
||||
<referencedClass name="Sylius\Component\Core\Calculator\ProductVariantPriceCalculatorInterface" />
|
||||
<referencedClass name="Symfony\Component\Security\Core\Encoder\EncoderAwareInterface" /> <!-- deprecated in Symfony 5.3 -->
|
||||
<referencedClass name="Symfony\Component\Security\Core\User\AdvancedUserInterface" /> <!-- deprecated in Symfony 4.1 -->
|
||||
<referencedClass name="Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface" /> <!-- deprecated in Symfony 5.1 -->
|
||||
<referencedClass name="Symfony\Component\Security\Core\Encoder\EncoderAwareInterface" /> <!-- deprecated in Symfony 5.3 -->
|
||||
<referencedClass name="Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface" /> <!-- deprecated in Symfony 6.1 -->
|
||||
|
|
@ -117,7 +113,6 @@
|
|||
<referencedMethod name="Faker\Generator::__get"/>
|
||||
<referencedMethod name="Payum\Core\Model\GatewayConfigInterface::setFactoryName" />
|
||||
<referencedMethod name="Sylius\Component\Mailer\Sender\SenderInterface::send"/>
|
||||
<referencedMethod name="Symfony\Component\EventDispatcher\Event::stopPropagation" /> <!-- deprecated in Symfony 4.3 -->
|
||||
<referencedMethod name="Symfony\Component\HttpFoundation\JsonResponse::create" /> <!-- deprecated in Symfony 5.1 -->
|
||||
<referencedMethod name="Symfony\Component\HttpFoundation\RequestStack::getMasterRequest" /> <!-- deprecated in Symfony 5.3 -->
|
||||
<referencedMethod name="Symfony\Component\HttpKernel\Event\KernelEvent::isMasterRequest" /> <!-- deprecated in Symfony 5.3 -->
|
||||
|
|
@ -126,7 +121,6 @@
|
|||
<referencedMethod name="Symfony\Component\Security\Core\User\UserInterface::getUsername" /> <!-- deprecated in Symfony 5.3 -->
|
||||
<referencedMethod name="Symfony\Component\Security\Core\User\UserProviderInterface::loadUserByUsername" /> <!-- deprecated in Symfony 5.3 -->
|
||||
<referencedMethod name="Symfony\Component\Security\Core\Authentication\Token\AbstractToken::isAuthenticated" /> <!-- deprecated in Symfony 5.4 -->
|
||||
<referencedMethod name="Sylius\Component\Mailer\Sender\SenderInterface::send" /> <!-- deprecated in Symfony 5.4 -->
|
||||
</errorLevel>
|
||||
</DeprecatedMethod>
|
||||
|
||||
|
|
@ -162,6 +156,15 @@
|
|||
</errorLevel>
|
||||
</UndefinedMethod>
|
||||
|
||||
<UndefinedInterfaceMethod>
|
||||
<errorLevel type="suppress">
|
||||
<referencedMethod name="Symfony\Component\Security\Core\User\UserInterface::getPassword" />
|
||||
<referencedMethod name="Symfony\Component\Security\Core\User\UserInterface::getUsername" />
|
||||
<referencedMethod name="Sylius\Component\User\Model\UserInterface::getUsername" />
|
||||
<referencedMethod name="Sylius\Component\Core\Model\ShopUserInterface::getUsername" />
|
||||
</errorLevel>
|
||||
</UndefinedInterfaceMethod>
|
||||
|
||||
<MissingReturnType errorLevel="info" />
|
||||
|
||||
<PropertyNotSetInConstructor errorLevel="info" />
|
||||
|
|
@ -219,7 +222,6 @@
|
|||
<referencedMethod name="Symfony\Component\Config\Definition\Builder\VariableNodeDefinition::integerNode" />
|
||||
<referencedMethod name="Symfony\Component\Config\Definition\Builder\VariableNodeDefinition::scalarNode" />
|
||||
<referencedMethod name="Symfony\Component\Config\Definition\Builder\VariableNodeDefinition::variableNode" />
|
||||
<referencedMethod name="Symfony\Component\Config\Definition\Builder\VariableNodeParentInterface::end" />
|
||||
</errorLevel>
|
||||
</PossiblyUndefinedMethod>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace Sylius\Bundle\CoreBundle\CatalogPromotion\Listener;
|
|||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Sylius\Bundle\CoreBundle\CatalogPromotion\Command\UpdateCatalogPromotionState;
|
||||
use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\AllProductVariantsCatalogPromotionsProcessorInterface;
|
||||
use Sylius\Component\Core\Model\CatalogPromotionInterface;
|
||||
use Sylius\Component\Promotion\Event\CatalogPromotionCreated;
|
||||
use Sylius\Component\Resource\Repository\RepositoryInterface;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
|
|
@ -32,6 +33,7 @@ final class CatalogPromotionCreatedListener
|
|||
|
||||
public function __invoke(CatalogPromotionCreated $event): void
|
||||
{
|
||||
/** @var CatalogPromotionInterface|null $catalogPromotion */
|
||||
$catalogPromotion = $this->catalogPromotionRepository->findOneBy(['code' => $event->code]);
|
||||
|
||||
if (null === $catalogPromotion) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace Sylius\Bundle\CoreBundle\CatalogPromotion\Listener;
|
|||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Sylius\Bundle\CoreBundle\CatalogPromotion\Command\UpdateCatalogPromotionState;
|
||||
use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\AllProductVariantsCatalogPromotionsProcessorInterface;
|
||||
use Sylius\Component\Core\Model\CatalogPromotionInterface;
|
||||
use Sylius\Component\Promotion\Event\CatalogPromotionEnded;
|
||||
use Sylius\Component\Resource\Repository\RepositoryInterface;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
|
|
@ -32,6 +33,7 @@ final class CatalogPromotionEndedListener
|
|||
|
||||
public function __invoke(CatalogPromotionEnded $event): void
|
||||
{
|
||||
/** @var CatalogPromotionInterface|null $catalogPromotion */
|
||||
$catalogPromotion = $this->catalogPromotionRepository->findOneBy(['code' => $event->code]);
|
||||
|
||||
if (null === $catalogPromotion) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace Sylius\Bundle\CoreBundle\CatalogPromotion\Listener;
|
|||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Sylius\Bundle\CoreBundle\CatalogPromotion\Command\UpdateCatalogPromotionState;
|
||||
use Sylius\Bundle\CoreBundle\CatalogPromotion\Processor\AllProductVariantsCatalogPromotionsProcessorInterface;
|
||||
use Sylius\Component\Core\Model\CatalogPromotionInterface;
|
||||
use Sylius\Component\Promotion\Event\CatalogPromotionUpdated;
|
||||
use Sylius\Component\Resource\Repository\RepositoryInterface;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
|
|
@ -32,6 +33,7 @@ final class CatalogPromotionUpdatedListener
|
|||
|
||||
public function __invoke(CatalogPromotionUpdated $event): void
|
||||
{
|
||||
/** @var CatalogPromotionInterface|null $catalogPromotion */
|
||||
$catalogPromotion = $this->catalogPromotionRepository->findOneBy(['code' => $event->code]);
|
||||
|
||||
if (null === $catalogPromotion) {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ final class ExchangeRateType extends AbstractResourceType
|
|||
{
|
||||
parent::configureOptions($resolver);
|
||||
|
||||
/** @psalm-suppress DeprecatedConstant */
|
||||
$resolver->setDefault('rounding_mode', \NumberFormatter::ROUND_HALFEVEN);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,12 +52,6 @@ final class GenerateProductVariantsSubscriber implements EventSubscriberInterfac
|
|||
try {
|
||||
$this->generator->generate($product);
|
||||
} catch (VariantWithNoOptionsValuesException $exception) {
|
||||
if ($this->requestStackOrSession instanceof SessionInterface) {
|
||||
$session = $this->requestStackOrSession;
|
||||
} else {
|
||||
$session = $this->requestStackOrSession->getSession();
|
||||
}
|
||||
|
||||
$this->getFlashBag()->add('error', $exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ abstract class AbstractRoleCommand extends ContainerAwareCommand
|
|||
if (!$input->getArgument('roles')) {
|
||||
$question = new Question('Please enter user\'s roles (separated by space):');
|
||||
$question->setValidator(function (?string $roles) {
|
||||
if (strlen($roles) < 1) {
|
||||
if ('' === $roles) {
|
||||
throw new \RuntimeException('The value cannot be blank.');
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ abstract class AbstractRoleCommand extends ContainerAwareCommand
|
|||
*/
|
||||
protected function getUserModelClass(string $userType): string
|
||||
{
|
||||
$config = $this->getContainer()->getParameter('sylius.user.users');
|
||||
$config = (array) $this->getContainer()->getParameter('sylius.user.users');
|
||||
if (empty($config[$userType]['user']['classes']['model'])) {
|
||||
throw new \InvalidArgumentException(sprintf('User type %s misconfigured.', $userType));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ class UserLogin implements UserLoginInterface
|
|||
);
|
||||
}
|
||||
|
||||
/** @psalm-suppress NullArgument */
|
||||
return new UsernamePasswordToken(
|
||||
$user,
|
||||
null,
|
||||
|
|
|
|||
|
|
@ -16,34 +16,31 @@ namespace spec\Sylius\Bundle\UserBundle\Security;
|
|||
use PhpSpec\ObjectBehavior;
|
||||
use Sylius\Component\User\Model\CredentialsHolderInterface;
|
||||
use Sylius\Component\User\Security\UserPasswordEncoderInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
|
||||
|
||||
if (Kernel::MAJOR_VERSION === 5) {
|
||||
final class UserPasswordEncoderSpec extends ObjectBehavior
|
||||
final class UserPasswordEncoderSpec extends ObjectBehavior
|
||||
{
|
||||
function let(EncoderFactoryInterface $encoderFactory): void
|
||||
{
|
||||
function let(EncoderFactoryInterface $encoderFactory): void
|
||||
{
|
||||
$this->beConstructedWith($encoderFactory);
|
||||
}
|
||||
$this->beConstructedWith($encoderFactory);
|
||||
}
|
||||
|
||||
function it_implements_password_updater_interface(): void
|
||||
{
|
||||
$this->shouldImplement(UserPasswordEncoderInterface::class);
|
||||
}
|
||||
function it_implements_password_updater_interface(): void
|
||||
{
|
||||
$this->shouldImplement(UserPasswordEncoderInterface::class);
|
||||
}
|
||||
|
||||
function it_encodes_password(
|
||||
EncoderFactoryInterface $encoderFactory,
|
||||
PasswordEncoderInterface $passwordEncoder,
|
||||
CredentialsHolderInterface $user,
|
||||
): void {
|
||||
$user->getPlainPassword()->willReturn('topSecretPlainPassword');
|
||||
$user->getSalt()->willReturn('typicalSalt');
|
||||
$encoderFactory->getEncoder($user->getWrappedObject())->willReturn($passwordEncoder);
|
||||
$passwordEncoder->encodePassword('topSecretPlainPassword', 'typicalSalt')->willReturn('topSecretEncodedPassword');
|
||||
function it_encodes_password(
|
||||
EncoderFactoryInterface $encoderFactory,
|
||||
PasswordEncoderInterface $passwordEncoder,
|
||||
CredentialsHolderInterface $user,
|
||||
): void {
|
||||
$user->getPlainPassword()->willReturn('topSecretPlainPassword');
|
||||
$user->getSalt()->willReturn('typicalSalt');
|
||||
$encoderFactory->getEncoder($user->getWrappedObject())->willReturn($passwordEncoder);
|
||||
$passwordEncoder->encodePassword('topSecretPlainPassword', 'typicalSalt')->willReturn('topSecretEncodedPassword');
|
||||
|
||||
$this->encode($user)->shouldReturn('topSecretEncodedPassword');
|
||||
}
|
||||
$this->encode($user)->shouldReturn('topSecretEncodedPassword');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue