Skip to content

Commit

Permalink
Merge pull request #33 from delyriand/fix/route-condition
Browse files Browse the repository at this point in the history
Routes condition: we only check if nocommerce is active because we have api in the list
  • Loading branch information
maximehuran authored Feb 12, 2024
2 parents 69f92d9 + 30f1c43 commit ebf5df7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Collector/NoCommerceSyliusCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function getDefaultLocaleCode(): ?string
* @SuppressWarnings(PHPMD.EmptyCatchBlock)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function collect(Request $request, Response $response, Throwable $exception = null): void
public function collect(Request $request, Response $response, ?Throwable $exception = null): void
{
try {
/** @var ChannelInterface $channel */
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/SyliusNoCommerceKernelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function loadRoutes(LoaderInterface $loader): RouteCollection
foreach ($collection as $name => $route) {
foreach ($routesToRemove as $routeToRemove) {
if (false !== strpos($name, $routeToRemove)) {
$route->setCondition("not(context.getPathInfo() matches '`^%sylius.security.new_api_route%`') and not context.checkNoCommerce()");
$route->setCondition('not context.checkNoCommerce()');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/FeaturesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(
$this->nocommerceSettings = $nocommerceSettings;
}

public function isNoCommerceEnabledForChannel(ChannelInterface $channel = null): bool
public function isNoCommerceEnabledForChannel(?ChannelInterface $channel = null): bool
{
try {
if (null === $channel) {
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/FeaturesProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@

interface FeaturesProviderInterface
{
public function isNoCommerceEnabledForChannel(ChannelInterface $channel = null): bool;
public function isNoCommerceEnabledForChannel(?ChannelInterface $channel = null): bool;
}

0 comments on commit ebf5df7

Please sign in to comment.