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

Fix: PHP Stan errors #12

Merged
merged 2 commits into from
Dec 16, 2022
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: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
.DS_Store

vendor
composer.lock
composer.lock

src/Generated
src/Orm
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ codeception:
./vendor/bin/codecept run --env standalone

.PHONY: ci
ci: phpcs codeception
ci: phpcs codeception phpstan
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ parameters:
- src/Orm/Zed
ignoreErrors:
- '#.* on an unknown class Generated\\(Client|Glue|Service|Yves|Zed)\\.*#'
- '#.*\\ContentfulPageSearch\\.*#'
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public function render(ContentfulEntryResponseTransfer $response, array $additio
$placeholders = $this->getPlaceholders($response, $additionalPlaceholders);
$placeholders = $this->mergeAdditionalPlaceholders($response, $placeholders, $additionalPlaceholders);

if (!method_exists($this, 'getTwigEnvironment')) {
return '';
}

try {
return $this->getTwigEnvironment()->render($this->getTemplatePath($response), $placeholders);
} catch (Throwable $throwable) {
Expand Down
22 changes: 0 additions & 22 deletions src/FondOfSpryker/Yves/Contentful/ContentfulDependencyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Aptoma\Twig\Extension\MarkdownEngine\MichelfMarkdownEngine;
use Aptoma\Twig\Extension\MarkdownExtension;
use FondOfSpryker\Yves\Contentful\Dependency\Client\ContentfulToContentfulPageSearchClientBridge;
use FondOfSpryker\Yves\Contentful\Dependency\Client\ContentfulToSearchClientBridge;
use FondOfSpryker\Yves\Contentful\Dependency\Renderer\ContentfulToRendererBridge;
use Spryker\Shared\Kernel\ContainerInterface;
use Spryker\Yves\Kernel\AbstractBundleDependencyProvider;
Expand All @@ -28,11 +27,6 @@ class ContentfulDependencyProvider extends AbstractBundleDependencyProvider
*/
public const CLIENT_STORE = 'CLIENT_STORE';

/**
* @var string
*/
public const SEARCH_CLIENT = 'SEARCH_CLIENT';

/**
* @var string
*/
Expand Down Expand Up @@ -162,22 +156,6 @@ protected function provideCategoryStorageClient(Container $container): Container
return $container;
}

/**
* @param \Spryker\Yves\Kernel\Container $container
*
* @return \Spryker\Yves\Kernel\Container
*/
protected function getSearchClient(Container $container): Container
{
$container[static::SEARCH_CLIENT] = function (Container $container) {
return new ContentfulToSearchClientBridge(
$container->getLocator()->search()->client(),
);
};

return $container;
}

/**
* @param \Spryker\Yves\Kernel\Container $container
*
Expand Down
9 changes: 0 additions & 9 deletions src/FondOfSpryker/Yves/Contentful/ContentfulFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
use FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeFactoryInterface;
use FondOfSpryker\Yves\Contentful\Renderer\Navigation\Node\NavigationNodeMapperInterface;
use Spryker\Client\CategoryStorage\CategoryStorageClientInterface;
use Spryker\Client\Search\SearchClientInterface;
use Spryker\Client\Store\StoreClientInterface;
use Spryker\Yves\Kernel\AbstractFactory;
use Symfony\Component\HttpFoundation\RequestStack;
Expand Down Expand Up @@ -262,12 +261,4 @@ public function getLocale(): string
{
return $this->getProvidedDependency(ContentfulDependencyProvider::SERVICE_LOCALE);
}

/**
* @return \Spryker\Client\Search\SearchClientInterface
*/
public function getSearchClient(): SearchClientInterface
{
return $this->getProvidedDependency(ContentfulDependencyProvider::SEARCH_CLIENT);
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class NavigationItemCategoryMapper implements NavigationItemMapperInterface
/**
* @var string
*/
private const KEY_CATEGORY_ID = 'typeId';
protected const KEY_CATEGORY_ID = 'typeId';

/**
* @var string
*/
private const KEY_CUSTOM_TEXT = 'customText';
protected const KEY_CUSTOM_TEXT = 'customText';

/**
* @return string
Expand All @@ -31,7 +31,7 @@ public function getType(): string
}

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface
*/
Expand All @@ -48,7 +48,7 @@ public function createNavigationItem(array $navigation): NavigationItemInterface
}

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return bool
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class NavigationItemContentfulPageMapper implements NavigationItemMapperInterfac
/**
* @var string
*/
private const KEY_CONTENTFUL_ENTRY_ID = 'typeId';
protected const KEY_CONTENTFUL_ENTRY_ID = 'typeId';

/**
* @var string
*/
private const KEY_CUSTOM_TEXT = 'customText';
protected const KEY_CUSTOM_TEXT = 'customText';

/**
* @return string
Expand All @@ -31,7 +31,7 @@ public function getType(): string
}

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface
*/
Expand All @@ -49,7 +49,7 @@ public function createNavigationItem(array $navigation): NavigationItemInterface
}

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return bool
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class NavigationItemCustomMapper implements NavigationItemMapperInterface
/**
* @var string
*/
private const KEY_URL = 'url';
protected const KEY_URL = 'url';

/**
* @var string
*/
private const KEY_CUSTOM_TEXT = 'customText';
protected const KEY_CUSTOM_TEXT = 'customText';

/**
* @return string
Expand All @@ -31,7 +31,7 @@ public function getType(): string
}

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface
*/
Expand All @@ -44,7 +44,7 @@ public function createNavigationItem(array $navigation): NavigationItemInterface
}

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return bool
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public function __construct(NavigationItemCollectionInterface $collection, array
}

/**
* @param array<<array<string>> $navigation
* @param array<mixed> $navigationItemsArray
*
* @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemCollectionInterface
*/
public function build(array $navigation): NavigationItemCollectionInterface
public function build(array $navigationItemsArray): NavigationItemCollectionInterface
{
$this->collection->clear();
foreach ($navigation as $navigationChild) {
foreach ($navigationItemsArray as $navigationChild) {
// create navigation items recursively
$item = $this->createNavigationItemRecursive($navigationChild);
if ($item === null) {
Expand All @@ -56,7 +56,7 @@ public function build(array $navigation): NavigationItemCollectionInterface
}

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface|null
*/
Expand Down Expand Up @@ -100,7 +100,7 @@ private function createNavigationItemRecursive(array $navigation): ?NavigationIt
}

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return bool
*/
Expand All @@ -110,7 +110,7 @@ protected function hasType(array $navigation): bool
}

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return string
*/
Expand All @@ -120,7 +120,7 @@ protected function getType(array $navigation): string
}

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return bool
*/
Expand All @@ -132,9 +132,9 @@ protected function hasChildren(array $navigation): bool
}

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return array<string>
* @return array<mixed>
*/
protected function getChildren(array $navigation): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
interface NavigationItemFactoryInterface
{
/**
* @param array<string> $navigationItemsArray
* @param array<array<string>> $navigationItemsArray
*
* @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemCollectionInterface
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ interface NavigationItemMapperInterface
public function getType(): string;

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return \FondOfSpryker\Yves\Contentful\Renderer\Navigation\Item\NavigationItemInterface
*/
public function createNavigationItem(array $navigation): NavigationItemInterface;

/**
* @param array<string> $navigation
* @param array<mixed> $navigation
*
* @return bool
*/
Expand Down
Loading