Skip to content

Commit

Permalink
Update PHPStan version and fix new errors
Browse files Browse the repository at this point in the history
  • Loading branch information
murtukov committed Jan 30, 2021
1 parent 4d0aaf9 commit 7bf5085
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"require-dev": {
"doctrine/orm": "^2.5",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.32",
"phpstan/phpstan": "^0.12.58",
"phpstan/phpstan-phpunit": "^0.12.11",
"phpstan/phpstan-symfony": "^0.12.6",
"phpunit/phpunit": "^9.2",
Expand Down
5 changes: 4 additions & 1 deletion src/DependencyInjection/Compiler/ConfigParserPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ private function mappingConfig(array $config, ContainerBuilder $container): arra

// app only config files (yml or xml or graphql)
if ($mappingConfig['auto_discover']['root_dir'] && $container->hasParameter('kernel.root_dir')) {
// @phpstan-ignore-next-line
$typesMappings[] = ['dir' => $container->getParameter('kernel.root_dir').'/config/graphql', 'types' => null];
}
if ($mappingConfig['auto_discover']['bundles']) {
Expand Down Expand Up @@ -212,10 +213,12 @@ function (array $typeMapping) use ($container) {
private function mappingFromBundles(ContainerBuilder $container): array
{
$typesMappings = [];

/** @var array<string, class-string> $bundles */
$bundles = $container->getParameter('kernel.bundles');

// auto detect from bundle
foreach ($bundles as $name => $class) {
foreach ($bundles as $class) {
// skip this bundle
if (OverblogGraphQLBundle::class === $class) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ final class ResolverMapTaggedServiceMappingPass implements CompilerPassInterface
public function process(ContainerBuilder $container): void
{
$resolverMapsSortedBySchema = [];
$resolverMapsBySchemas = $container->getParameter('overblog_graphql.resolver_maps');
$typeDecoratorListenerDefinition = $container->getDefinition(TypeDecoratorListener::class);

/** @var array $resolverMapsBySchemas */
$resolverMapsBySchemas = $container->getParameter('overblog_graphql.resolver_maps');

foreach ($container->findTaggedServiceIds(self::SERVICE_TAG, true) as $serviceId => $tags) {
foreach ($tags as $tag) {
if (!isset($tag['schema'])) {
Expand Down
8 changes: 5 additions & 3 deletions src/DependencyInjection/OverblogGraphQLExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,17 @@ public function load(array $configs, ContainerBuilder $container): void
$container->setParameter($this->getAlias().'.resources_dir', realpath(__DIR__.'/../Resources'));
}

public function getAlias()
public function getAlias(): string
{
return Configuration::NAME;
}

public function getConfiguration(array $config, ContainerBuilder $container)
public function getConfiguration(array $config, ContainerBuilder $container): Configuration
{
return new Configuration(
// @phpstan-ignore-next-line
$container->getParameter('kernel.debug'),
// @phpstan-ignore-next-line
$container->hasParameter('kernel.cache_dir') ? $container->getParameter('kernel.cache_dir') : null
);
}
Expand Down Expand Up @@ -295,7 +297,7 @@ private function setServicesAliases(array $config, ContainerBuilder $container):
/**
* Returns a list of custom exceptions mapped to error/warning classes.
*
* @param array<string, string[]> $exceptionConfig
* @param array<string, array<string>> $exceptionConfig
*
* @return array<string, string> Custom exception map, [exception => UserError/UserWarning]
*/
Expand Down
1 change: 1 addition & 0 deletions tests/Functional/App/IsolatedResolver/EchoQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ final class EchoQuery implements QueryInterface, ContainerAwareInterface

public function display(string $message): string
{
// @phpstan-ignore-next-line
return $this->container->getParameter('echo.prefix').$message;
}
}

0 comments on commit 7bf5085

Please sign in to comment.