From 9bad75a53eeea815cce2a38cb3746d11c546808d Mon Sep 17 00:00:00 2001 From: Adam Cooper Date: Fri, 14 Aug 2020 11:25:56 +0100 Subject: [PATCH] Improve psalm testing up to level 1 and fix/suppress issues. Upload the psalm info when building and show it on the readme --- .circleci/config.yml | 2 +- README.md | 3 +- psalm.xml | 42 +-------------------- src/ServiceContainer/Extension.php | 1 + src/ServiceContainer/Factory/PsrFactory.php | 10 ++++- 5 files changed, 13 insertions(+), 45 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d555e46..88d581d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,7 +24,7 @@ commands: - run: ./vendor/bin/phpunit - run: ./vendor/bin/behat -f progress -o std -f junit -o tests/output/behat - - run: ./vendor/bin/psalm --show-info=false + - run: ./vendor/bin/psalm --show-info=false --shepherd - store_test_results: path: tests/output diff --git a/README.md b/README.md index a0ba174..1e4837f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ Behat PSR Extension ========== -[![CircleCI](https://circleci.com/gh/cooperaj/behat-psr-extension.svg?style=svg)](https://circleci.com/gh/cooperaj/behat-psr-extension) +[![CircleCI](https://circleci.com/gh/cooperaj/behat-psr-extension.svg?style=shield)](https://app.circleci.com/pipelines/github/cooperaj/behat-psr-extension) [![codecov](https://codecov.io/gh/cooperaj/behat-psr-extension/branch/master/graph/badge.svg)](https://codecov.io/gh/cooperaj/behat-psr-extension) +[![psalm](https://shepherd.dev/github/cooperaj/behat-psr-extension/coverage.svg)](https://shepherd.dev/github/cooperaj/behat-psr-extension) This [Behat](http://behat.org) extension allows you to more easily test your [PSR7](https://www.php-fig.org/psr/psr-7/) / [11](https://www.php-fig.org/psr/psr-11/) / [15](https://www.php-fig.org/psr/psr-15/) applications and gives you the diff --git a/psalm.xml b/psalm.xml index 42f355b..3240886 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,6 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ServiceContainer/Extension.php b/src/ServiceContainer/Extension.php index 600a7bc..436f5c9 100644 --- a/src/ServiceContainer/Extension.php +++ b/src/ServiceContainer/Extension.php @@ -49,6 +49,7 @@ public function configure(ArrayNodeDefinition $builder): void /** * @psalm-suppress PossiblyNullReference * @psalm-suppress PossiblyUndefinedMethod + * @psalm-suppress MixedMethodCall */ $builder ->children() diff --git a/src/ServiceContainer/Factory/PsrFactory.php b/src/ServiceContainer/Factory/PsrFactory.php index 7913d95..2c64458 100644 --- a/src/ServiceContainer/Factory/PsrFactory.php +++ b/src/ServiceContainer/Factory/PsrFactory.php @@ -29,7 +29,10 @@ public function __construct(string $containerFilePath, string $applicationFilePa */ public function createApplication(?ContainerInterface &$container = null): RequestHandlerInterface { - /** @psalm-suppress UnresolvableInclude */ + /** + * @psalm-suppress UnresolvableInclude + * @var RequestHandlerInterface $application + */ $application = require $this->applicationFilePath; if (!$application instanceof RequestHandlerInterface) { @@ -48,7 +51,10 @@ public function createApplication(?ContainerInterface &$container = null): Reque */ public function createContainer(): ContainerInterface { - /** @psalm-suppress UnresolvableInclude */ + /** + * @psalm-suppress UnresolvableInclude + * @var ContainerInterface $container + */ $container = require $this->containerFilePath; if (!$container instanceof ContainerInterface) {