mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Apply coding standard fixes
This commit is contained in:
parent
ab458b3b3b
commit
ede831687d
67 changed files with 153 additions and 177 deletions
|
|
@ -191,13 +191,12 @@
|
|||
"psalm/plugin-mockery": "0.7.0",
|
||||
"psr/event-dispatcher": "^1.0",
|
||||
"stripe/stripe-php": "^6.43",
|
||||
"sylius-labs/coding-standard": "^3.1",
|
||||
"sylius-labs/coding-standard": "^4.0",
|
||||
"symfony/browser-kit": "^4.4 || ^5.2",
|
||||
"symfony/debug-bundle": "^4.4 || ^5.2",
|
||||
"symfony/dotenv": "^4.4 || ^5.2",
|
||||
"symfony/flex": "^1.7",
|
||||
"symfony/web-profiler-bundle": "^4.4 || ^5.2",
|
||||
"symplify/package-builder": "^8.0 <8.3",
|
||||
"vimeo/psalm": "4.7.1"
|
||||
},
|
||||
"suggest": {
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
imports:
|
||||
- { resource: 'vendor/sylius-labs/coding-standard/easy-coding-standard.yml' }
|
||||
|
||||
services:
|
||||
PhpCsFixer\Fixer\Comment\HeaderCommentFixer:
|
||||
header: |
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Paweł Jędrzejewski
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
location: 'after_open'
|
||||
|
||||
parameters:
|
||||
skip:
|
||||
SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff.NoAssignment: ~
|
||||
SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff.MissingVariable: ~
|
||||
exclude_files:
|
||||
- '**/var/*'
|
||||
29
ecs.php
Normal file
29
ecs.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
|
||||
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
|
||||
use SlevomatCodingStandard\Sniffs\Commenting\InlineDocCommentDeclarationSniff;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symplify\EasyCodingStandard\ValueObject\Option;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->import('vendor/sylius-labs/coding-standard/ecs.php');
|
||||
|
||||
// $containerConfigurator->services()->set(HeaderCommentFixer::class)->call('configure', [
|
||||
// 'location' => 'after_open',
|
||||
// 'header' =>
|
||||
//'This file is part of the Sylius package.
|
||||
//
|
||||
//(c) Paweł Jędrzejewski
|
||||
//
|
||||
//For the full copyright and license information, please view the LICENSE
|
||||
//file that was distributed with this source code.',
|
||||
// ]);
|
||||
|
||||
$containerConfigurator->parameters()->set(Option::SKIP, [
|
||||
InlineDocCommentDeclarationSniff::class . '.MissingVariable',
|
||||
InlineDocCommentDeclarationSniff::class . '.NoAssignment',
|
||||
VisibilityRequiredFixer::class => ['*Spec.php'],
|
||||
'**/var/*',
|
||||
]);
|
||||
};
|
||||
|
|
@ -15,23 +15,11 @@ namespace App;
|
|||
|
||||
use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer;
|
||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||
use Symfony\Component\Config\Loader\DelegatingLoader;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\DirectoryLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\GlobFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
use Symfony\Component\HttpKernel\Config\FileLocator;
|
||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||
use Symfony\Component\Routing\RouteCollectionBuilder;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/** @final */
|
||||
class Kernel extends BaseKernel
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ interface ApiClientInterface
|
|||
/** @param string|int $value */
|
||||
public function addFilter(string $key, $value): void;
|
||||
|
||||
/** @param string|int $value */
|
||||
public function clearParameters(): void;
|
||||
|
||||
public function addFile(string $key, UploadedFile $file): void;
|
||||
|
|
|
|||
|
|
@ -211,7 +211,6 @@ final class ApiPlatformClient implements ApiClientInterface
|
|||
$this->addParameter($key, $value);
|
||||
}
|
||||
|
||||
/** @param string|int $value */
|
||||
public function clearParameters(): void
|
||||
{
|
||||
$this->request->clearParameters();
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ final class CartContext implements Context
|
|||
|
||||
Assert::same($variantsData['hydra:totalItems'], 1);
|
||||
|
||||
$variantIri = $variantsData['@id'].'/'.$variantsData['hydra:member'][0]['code'];
|
||||
$variantIri = $variantsData['@id'] . '/' . $variantsData['hydra:member'][0]['code'];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -590,7 +590,6 @@ final class CartContext implements Context
|
|||
\sprintf('items/%s', $orderItemId)
|
||||
);
|
||||
|
||||
|
||||
$this->cartsClient->executeCustomRequest($request);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ final class ChannelContext implements Context
|
|||
$this->sharedStorage = $sharedStorage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Given I am browsing channel :channel
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ use Sylius\Behat\Client\ApiClientInterface;
|
|||
use Sylius\Behat\Client\Request;
|
||||
use Sylius\Behat\Client\ResponseCheckerInterface;
|
||||
use Sylius\Behat\Service\SharedStorageInterface;
|
||||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
use Sylius\Component\Core\Model\ProductInterface;
|
||||
use Sylius\Component\Taxonomy\Model\TaxonInterface;
|
||||
use Symfony\Component\HttpFoundation\Request as HttpRequest;
|
||||
|
|
@ -142,7 +141,7 @@ final class ProductContext implements Context
|
|||
$price,
|
||||
$product->getCode()
|
||||
),
|
||||
sprintf("There is no product with %s code and %s price", $product->getCode(), $price)
|
||||
sprintf('There is no product with %s code and %s price', $product->getCode(), $price)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +201,7 @@ final class ProductContext implements Context
|
|||
$this->client->executeCustomRequest(Request::custom($variantIri, HttpRequest::METHOD_GET));
|
||||
|
||||
/** @var int $variantPrice */
|
||||
$variantPrice = $this->responseChecker->getValue($this->client->getLastResponse(), "price");
|
||||
$variantPrice = $this->responseChecker->getValue($this->client->getLastResponse(), 'price');
|
||||
|
||||
if ($price === $variantPrice) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ use Sylius\Behat\Client\ResponseCheckerInterface;
|
|||
use Sylius\Behat\Service\SharedStorageInterface;
|
||||
use Sylius\Component\Product\Model\ProductInterface;
|
||||
use Sylius\Component\Review\Model\ReviewInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
final class ProductReviewContext implements Context
|
||||
|
|
@ -196,6 +195,7 @@ final class ProductReviewContext implements Context
|
|||
{
|
||||
$this->assertViolation('Review title must have at least 2 characters.', 'title');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then I should be notified that title must have at most 255 characters
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ final class ManagingOrdersContext implements Context
|
|||
{
|
||||
Assert::notSame($order->getState(), OrderInterface::STATE_CANCELLED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^(the order)'s items total should be ("[^"]+")$/
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ final class LocaleContext implements Context
|
|||
*/
|
||||
public function iShouldBeNotifiedThatThisEmailIsNotValidInLocale(string $localeCode): void
|
||||
{
|
||||
Assert::same($this->createPage->getValidationMessage('email'), $this->translate('sylius.contact.email.invalid', $localeCode, 'validators'));
|
||||
Assert::same($this->createPage->getValidationMessage('email'), $this->translate('sylius.contact.email.invalid', $localeCode, 'validators'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -112,10 +112,10 @@ class UpdateSimpleProductPage extends BaseUpdatePage implements UpdateSimpleProd
|
|||
{
|
||||
$attribute = $this->getDocument()->find('css', sprintf('.attribute .attribute-label:contains("%s")', $attributeName));
|
||||
|
||||
return (
|
||||
return
|
||||
$attribute->getParent()->getParent()->find('css', '.attribute-input input')->getValue() === $value &&
|
||||
$attribute->find('css', '.globe.icon') !== null
|
||||
);
|
||||
;
|
||||
}
|
||||
|
||||
public function selectMainTaxon(TaxonInterface $taxon): void
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class ChangeItemQuantityInCart implements OrderTokenValueAwareInterface, Subreso
|
|||
|
||||
public function setSubresourceId(?string $subresourceId): void
|
||||
{
|
||||
$this->orderItemId= $subresourceId;
|
||||
$this->orderItemId = $subresourceId;
|
||||
}
|
||||
|
||||
public function getSubresourceIdAttributeKey(): string
|
||||
|
|
|
|||
|
|
@ -13,13 +13,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Bundle\ApiBundle\CommandHandler;
|
||||
|
||||
use Sylius\Bundle\AdminApiBundle\Model\UserInterface;
|
||||
use Sylius\Bundle\ApiBundle\Command\AddProductReview;
|
||||
use Sylius\Bundle\ApiBundle\Context\UserContextInterface;
|
||||
use Sylius\Bundle\ApiBundle\Provider\CustomerProviderInterface;
|
||||
use Sylius\Component\Core\Model\CustomerInterface;
|
||||
use Sylius\Component\Core\Model\ProductInterface;
|
||||
use Sylius\Component\Core\Model\ShopUserInterface;
|
||||
use Sylius\Component\Core\Repository\ProductRepositoryInterface;
|
||||
use Sylius\Component\Resource\Factory\FactoryInterface;
|
||||
use Sylius\Component\Resource\Repository\RepositoryInterface;
|
||||
|
|
|
|||
|
|
@ -13,15 +13,15 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Bundle\ApiBundle\CommandHandler;
|
||||
|
||||
use Sylius\Component\User\Repository\UserRepositoryInterface;
|
||||
use Webmozart\Assert\Assert;
|
||||
use Sylius\Bundle\ApiBundle\Command\ResendVerificationEmail;
|
||||
use Sylius\Bundle\ApiBundle\Command\SendAccountVerificationEmail;
|
||||
use Sylius\Component\User\Model\UserInterface;
|
||||
use Sylius\Component\User\Repository\UserRepositoryInterface;
|
||||
use Sylius\Component\User\Security\Generator\GeneratorInterface;
|
||||
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
use Symfony\Component\Messenger\Stamp\DispatchAfterCurrentBusStamp;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/** @experimental */
|
||||
final class ResendVerificationEmailHandler implements MessageHandlerInterface
|
||||
|
|
|
|||
|
|
@ -45,6 +45,6 @@ final class VerifyCustomerAccountHandler implements MessageHandlerInterface
|
|||
$user->setEmailVerificationToken(null);
|
||||
$user->enable();
|
||||
|
||||
return new JsonResponse([]) ;
|
||||
return new JsonResponse([]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ final class ItemIriToIdentifierConverter implements ItemIriToIdentifierConverter
|
|||
public function getIdentifier(?string $iri): ?string
|
||||
{
|
||||
if ($iri === null || $iri === '') {
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ namespace Sylius\Bundle\ApiBundle\DataProvider;
|
|||
use ApiPlatform\Core\DataProvider\ItemDataProviderInterface;
|
||||
use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface;
|
||||
use Sylius\Bundle\ApiBundle\Command\ResetPassword;
|
||||
use Sylius\Component\User\Repository\UserRepositoryInterface;
|
||||
|
||||
/** @experimental */
|
||||
final class ResetPasswordItemDataProvider implements RestrictedDataProviderInterface, ItemDataProviderInterface
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
namespace Sylius\Bundle\ApiBundle\Doctrine\Filter;
|
||||
|
||||
use ApiPlatform\Core\Api\IriConverterInterface;
|
||||
use ApiPlatform\Core\Bridge\Doctrine\Common\Filter\OrderFilterInterface;
|
||||
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\AbstractContextAwareFilter;
|
||||
use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
|
|
@ -22,12 +21,10 @@ use Doctrine\Persistence\ManagerRegistry;
|
|||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/** @experimental */
|
||||
final class ProductVariantOptionValueFilter extends AbstractContextAwareFilter
|
||||
{
|
||||
/** @var IriConverterInterface */
|
||||
private IriConverterInterface $iriConverter;
|
||||
|
||||
public function __construct(
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ use Sylius\Component\Order\Context\CartContextInterface;
|
|||
use Sylius\Component\Order\Context\CartNotFoundException;
|
||||
use Sylius\Component\Resource\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
use Symfony\Component\Messenger\Stamp\DispatchAfterCurrentBusStamp;
|
||||
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
|
||||
|
||||
final class ApiCartBlamerListener
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ final class TaxonFilter extends AbstractContextAwareFilter
|
|||
QueryNameGeneratorInterface $queryNameGenerator,
|
||||
string $resourceClass,
|
||||
string $operationName = null,
|
||||
array $context = []
|
||||
array $context = []
|
||||
) {
|
||||
if ($property !== 'taxon') {
|
||||
return;
|
||||
|
|
@ -69,7 +69,7 @@ final class TaxonFilter extends AbstractContextAwareFilter
|
|||
'required' => false,
|
||||
'property' => null,
|
||||
'swagger' => [
|
||||
'name' =>'Product taxon filter',
|
||||
'name' => 'Product taxon filter',
|
||||
'description' => 'Get a collection of product with chosen taxon',
|
||||
],
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Bundle\ApiBundle\PropertyInfo\Extractor;
|
||||
|
||||
use Symfony\Component\PropertyInfo\Extractor\ConstructorArgumentTypeExtractorInterface;
|
||||
|
|
@ -25,31 +27,30 @@ use Symfony\Component\String\Inflector\InflectorInterface;
|
|||
*/
|
||||
class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface, PropertyInitializableExtractorInterface, PropertyReadInfoExtractorInterface, PropertyWriteInfoExtractorInterface, ConstructorArgumentTypeExtractorInterface
|
||||
{
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
/** @internal */
|
||||
public static $defaultMutatorPrefixes = ['add', 'remove', 'set'];
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
/** @internal */
|
||||
public static $defaultAccessorPrefixes = ['get', 'is', 'has', 'can'];
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
/** @internal */
|
||||
public static $defaultArrayMutatorPrefixes = ['add', 'remove'];
|
||||
|
||||
public const ALLOW_PRIVATE = 1;
|
||||
|
||||
public const ALLOW_PROTECTED = 2;
|
||||
|
||||
public const ALLOW_PUBLIC = 4;
|
||||
|
||||
/** @var int Allow none of the magic methods */
|
||||
public const DISALLOW_MAGIC_METHODS = 0;
|
||||
|
||||
/** @var int Allow magic __get methods */
|
||||
public const ALLOW_MAGIC_GET = 1 << 0;
|
||||
|
||||
/** @var int Allow magic __set methods */
|
||||
public const ALLOW_MAGIC_SET = 1 << 1;
|
||||
|
||||
/** @var int Allow magic __call methods */
|
||||
public const ALLOW_MAGIC_CALL = 1 << 2;
|
||||
|
||||
|
|
@ -60,15 +61,23 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||
];
|
||||
|
||||
private $mutatorPrefixes;
|
||||
|
||||
private $accessorPrefixes;
|
||||
|
||||
private $arrayMutatorPrefixes;
|
||||
|
||||
private $enableConstructorExtraction;
|
||||
|
||||
private $methodReflectionFlags;
|
||||
|
||||
private $magicMethodsFlags;
|
||||
|
||||
private $propertyReflectionFlags;
|
||||
|
||||
private $inflector;
|
||||
|
||||
private $arrayMutatorPrefixesFirst;
|
||||
|
||||
private $arrayMutatorPrefixesLast;
|
||||
|
||||
/**
|
||||
|
|
@ -287,7 +296,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||
$getsetter = lcfirst($camelProp); // jQuery style, e.g. read: last(), write: last($item)
|
||||
|
||||
foreach ($this->accessorPrefixes as $prefix) {
|
||||
$methodName = $prefix.$camelProp;
|
||||
$methodName = $prefix . $camelProp;
|
||||
|
||||
if ($reflClass->hasMethod($methodName) && $reflClass->getMethod($methodName)->getModifiers() & $this->methodReflectionFlags && !$reflClass->getMethod($methodName)->getNumberOfRequiredParameters()) {
|
||||
$method = $reflClass->getMethod($methodName);
|
||||
|
|
@ -313,7 +322,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||
}
|
||||
|
||||
if ($allowMagicCall && $reflClass->hasMethod('__call') && ($reflClass->getMethod('__call')->getModifiers() & $this->methodReflectionFlags)) {
|
||||
return new PropertyReadInfo(PropertyReadInfo::TYPE_METHOD, 'get'.$camelProp, PropertyReadInfo::VISIBILITY_PUBLIC, false, false);
|
||||
return new PropertyReadInfo(PropertyReadInfo::TYPE_METHOD, 'get' . $camelProp, PropertyReadInfo::VISIBILITY_PUBLIC, false, false);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -372,11 +381,12 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||
$errors = array_merge($errors, $adderAndRemoverErrors);
|
||||
|
||||
foreach ($this->mutatorPrefixes as $mutatorPrefix) {
|
||||
$methodName = $mutatorPrefix.$camelized;
|
||||
$methodName = $mutatorPrefix . $camelized;
|
||||
|
||||
[$accessible, $methodAccessibleErrors] = $this->isMethodAccessible($reflClass, $methodName, 1);
|
||||
if (!$accessible) {
|
||||
$errors = array_merge($errors, $methodAccessibleErrors);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -418,7 +428,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||
if ($allowMagicCall) {
|
||||
[$accessible, $methodAccessibleErrors] = $this->isMethodAccessible($reflClass, '__call', 2);
|
||||
if ($accessible) {
|
||||
return new PropertyWriteInfo(PropertyWriteInfo::TYPE_METHOD, 'set'.$camelized, PropertyWriteInfo::VISIBILITY_PUBLIC, false);
|
||||
return new PropertyWriteInfo(PropertyWriteInfo::TYPE_METHOD, 'set' . $camelized, PropertyWriteInfo::VISIBILITY_PUBLIC, false);
|
||||
}
|
||||
|
||||
$errors = array_merge($errors, $methodAccessibleErrors);
|
||||
|
|
@ -426,7 +436,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||
|
||||
if (!$allowAdderRemover && null !== $adderAccessName && null !== $removerAccessName) {
|
||||
$errors[] = sprintf(
|
||||
'The property "%s" in class "%s" can be defined with the methods "%s()" but '.
|
||||
'The property "%s" in class "%s" can be defined with the methods "%s()" but ' .
|
||||
'the new value must be an array or an instance of \Traversable',
|
||||
$property,
|
||||
$reflClass->getName(),
|
||||
|
|
@ -605,7 +615,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||
|
||||
foreach ($this->accessorPrefixes as $prefix) {
|
||||
try {
|
||||
$reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty);
|
||||
$reflectionMethod = new \ReflectionMethod($class, $prefix . $ucProperty);
|
||||
if ($reflectionMethod->isStatic()) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -640,7 +650,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||
|
||||
foreach ($names as $name) {
|
||||
try {
|
||||
$reflectionMethod = new \ReflectionMethod($class, $prefix.$name);
|
||||
$reflectionMethod = new \ReflectionMethod($class, $prefix . $name);
|
||||
if ($reflectionMethod->isStatic()) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -662,7 +672,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||
{
|
||||
$pattern = implode('|', array_merge($this->accessorPrefixes, $this->mutatorPrefixes));
|
||||
|
||||
if ('' !== $pattern && preg_match('/^('.$pattern.')(.+)$/i', $methodName, $matches)) {
|
||||
if ('' !== $pattern && preg_match('/^(' . $pattern . ')(.+)$/i', $methodName, $matches)) {
|
||||
if (!\in_array($matches[1], $this->arrayMutatorPrefixes)) {
|
||||
return $matches[2];
|
||||
}
|
||||
|
|
@ -699,8 +709,8 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
|||
$errors = [];
|
||||
|
||||
foreach ($singulars as $singular) {
|
||||
$addMethod = $addPrefix.$singular;
|
||||
$removeMethod = $removePrefix.$singular;
|
||||
$addMethod = $addPrefix . $singular;
|
||||
$removeMethod = $removePrefix . $singular;
|
||||
|
||||
[$addMethodFound, $addMethodAccessibleErrors] = $this->isMethodAccessible($reflClass, $addMethod, 1);
|
||||
[$removeMethodFound, $removeMethodAccessibleErrors] = $this->isMethodAccessible($reflClass, $removeMethod, 1);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ final class ProductVariantSerializer implements ContextAwareNormalizerInterface
|
|||
Assert::isInstanceOf($object, ProductVariantInterface::class);
|
||||
|
||||
$data = $this->objectNormalizer->normalize($object, $format, $context);
|
||||
|
||||
try {
|
||||
$data['price'] = $this->priceCalculator->calculate($object, ['channel' => $this->channelContext->getChannel()]);
|
||||
} catch (ChannelNotFoundException $exception) {
|
||||
|
|
@ -49,7 +50,7 @@ final class ProductVariantSerializer implements ContextAwareNormalizerInterface
|
|||
|
||||
public function supportsNormalization($data, $format = null, $context = []): bool
|
||||
{
|
||||
return $data instanceof ProductVariantInterface && $this->isAdminGetOperation($context);
|
||||
return $data instanceof ProductVariantInterface && $this->isAdminGetOperation($context);
|
||||
}
|
||||
|
||||
private function isAdminGetOperation(array $context): bool
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ final class ProductVariantDocumentationNormalizer implements NormalizerInterface
|
|||
$docs['components']['schemas']['ProductVariant:jsonld-product_variant:read']['properties']['price'] = [
|
||||
'type' => 'int',
|
||||
'readOnly' => true,
|
||||
'default' => 0
|
||||
'default' => 0,
|
||||
];
|
||||
|
||||
return $docs;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ final class ItemIriToIdentifierConverterTest extends TestCase
|
|||
'_api_item_operation_name' => 'get',
|
||||
'_api_identifiers' => ['id', 'nextId'],
|
||||
'id' => 3,
|
||||
'nextId' => 5
|
||||
'nextId' => 5,
|
||||
])->shouldBeCalledTimes(1);
|
||||
|
||||
$identifierConverter->convert(['id' => 3, 'nextId' => 5], AddProductReview::class)->willReturn(['3', '5']);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ final class AddProductReviewHandlerSpec extends ObjectBehavior
|
|||
5,
|
||||
'Really good stuff',
|
||||
'winter_cap'
|
||||
)
|
||||
),
|
||||
])
|
||||
;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ final class BlameCartHandlerSpec extends ObjectBehavior
|
|||
$this
|
||||
->shouldThrow(\InvalidArgumentException::class)
|
||||
->during('__invoke', [
|
||||
new BlameCart('sylius@example.com', 'TOKEN')
|
||||
new BlameCart('sylius@example.com', 'TOKEN'),
|
||||
])
|
||||
;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,8 @@ namespace spec\Sylius\Bundle\ApiBundle\CommandHandler\Cart;
|
|||
use PhpSpec\ObjectBehavior;
|
||||
use Sylius\Bundle\ApiBundle\Command\Cart\RemoveItemFromCart;
|
||||
use Sylius\Bundle\OrderBundle\Doctrine\ORM\OrderItemRepository;
|
||||
use Sylius\Component\Core\Model\Order;
|
||||
use Sylius\Component\Core\Model\OrderInterface;
|
||||
use Sylius\Component\Core\Model\OrderItemInterface;
|
||||
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
|
||||
use Sylius\Component\Order\Modifier\OrderModifierInterface;
|
||||
use Sylius\Component\Product\Resolver\ProductVariantResolverInterface;
|
||||
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
|
||||
|
|
|
|||
|
|
@ -83,21 +83,21 @@ final class RegisterShopUserHandlerSpec extends ObjectBehavior
|
|||
$customer->setPhoneNumber('+13104322400')->shouldBeCalled();
|
||||
$customer->setUser($shopUser)->shouldBeCalled();
|
||||
|
||||
$channelRepository->findOneByCode('CHANNEL_CODE')->willReturn($channel);
|
||||
$channelRepository->findOneByCode('CHANNEL_CODE')->willReturn($channel);
|
||||
$channel->isAccountVerificationRequired()->willReturn(true);
|
||||
$generator->generate()->willReturn('TOKEN');
|
||||
$shopUser->setEmailVerificationToken('TOKEN')->shouldBeCalled();
|
||||
|
||||
$shopUserManager->persist($shopUser)->shouldBeCalled();
|
||||
|
||||
$sendRegistrationEmailCommand = new SendAccountRegistrationEmail('WILL.SMITH@example.com', 'en_US', 'CHANNEL_CODE');
|
||||
$sendRegistrationEmailCommand = new SendAccountRegistrationEmail('WILL.SMITH@example.com', 'en_US', 'CHANNEL_CODE');
|
||||
$commandBus
|
||||
->dispatch($sendRegistrationEmailCommand, [new DispatchAfterCurrentBusStamp()])
|
||||
->shouldBeCalled()
|
||||
->willReturn(new Envelope($sendRegistrationEmailCommand))
|
||||
;
|
||||
|
||||
$sendVerificationEmailCommand = new SendAccountVerificationEmail('WILL.SMITH@example.com', 'en_US', 'CHANNEL_CODE');
|
||||
$sendVerificationEmailCommand = new SendAccountVerificationEmail('WILL.SMITH@example.com', 'en_US', 'CHANNEL_CODE');
|
||||
$commandBus
|
||||
->dispatch($sendVerificationEmailCommand, [new DispatchAfterCurrentBusStamp()])
|
||||
->shouldBeCalled()
|
||||
|
|
@ -117,7 +117,7 @@ final class RegisterShopUserHandlerSpec extends ObjectBehavior
|
|||
ChannelInterface $channel,
|
||||
MessageBusInterface $commandBus
|
||||
): void {
|
||||
$command = new RegisterShopUser('Will', 'Smith', 'WILL.SMITH@example.com', 'iamrobot','+13104322400',true);
|
||||
$command = new RegisterShopUser('Will', 'Smith', 'WILL.SMITH@example.com', 'iamrobot', '+13104322400', true);
|
||||
$command->setChannelCode('CHANNEL_CODE');
|
||||
$command->setLocaleCode('en_US');
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ final class RegisterShopUserHandlerSpec extends ObjectBehavior
|
|||
|
||||
$shopUserManager->persist($shopUser)->shouldBeCalled();
|
||||
|
||||
$sendRegistrationEmailCommand = new SendAccountRegistrationEmail('WILL.SMITH@example.com', 'en_US', 'CHANNEL_CODE');
|
||||
$sendRegistrationEmailCommand = new SendAccountRegistrationEmail('WILL.SMITH@example.com', 'en_US', 'CHANNEL_CODE');
|
||||
$commandBus
|
||||
->dispatch($sendRegistrationEmailCommand, [new DispatchAfterCurrentBusStamp()])
|
||||
->shouldBeCalled()
|
||||
|
|
@ -166,7 +166,7 @@ final class RegisterShopUserHandlerSpec extends ObjectBehavior
|
|||
|
||||
$shopUserManager->persist($shopUser)->shouldNotBeCalled();
|
||||
|
||||
$sendRegistrationEmailCommand = new SendAccountRegistrationEmail('WILL.SMITH@example.com', 'en_US', 'CHANNEL_CODE');
|
||||
$sendRegistrationEmailCommand = new SendAccountRegistrationEmail('WILL.SMITH@example.com', 'en_US', 'CHANNEL_CODE');
|
||||
$commandBus->dispatch($sendRegistrationEmailCommand)->shouldNotBeCalled()->willReturn(new Envelope($sendRegistrationEmailCommand));
|
||||
|
||||
$this
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ final class RequestResetPasswordTokenHandlerSpec extends ObjectBehavior
|
|||
ShopUserInterface $shopUser,
|
||||
GeneratorInterface $generator,
|
||||
MessageBusInterface $messageBus
|
||||
): void{
|
||||
): void {
|
||||
$userRepository->findOneByEmail('test@email.com')->willReturn($shopUser);
|
||||
|
||||
$generator->generate()->willReturn('TOKEN');
|
||||
|
|
@ -50,7 +50,6 @@ final class RequestResetPasswordTokenHandlerSpec extends ObjectBehavior
|
|||
[new DispatchAfterCurrentBusStamp()]
|
||||
)->willReturn(new Envelope($sendResetPasswordEmail))->shouldBeCalled();
|
||||
|
||||
|
||||
$requestResetPasswordToken = new RequestResetPasswordToken('test@email.com');
|
||||
$requestResetPasswordToken->setChannelCode('WEB');
|
||||
$requestResetPasswordToken->setLocaleCode('en_US');
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ final class ResendVerificationEmailHandlerSpec extends ObjectBehavior
|
|||
[new DispatchAfterCurrentBusStamp()]
|
||||
)->willReturn(new Envelope($sendAccountVerificationEmail))->shouldBeCalled();
|
||||
|
||||
|
||||
$resendVerificationEmail = new ResendVerificationEmail('test@email.com');
|
||||
$resendVerificationEmail->setChannelCode('WEB');
|
||||
$resendVerificationEmail->setLocaleCode('en_US');
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ final class ResetPasswordHandlerSpec extends ObjectBehavior
|
|||
$userRepository->findOneBy(['passwordResetToken' => 'TOKEN'])->willReturn($shopUser);
|
||||
$metadata->getParameter('resetting')->willReturn(['token' => ['ttl' => 'P5D']]);
|
||||
|
||||
$shopUser->isPasswordRequestNonExpired(Argument::that(function(\DateInterval $dateInterval) {
|
||||
$shopUser->isPasswordRequestNonExpired(Argument::that(function (\DateInterval $dateInterval) {
|
||||
return $dateInterval->format('%d') === '5';
|
||||
} ))->willReturn(true);
|
||||
}))->willReturn(true);
|
||||
|
||||
$shopUser->getPasswordResetToken()->willReturn('TOKEN');
|
||||
|
||||
|
|
@ -71,9 +71,9 @@ final class ResetPasswordHandlerSpec extends ObjectBehavior
|
|||
$userRepository->findOneBy(['passwordResetToken' => 'TOKEN'])->willReturn($shopUser);
|
||||
$metadata->getParameter('resetting')->willReturn(['token' => ['ttl' => 'P5D']]);
|
||||
|
||||
$shopUser->isPasswordRequestNonExpired(Argument::that(function(\DateInterval $dateInterval) {
|
||||
$shopUser->isPasswordRequestNonExpired(Argument::that(function (\DateInterval $dateInterval) {
|
||||
return $dateInterval->format('%d') === '5';
|
||||
} ))->willReturn(false);
|
||||
}))->willReturn(false);
|
||||
|
||||
$shopUser->getPasswordResetToken()->willReturn('TOKEN');
|
||||
$shopUser->setPlainPassword('newPassword')->shouldNotBeCalled();
|
||||
|
|
@ -98,9 +98,9 @@ final class ResetPasswordHandlerSpec extends ObjectBehavior
|
|||
$userRepository->findOneBy(['passwordResetToken' => 'TOKEN'])->willReturn($shopUser);
|
||||
$metadata->getParameter('resetting')->willReturn(['token' => ['ttl' => 'P5D']]);
|
||||
|
||||
$shopUser->isPasswordRequestNonExpired(Argument::that(function(\DateInterval $dateInterval) {
|
||||
$shopUser->isPasswordRequestNonExpired(Argument::that(function (\DateInterval $dateInterval) {
|
||||
return $dateInterval->format('%d') === '5';
|
||||
} ))->willReturn(false);
|
||||
}))->willReturn(false);
|
||||
|
||||
$shopUser->getPasswordResetToken()->willReturn('BADTOKEN');
|
||||
$shopUser->setPlainPassword('newPassword')->shouldNotBeCalled();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ namespace spec\Sylius\Bundle\ApiBundle\DataProvider;
|
|||
|
||||
use ApiPlatform\Core\DataProvider\ItemDataProviderInterface;
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Sylius\Bundle\ApiBundle\DataProvider\ChannelAwareItemDataProvider;
|
||||
use Sylius\Bundle\ApiBundle\Serializer\ContextKeys;
|
||||
use Sylius\Component\Channel\Context\ChannelContextInterface;
|
||||
use Sylius\Component\Channel\Context\ChannelNotFoundException;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
namespace spec\Sylius\Bundle\ApiBundle\DataTransformer;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
use Sylius\Bundle\ApiBundle\Command\LocaleCodeAwareInterface;
|
||||
use Sylius\Component\Locale\Context\LocaleContextInterface;
|
||||
use Sylius\Component\Resource\Model\ResourceInterface;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ use Sylius\Component\Core\Model\ShopUserInterface;
|
|||
|
||||
final class LoggedInShopUserEmailAwareCommandDataTransformerSpec extends ObjectBehavior
|
||||
{
|
||||
function let(UserContextInterface $userContext) {
|
||||
function let(UserContextInterface $userContext)
|
||||
{
|
||||
$this->beConstructedWith($userContext);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,5 +62,4 @@ class AcceptedProductReviewsExtensionSpec extends ObjectBehavior
|
|||
|
||||
$this->applyToCollection($queryBuilder, $queryNameGenerator, ProductReview::class, 'shop_get', []);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,8 +47,7 @@ final class CommandFieldItemIriToIdentifierDenormalizerSpec extends ObjectBehavi
|
|||
|
||||
function it_supports_denormalization_add_product_review(
|
||||
CommandItemIriArgumentToIdentifierMapInterface $commandItemIriArgumentToIdentifierMap
|
||||
): void
|
||||
{
|
||||
): void {
|
||||
$context['input']['class'] = AddProductReview::class;
|
||||
|
||||
$commandItemIriArgumentToIdentifierMap->has(AddProductReview::class)->willReturn(true);
|
||||
|
|
@ -66,8 +65,7 @@ final class CommandFieldItemIriToIdentifierDenormalizerSpec extends ObjectBehavi
|
|||
|
||||
function it_does_not_support_denormalization_for_not_supported_class(
|
||||
CommandItemIriArgumentToIdentifierMapInterface $commandItemIriArgumentToIdentifierMap
|
||||
): void
|
||||
{
|
||||
): void {
|
||||
$context['input']['class'] = Order::class;
|
||||
|
||||
$commandItemIriArgumentToIdentifierMap->has(Order::class)->willReturn(false);
|
||||
|
|
@ -104,7 +102,7 @@ final class CommandFieldItemIriToIdentifierDenormalizerSpec extends ObjectBehavi
|
|||
'rating' => 5,
|
||||
'comment' => 'ok',
|
||||
'product' => 'cap_code',
|
||||
'email' => 'john@example.com'
|
||||
'email' => 'john@example.com',
|
||||
],
|
||||
AddProductReview::class,
|
||||
null,
|
||||
|
|
@ -119,7 +117,7 @@ final class CommandFieldItemIriToIdentifierDenormalizerSpec extends ObjectBehavi
|
|||
'rating' => 5,
|
||||
'comment' => 'ok',
|
||||
'product' => '/api/v2/shop/products/cap_code',
|
||||
'email' => 'john@example.com'
|
||||
'email' => 'john@example.com',
|
||||
],
|
||||
AddProductReview::class,
|
||||
null,
|
||||
|
|
|
|||
|
|
@ -13,14 +13,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace spec\Sylius\Bundle\ApiBundle\Serializer;
|
||||
|
||||
use ApiPlatform\Core\Serializer\SerializerContextBuilderInterface;
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Sylius\Component\Channel\Context\ChannelContextInterface;
|
||||
use Sylius\Component\Core\Calculator\ProductVariantPricesCalculatorInterface;
|
||||
use Sylius\Component\Core\Model\ChannelInterface;
|
||||
use Sylius\Component\Core\Model\ProductVariant;
|
||||
use Sylius\Component\Order\Model\Order;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
final class ProductVariantSerializerSpec extends ObjectBehavior
|
||||
|
|
@ -33,7 +31,8 @@ final class ProductVariantSerializerSpec extends ObjectBehavior
|
|||
$this->beConstructedWith($objectNormalizer, $pricesCalculator, $channelContext);
|
||||
}
|
||||
|
||||
function it_supports_only_product_variant_interface(): void {
|
||||
function it_supports_only_product_variant_interface(): void
|
||||
{
|
||||
$variant = new ProductVariant();
|
||||
$this->supportsNormalization($variant)->shouldReturn(true);
|
||||
|
||||
|
|
@ -41,7 +40,8 @@ final class ProductVariantSerializerSpec extends ObjectBehavior
|
|||
$this->supportsNormalization($order)->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_does_not_serialize_if_item_operation_name_is_admin_get(): void {
|
||||
function it_does_not_serialize_if_item_operation_name_is_admin_get(): void
|
||||
{
|
||||
$variant = new ProductVariant();
|
||||
$this->supportsNormalization($variant, null, ['item_operation_name' => 'admin_get'])->shouldReturn(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ namespace spec\Sylius\Bundle\ApiBundle\Validator\Constraints;
|
|||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Sylius\Bundle\ApiBundle\Command\ChangeShopUserPassword;
|
||||
use Sylius\Bundle\ApiBundle\Command\ResetPassword;
|
||||
use Sylius\Bundle\ApiBundle\Validator\Constraints\ConfirmResetPassword;
|
||||
use Sylius\Bundle\ApiBundle\Validator\Constraints\CorrectChangeShopUserConfirmPassword;
|
||||
use Symfony\Component\Validator\ConstraintValidatorInterface;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
|
@ -34,7 +32,7 @@ final class CorrectChangeShopUserConfirmPasswordValidatorSpec extends ObjectBeha
|
|||
$constraint = new CorrectChangeShopUserConfirmPassword();
|
||||
$this->initialize($executionContext);
|
||||
|
||||
$value = new ChangeShopUserPassword('password','password', 'current');
|
||||
$value = new ChangeShopUserPassword('password', 'password', 'current');
|
||||
|
||||
$executionContext->buildViolation('sylius.user.plainPassword.mismatch')->shouldNotBeCalled();
|
||||
|
||||
|
|
@ -48,7 +46,7 @@ final class CorrectChangeShopUserConfirmPasswordValidatorSpec extends ObjectBeha
|
|||
$constraint = new CorrectChangeShopUserConfirmPassword();
|
||||
$this->initialize($executionContext);
|
||||
|
||||
$value = new ChangeShopUserPassword('password','notaPassword', 'current');
|
||||
$value = new ChangeShopUserPassword('password', 'notaPassword', 'current');
|
||||
|
||||
$executionContext->buildViolation('sylius.user.plainPassword.mismatch')->willReturn($constraintViolationBuilder);
|
||||
$constraintViolationBuilder->atPath('newPassword')->willReturn($constraintViolationBuilder);
|
||||
|
|
|
|||
|
|
@ -17,9 +17,7 @@ use PhpSpec\ObjectBehavior;
|
|||
use Prophecy\Argument;
|
||||
use Sylius\Bundle\ApiBundle\Context\UserContextInterface;
|
||||
use Sylius\Bundle\ApiBundle\Validator\Constraints\UniqueReviewerEmail;
|
||||
use Sylius\Bundle\ApiBundle\Validator\Constraints\UniqueShopUserEmail;
|
||||
use Sylius\Component\Core\Model\ShopUserInterface;
|
||||
use Sylius\Component\User\Canonicalizer\CanonicalizerInterface;
|
||||
use Sylius\Component\User\Repository\UserRepositoryInterface;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidatorInterface;
|
||||
|
|
@ -67,7 +65,8 @@ final class UniqueReviewerEmailValidatorSpec extends ObjectBehavior
|
|||
{
|
||||
$this
|
||||
->shouldThrow(\InvalidArgumentException::class)
|
||||
->during('validate', ['', new class() extends Constraint {}])
|
||||
->during('validate', ['', new class() extends Constraint {
|
||||
}])
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Symfony\Component\Dotenv\Dotenv;
|
||||
|
||||
require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
|
@ -19,4 +21,4 @@ if (is_array($env = @include $envLocalPhpPath)) {
|
|||
|
||||
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
|
||||
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
|
||||
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
|
||||
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$projectDir = $container->getParameter('kernel.project_dir');
|
||||
$container->setParameter('kernel.api_bundle_path', str_replace('/test', '', $projectDir));
|
||||
|
|
|
|||
|
|
@ -14,23 +14,11 @@ declare(strict_types=1);
|
|||
namespace Sylius\Bundle\ApiBundle\Application;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||
use Symfony\Component\Config\Loader\DelegatingLoader;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\Config\Loader\LoaderResolver;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\DirectoryLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\GlobFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
use Symfony\Component\HttpKernel\Config\FileLocator;
|
||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||
use Symfony\Component\Routing\RouteCollectionBuilder;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
final class Kernel extends BaseKernel
|
||||
{
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ final class PromotionTest extends ApiTestCase
|
|||
'hydra:member' => [
|
||||
[
|
||||
'@type' => 'Promotion',
|
||||
'name' => 'Sunday promotion'
|
||||
'name' => 'Sunday promotion',
|
||||
],
|
||||
],
|
||||
'hydra:totalItems' => 1,
|
||||
|
|
@ -70,7 +70,7 @@ final class PromotionTest extends ApiTestCase
|
|||
'hydra:member' => [
|
||||
[
|
||||
'@type' => 'Promotion',
|
||||
'name' => 'Sunday promotion'
|
||||
'name' => 'Sunday promotion',
|
||||
],
|
||||
],
|
||||
'hydra:totalItems' => 1,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ final class CircularDependencyBreakingErrorListenerPass implements CompilerPassI
|
|||
|
||||
$definition = new Definition(CircularDependencyBreakingErrorListener::class);
|
||||
$definition->setDecoratedService('exception_listener');
|
||||
$definition->addArgument(new Reference(CircularDependencyBreakingErrorListener::class .'.inner'));
|
||||
$definition->addArgument(new Reference(CircularDependencyBreakingErrorListener::class . '.inner'));
|
||||
|
||||
$container->setDefinition(
|
||||
CircularDependencyBreakingErrorListener::class,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ final class CircularDependencyBreakingExceptionListenerPass implements CompilerP
|
|||
|
||||
$definition = new Definition(CircularDependencyBreakingExceptionListener::class);
|
||||
$definition->setDecoratedService('twig.exception_listener');
|
||||
$definition->addArgument(new Reference(CircularDependencyBreakingExceptionListener::class .'.inner'));
|
||||
$definition->addArgument(new Reference(CircularDependencyBreakingExceptionListener::class . '.inner'));
|
||||
|
||||
$container->setDefinition(
|
||||
CircularDependencyBreakingExceptionListener::class,
|
||||
|
|
|
|||
|
|
@ -42,9 +42,7 @@ class OrderRepository extends BaseOrderRepository implements OrderRepositoryInte
|
|||
public function createListQueryBuilder(): QueryBuilder
|
||||
{
|
||||
return $this->createQueryBuilder('o')
|
||||
->addSelect('channel')
|
||||
->addSelect('customer')
|
||||
->innerJoin('o.channel', 'channel')
|
||||
->leftJoin('o.customer', 'customer')
|
||||
->andWhere('o.state != :state')
|
||||
->setParameter('state', OrderInterface::STATE_CART)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
|
|
@ -14,8 +16,8 @@ namespace Sylius\Bundle\CoreBundle\EventListener;
|
|||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
|
||||
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\EventListener\LocaleAwareListener as DecoratedLocaleListener;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
|
||||
class LocaleAwareListener implements EventSubscriberInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,19 +21,19 @@ use Doctrine\Migrations\AbstractMigration;
|
|||
*/
|
||||
final class Version20210311142134 extends AbstractMigration
|
||||
{
|
||||
public function getDescription() : string
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema) : void
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE sylius_admin_user CHANGE password password VARCHAR(255) DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE sylius_shop_user CHANGE password password VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE sylius_admin_user CHANGE password password VARCHAR(255) CHARACTER SET utf8 NOT NULL COLLATE `utf8_unicode_ci`');
|
||||
|
|
|
|||
|
|
@ -15,13 +15,12 @@ namespace Sylius\Bundle\CoreBundle\Tests\DependencyInjection;
|
|||
|
||||
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
|
||||
use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\CircularDependencyBreakingErrorListenerPass;
|
||||
use Sylius\Bundle\CoreBundle\EventListener\CircularDependencyBreakingErrorListener;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Sylius\Bundle\CoreBundle\EventListener\CircularDependencyBreakingErrorListener;
|
||||
|
||||
final class CircularDependencyBreakingErrorListenerPassTest extends AbstractCompilerPassTestCase
|
||||
{
|
||||
|
||||
public function it_register_circular_dependency_breaking_error_listener_when_exception_listener_is_registered(): void
|
||||
{
|
||||
$this->container->setDefinition('exception_listener', new Definition('ExceptionListener'));
|
||||
|
|
|
|||
|
|
@ -15,13 +15,12 @@ namespace Sylius\Bundle\CoreBundle\Tests\DependencyInjection;
|
|||
|
||||
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase;
|
||||
use Sylius\Bundle\CoreBundle\DependencyInjection\Compiler\CircularDependencyBreakingExceptionListenerPass;
|
||||
use Sylius\Bundle\CoreBundle\EventListener\CircularDependencyBreakingExceptionListener;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Sylius\Bundle\CoreBundle\EventListener\CircularDependencyBreakingExceptionListener;
|
||||
|
||||
final class CircularDependencyBreakingExceptionListenerPassTest extends AbstractCompilerPassTestCase
|
||||
{
|
||||
|
||||
public function it_register_circular_dependency_breaking_error_listener_when_exception_listener_is_registered(): void
|
||||
{
|
||||
$this->container->setDefinition('twig.exception_listener', new Definition('ExceptionListener'));
|
||||
|
|
|
|||
|
|
@ -13,15 +13,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Bundle\PayumBundle\DependencyInjection;
|
||||
|
||||
use Payum\Bundle\PayumBundle\Controller;
|
||||
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
final class SyliusPayumExtension extends AbstractResourceExtension implements PrependExtensionInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@ use Payum\Core\Storage\AbstractStorage;
|
|||
*/
|
||||
class DoctrineStorage extends AbstractStorage
|
||||
{
|
||||
/**
|
||||
* @var ObjectManager
|
||||
*/
|
||||
/** @var ObjectManager */
|
||||
protected $objectManager;
|
||||
|
||||
public function __construct(ObjectManager $objectManager, $modelClass)
|
||||
|
|
|
|||
|
|
@ -16,16 +16,10 @@ namespace Sylius\Bundle\ProductBundle\Controller;
|
|||
use Sylius\Bundle\ProductBundle\Form\Type\ProductAttributeChoiceType;
|
||||
use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
|
||||
use Sylius\Component\Attribute\Model\AttributeInterface;
|
||||
use Sylius\Component\Attribute\Model\AttributeValueInterface;
|
||||
use Sylius\Component\Core\Model\ProductInterface;
|
||||
use Sylius\Component\Core\Repository\ProductRepositoryInterface;
|
||||
use Sylius\Component\Product\Model\ProductAttributeInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
class ProductAttributeController extends ResourceController
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ namespace Sylius\Bundle\ReviewBundle\Doctrine\ORM\Subscriber;
|
|||
use Doctrine\Common\EventSubscriber;
|
||||
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
final class LoadMetadataSubscriber implements EventSubscriber
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ namespace spec\Sylius\Bundle\ShopBundle\EventListener;
|
|||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Prophecy\Argument;
|
||||
use Sylius\Bundle\AdminBundle\SectionResolver\AdminSection;
|
||||
use Sylius\Bundle\CoreBundle\SectionResolver\SectionProviderInterface;
|
||||
use Sylius\Bundle\ShopBundle\SectionResolver\ShopSection;
|
||||
use Sylius\Bundle\UserBundle\Event\UserEvent;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Bundle\UiBundle\DependencyInjection;
|
||||
|
||||
use Laminas\Stdlib\SplPriorityQueue;
|
||||
use Sylius\Bundle\UiBundle\Registry\TemplateBlock;
|
||||
use Sylius\Bundle\UiBundle\Registry\TemplateBlockRegistryInterface;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
|
|
@ -20,7 +21,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Laminas\Stdlib\SplPriorityQueue;
|
||||
|
||||
final class SyliusUiExtension extends Extension
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
|||
namespace spec\Sylius\Bundle\UiBundle\Controller;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Component\Attribute\Model;
|
||||
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
class AttributeValue implements AttributeValueInterface
|
||||
{
|
||||
/** @var mixed */
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Component\Channel\Context;
|
||||
|
||||
use Sylius\Component\Channel\Model\ChannelInterface;
|
||||
use Laminas\Stdlib\PriorityQueue;
|
||||
use Sylius\Component\Channel\Model\ChannelInterface;
|
||||
|
||||
final class CompositeChannelContext implements ChannelContextInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Component\Channel\Context\RequestBased;
|
||||
|
||||
use Laminas\Stdlib\PriorityQueue;
|
||||
use Sylius\Component\Channel\Model\ChannelInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Laminas\Stdlib\PriorityQueue;
|
||||
|
||||
final class CompositeRequestResolver implements RequestResolverInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ final class ShippingPercentageDiscountPromotionActionCommand implements Promotio
|
|||
$adjustment->setAmount(-$adjustmentAmount);
|
||||
$shipment->addAdjustment($adjustment);
|
||||
$result = true;
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Component\Order\Context;
|
||||
|
||||
use Sylius\Component\Order\Model\OrderInterface;
|
||||
use Laminas\Stdlib\PriorityQueue;
|
||||
use Sylius\Component\Order\Model\OrderInterface;
|
||||
|
||||
final class CompositeCartContext implements CartContextInterface
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Component\Order\Processor;
|
||||
|
||||
use Sylius\Component\Order\Model\OrderInterface;
|
||||
use Laminas\Stdlib\PriorityQueue;
|
||||
use Sylius\Component\Order\Model\OrderInterface;
|
||||
|
||||
final class CompositeOrderProcessor implements OrderProcessorInterface
|
||||
{
|
||||
|
|
|
|||
24
symfony.lock
24
symfony.lock
|
|
@ -378,6 +378,9 @@
|
|||
"nette/finder": {
|
||||
"version": "v2.5.2"
|
||||
},
|
||||
"nette/neon": {
|
||||
"version": "v3.2.2"
|
||||
},
|
||||
"nette/robot-loader": {
|
||||
"version": "v3.3.0"
|
||||
},
|
||||
|
|
@ -1018,30 +1021,45 @@
|
|||
"symfony/yaml": {
|
||||
"version": "v4.4.13"
|
||||
},
|
||||
"symplify/auto-bind-parameter": {
|
||||
"version": "v8.2.9"
|
||||
},
|
||||
"symplify/autowire-array-parameter": {
|
||||
"version": "v8.2.9"
|
||||
},
|
||||
"symplify/coding-standard": {
|
||||
"version": "v8.1.19"
|
||||
},
|
||||
"symplify/composer-json-manipulator": {
|
||||
"version": "v9.3.0"
|
||||
},
|
||||
"symplify/console-color-diff": {
|
||||
"version": "v8.2.9"
|
||||
},
|
||||
"symplify/console-package-builder": {
|
||||
"version": "v9.3.0"
|
||||
},
|
||||
"symplify/easy-coding-standard": {
|
||||
"version": "v8.1.19"
|
||||
},
|
||||
"symplify/easy-testing": {
|
||||
"version": "v9.3.0"
|
||||
},
|
||||
"symplify/package-builder": {
|
||||
"version": "8.2.21"
|
||||
},
|
||||
"symplify/rule-doc-generator-contracts": {
|
||||
"version": "v9.3.0"
|
||||
},
|
||||
"symplify/set-config-resolver": {
|
||||
"version": "8.2.21"
|
||||
},
|
||||
"symplify/skipper": {
|
||||
"version": "v9.3.0"
|
||||
},
|
||||
"symplify/smart-file-system": {
|
||||
"version": "8.2.21"
|
||||
},
|
||||
"symplify/symplify-kernel": {
|
||||
"version": "v9.3.0"
|
||||
},
|
||||
"textalk/websocket": {
|
||||
"version": "1.2.0"
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue