Skip to content

Commit

Permalink
[shopsys] upgrade to Symfony 6.4 (#3584)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasLudvik authored Nov 25, 2024
2 parents 202efd3 + d455afa commit c39bb64
Show file tree
Hide file tree
Showing 29 changed files with 37 additions and 48 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"shopsys/framework": "16.0.x-dev",
"shopsys/migrations": "16.0.x-dev",
"shopsys/plugin-interface": "16.0.x-dev",
"symfony/config": "^5.4",
"symfony/dependency-injection": "^5.4",
"symfony/http-foundation": "^5.4",
"symfony/http-kernel": "^5.4",
"symfony/routing": "^5.4",
"symfony/config": "^6.4",
"symfony/dependency-injection": "^6.4",
"symfony/http-foundation": "^6.4",
"symfony/http-kernel": "^6.4",
"symfony/routing": "^6.4",
"webonyx/graphql-php": "^15.6"
},
"require-dev": {
Expand Down
3 changes: 1 addition & 2 deletions src/Component/Constraints/CustomerUserRoleGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ class CustomerUserRoleGroup extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::CUSTOMER_USER_ROLE_GROUP_NOT_FOUND => 'CUSTOMER_USER_ROLE_GROUP_NOT_FOUND',
];

Expand Down
3 changes: 1 addition & 2 deletions src/Component/Constraints/CustomerUserRoleGroupAllowEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ class CustomerUserRoleGroupAllowEdit extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::CUSTOMER_USER_ROLE_GROUP_CANNOT_BE_CHANGED => 'CUSTOMER_USER_ROLE_GROUP_CANNOT_BE_CHANGED',
self::LAST_CUSTOMER_USER_ROLE_GROUP_CANNOT_BE_CHANGED => 'LAST_CUSTOMER_USER_ROLE_GROUP_CANNOT_BE_CHANGED',
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(
* @param mixed $value
* @param \Symfony\Component\Validator\Constraint $constraint
*/
public function validate($value, Constraint $constraint): void
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof CustomerUserRoleGroupAllowEdit) {
throw new UnexpectedTypeException($constraint, CustomerUserRoleGroupAllowEdit::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(
* @param mixed $value
* @param \Symfony\Component\Validator\Constraint $constraint
*/
public function validate($value, Constraint $constraint)
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof CustomerUserRoleGroup) {
throw new UnexpectedTypeException($constraint, CustomerUserRoleGroup::class);
Expand Down
3 changes: 1 addition & 2 deletions src/Component/Constraints/DeliveryAddressUuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ class DeliveryAddressUuid extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::LOGIN_REQUIRED_ERROR => 'LOGIN_REQUIRED_ERROR',
];

Expand Down
2 changes: 1 addition & 1 deletion src/Component/Constraints/DeliveryAddressUuidValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(
* {@inheritdoc}
*/
#[Override]
public function validate($value, Constraint $constraint): void
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof DeliveryAddressUuid) {
throw new UnexpectedTypeException($constraint, DeliveryAddressUuid::class);
Expand Down
4 changes: 1 addition & 3 deletions src/Component/Constraints/FileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ class FileUpload extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
* @phpcsSuppress SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnlySniff.ReferenceViaFullyQualifiedName
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::TOO_BIG_ERROR => 'TOO_BIG_ERROR',
self::UPLOAD_ERROR => 'UPLOAD_ERROR',
self::MIMETYPE_ERROR => 'MIMETYPE_ERROR',
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Constraints/FileUploadValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class FileUploadValidator extends ConstraintValidator
* @param mixed $value
* @param \Symfony\Component\Validator\Constraint $constraint
*/
public function validate($value, Constraint $constraint): void
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof FileUpload) {
throw new UnexpectedTypeException($constraint, FileUpload::class);
Expand Down
3 changes: 1 addition & 2 deletions src/Component/Constraints/PaymentInCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ class PaymentInCart extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::UNAVAILABLE_PAYMENT_ERROR => 'UNAVAILABLE_PAYMENT_ERROR',
self::INVALID_PAYMENT_TRANSPORT_COMBINATION_ERROR => 'INVALID_PAYMENT_TRANSPORT_COMBINATION_ERROR',
];
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Constraints/PaymentInCartValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(
* @param mixed $value
* @param \Shopsys\FrontendApiBundle\Component\Constraints\PaymentInCart $constraint
*/
public function validate($value, Constraint $constraint)
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof PaymentInCart) {
throw new UnexpectedTypeException($constraint, PaymentInCart::class);
Expand Down
3 changes: 1 addition & 2 deletions src/Component/Constraints/PaymentInExistingOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ class PaymentInExistingOrder extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::UNAVAILABLE_PAYMENT_ERROR => 'UNAVAILABLE_PAYMENT_ERROR',
self::UNCHANGEABLE_PAYMENT_ERROR => 'UNCHANGEABLE_PAYMENT_ERROR',
self::INVALID_PAYMENT_SWIFT_ERROR => 'INVALID_PAYMENT_SWIFT_ERROR',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(
* @param mixed $value
* @param \Symfony\Component\Validator\Constraint $constraint
*/
public function validate($value, Constraint $constraint): void
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof PaymentInExistingOrder) {
throw new UnexpectedTypeException($constraint, PaymentInExistingOrder::class);
Expand Down
3 changes: 1 addition & 2 deletions src/Component/Constraints/PaymentInOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ class PaymentInOrder extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::PAYMENT_NOT_SET_ERROR => 'PAYMENT_NOT_SET_ERROR',
self::UNAVAILABLE_PAYMENT_ERROR => 'UNAVAILABLE_PAYMENT_ERROR',
self::CHANGED_PAYMENT_PRICE_ERROR => 'CHANGED_PAYMENT_PRICE_ERROR',
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Constraints/PaymentInOrderValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(
* @param mixed $value
* @param \Shopsys\FrontendApiBundle\Component\Constraints\PaymentInOrder $constraint
*/
public function validate($value, Constraint $constraint)
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof PaymentInOrder) {
throw new UnexpectedTypeException($constraint, PaymentInOrder::class);
Expand Down
3 changes: 1 addition & 2 deletions src/Component/Constraints/PaymentTransportRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ class PaymentTransportRelation extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::INVALID_COMBINATION_ERROR => 'INVALID_COMBINATION_ERROR',
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(
* @param mixed $value
* @param \Symfony\Component\Validator\Constraint $constraint
*/
public function validate($value, Constraint $constraint): void
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof PaymentTransportRelation) {
throw new UnexpectedTypeException($constraint, PaymentTransportRelation::class);
Expand Down
3 changes: 1 addition & 2 deletions src/Component/Constraints/ProductInOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ class ProductInOrder extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::NO_PRODUCT_IN_ORDER_ERROR => 'NO_PRODUCT_IN_ORDER_ERROR',
];

Expand Down
2 changes: 1 addition & 1 deletion src/Component/Constraints/ProductInOrderValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(
* @param mixed $value
* @param \Shopsys\FrontendApiBundle\Component\Constraints\ProductInOrder $constraint
*/
public function validate($value, Constraint $constraint): void
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof ProductInOrder) {
throw new UnexpectedTypeException($constraint, ProductInOrder::class);
Expand Down
3 changes: 1 addition & 2 deletions src/Component/Constraints/PromoCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ class PromoCode extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::INVALID_ERROR => 'INVALID_ERROR',
self::NOT_YET_VALID_ERROR => 'NOT_YET_VALID_ERROR',
self::NO_LONGER_VALID_ERROR => 'NO_LONGER_VALID_ERROR',
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Constraints/PromoCodeValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
* @param mixed $value
* @param \Symfony\Component\Validator\Constraint $constraint
*/
public function validate($value, Constraint $constraint)
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof PromoCode) {
throw new UnexpectedTypeException($constraint, PromoCode::class);
Expand Down
3 changes: 1 addition & 2 deletions src/Component/Constraints/TransportInCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ class TransportInCart extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::UNAVAILABLE_TRANSPORT_ERROR => 'UNAVAILABLE_TRANSPORT_ERROR',
self::UNAVAILABLE_PICKUP_PLACE_ERROR => 'UNAVAILABLE_PICKUP_PLACE_ERROR',
self::WEIGHT_LIMIT_EXCEEDED_ERROR => 'WEIGHT_LIMIT_EXCEEDED_ERROR',
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Constraints/TransportInCartValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
* @param mixed $value
* @param \Shopsys\FrontendApiBundle\Component\Constraints\TransportInCart $constraint
*/
public function validate($value, Constraint $constraint)
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof TransportInCart) {
throw new UnexpectedTypeException($constraint, TransportInCart::class);
Expand Down
3 changes: 1 addition & 2 deletions src/Component/Constraints/TransportInOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ class TransportInOrder extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::TRANSPORT_NOT_SET_ERROR => 'TRANSPORT_NOT_SET_ERROR',
self::TRANSPORT_UNAVAILABLE_ERROR => 'TRANSPORT_UNAVAILABLE_ERROR',
self::CHANGED_TRANSPORT_PRICE_ERROR => 'CHANGED_TRANSPORT_PRICE_ERROR',
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Constraints/TransportInOrderValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(
* @param mixed $value
* @param \Symfony\Component\Validator\Constraint $constraint
*/
public function validate($value, Constraint $constraint)
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof TransportInOrder) {
throw new UnexpectedTypeException($constraint, TransportInOrder::class);
Expand Down
3 changes: 1 addition & 2 deletions src/Component/Constraints/UniqueBillingAddressApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ class UniqueBillingAddressApi extends Constraint

/**
* @var array<string, string>
* @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
*/
protected static $errorNames = [
protected const array ERROR_NAMES = [
self::DUPLICATE_BILLING_ADDRESS => 'DUPLICATE_BILLING_ADDRESS',
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(
* @param mixed $value
* @param \Symfony\Component\Validator\Constraint $constraint
*/
public function validate($value, Constraint $constraint)
public function validate(mixed $value, Constraint $constraint): void
{
if (!$constraint instanceof UniqueBillingAddressApi) {
throw new UnexpectedTypeException($constraint, UniqueBillingAddressApi::class);
Expand Down
6 changes: 4 additions & 2 deletions src/Voter/AbstractB2bVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ public function __construct(protected readonly Domain $domain)
/**
* @param string $attribute
* @param array $subject
* @return bool
*/
abstract protected function supports(string $attribute, $subject);
abstract protected function supports(string $attribute, $subject): bool;

/**
* @param string $attribute
Expand All @@ -36,8 +37,9 @@ abstract protected function checkAccess(string $attribute, ?Argument $argument,
* @param string $attribute
* @param mixed $subject
* @param \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token
* @return bool
*/
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token)
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
{
if ($this->domain->isB2b() === false) {
return false;
Expand Down
3 changes: 2 additions & 1 deletion src/Voter/CompanyOwnerVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ public function __construct(
/**
* @param string $attribute
* @param mixed $subject
* @return bool
*/
protected function supports(string $attribute, $subject)
protected function supports(string $attribute, $subject): bool
{
return $attribute === 'is_company_owner_voter';
}
Expand Down

0 comments on commit c39bb64

Please sign in to comment.