Skip to content

Commit

Permalink
Merge b81d6b8 into 82ead38
Browse files Browse the repository at this point in the history
  • Loading branch information
moufmouf committed Dec 2, 2019
2 parents 82ead38 + b81d6b8 commit a93f665
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ matrix:
include:
# Test the latest stable release
- php: 7.2
env: PHPSTAN=true
- php: 7.3
env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"

Expand Down Expand Up @@ -51,7 +52,7 @@ script:
# simple-phpunit is the PHPUnit wrapper provided by the PHPUnit Bridge component and
# it helps with testing legacy code and deprecations (composer require symfony/phpunit-bridge)
#- ./vendor/bin/simple-phpunit $PHPUNIT_FLAGS
- composer phpstan
- if [[ $PHPSTAN == true ]]; then composer phpstan; fi
- ./vendor/bin/phpunit

after_script:
Expand Down
7 changes: 7 additions & 0 deletions DependencyInjection/GraphqliteCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,13 @@ public function process(ContainerBuilder $container)
$this->mapAdderToTag('graphql.field_middleware', 'addFieldMiddleware', $container, $schemaFactory);
$this->mapAdderToTag('graphql.type_mapper', 'addTypeMapper', $container, $schemaFactory);
$this->mapAdderToTag('graphql.type_mapper_factory', 'addTypeMapperFactory', $container, $schemaFactory);

// Configure cache
if (ApcuAdapter::isSupported()) {
$container->setAlias('graphqlite.cache', 'graphqlite.apcucache');
} else {
$container->setAlias('graphqlite.cache', 'graphqlite.phpfilescache');
}
}

private function registerController(string $controllerClassName, ContainerBuilder $container): void
Expand Down
22 changes: 21 additions & 1 deletion Resources/config/container/graphqlite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<defaults autowire="true" autoconfigure="true" public="false" />

<service id="TheCodingMachine\GraphQLite\SchemaFactory">
<argument index="1" type="service" id="service_container" />
<argument type="service" id="graphqlite.psr16cache" />
<argument type="service" id="service_container" />
<call method="setAuthenticationService">
<argument type="service" id="TheCodingMachine\GraphQLite\Security\AuthenticationServiceInterface" />
</call>
Expand Down Expand Up @@ -102,5 +103,24 @@
</argument>
<tag name="graphql.type_mapper_factory"/>
</service>

<service id="graphqlite.phpfilescache" class="Symfony\Component\Cache\Adapter\PhpFilesAdapter">
<argument>graphqlite</argument>
</service>

<service id="graphqlite.apcucache" class="Symfony\Component\Cache\Adapter\ApcuAdapter">
<argument>graphqlite</argument>
</service>

<service id="graphqlite.psr16cache" class="Symfony\Component\Cache\Psr16Cache">
<argument type="service" id="graphqlite.cache" />
</service>

<service id="graphqlite.cacheclearer" class="Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer">
<argument type="collection">
<argument/>
</argument>
<tag name="kernel.cache_clearer"/>
</service>
</services>
</container>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"symfony/security-bundle": "^4.1.9 | ^5",
"symfony/yaml": "^4.1.9 | ^5",
"phpunit/phpunit": "^7.5.1",
"phpstan/phpstan": "^0.10.6",
"phpstan/phpstan-shim": "^0.11.19",
"beberlei/porpaginas": "^1.2",
"php-coveralls/php-coveralls": "^2.1.0"
},
Expand Down
4 changes: 0 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
parameters:
ignoreErrors:
- "#Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition::children\\(\\)#"
# Error triggered by a bad PHPDoc in Symfony
- '#Parameter \#4 $roles of class Symfony\\Component\\Security\\Core\\Authentication\\Token\\UsernamePasswordToken constructor expects array<string>, array<string|Symfony\\Component\\Security\\Core\\Role\\Role> given.#'
- '#Method Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface::dispatch\(\) invoked with 2 parameters, 1 required.#'
- '#Cannot cast object|string to string.#'
#includes:
# - vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon

0 comments on commit a93f665

Please sign in to comment.