Skip to content

Commit

Permalink
Improve psalm testing up to level 1 and fix/suppress issues.
Browse files Browse the repository at this point in the history
Upload the psalm info when building and show it on the readme
  • Loading branch information
cooperaj committed Aug 14, 2020
1 parent 7f3dc08 commit 9bad75a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
42 changes: 1 addition & 41 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<psalm
totallyTyped="false"
errorLevel="1"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
Expand All @@ -12,44 +12,4 @@
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<issueHandlers>
<LessSpecificReturnType errorLevel="info" />

<!-- level 3 issues - slightly lazy code writing, but provably low false-negatives -->

<DeprecatedMethod errorLevel="info" />
<DeprecatedProperty errorLevel="info" />
<DeprecatedClass errorLevel="info" />
<DeprecatedConstant errorLevel="info" />
<DeprecatedFunction errorLevel="info" />
<DeprecatedInterface errorLevel="info" />
<DeprecatedTrait errorLevel="info" />

<InternalMethod errorLevel="info" />
<InternalProperty errorLevel="info" />
<InternalClass errorLevel="info" />

<MissingClosureReturnType errorLevel="info" />
<MissingReturnType errorLevel="info" />
<MissingPropertyType errorLevel="info" />
<InvalidDocblock errorLevel="info" />
<MisplacedRequiredParam errorLevel="info" />

<PropertyNotSetInConstructor errorLevel="info" />
<MissingConstructor errorLevel="info" />
<MissingClosureParamType errorLevel="info" />
<MissingParamType errorLevel="info" />

<RedundantCondition errorLevel="info" />

<DocblockTypeContradiction errorLevel="info" />
<RedundantConditionGivenDocblockType errorLevel="info" />

<UnresolvableInclude errorLevel="info" />

<RawObjectIteration errorLevel="info" />

<InvalidStringClass errorLevel="info" />
</issueHandlers>
</psalm>
1 change: 1 addition & 0 deletions src/ServiceContainer/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function configure(ArrayNodeDefinition $builder): void
/**
* @psalm-suppress PossiblyNullReference
* @psalm-suppress PossiblyUndefinedMethod
* @psalm-suppress MixedMethodCall
*/
$builder
->children()
Expand Down
10 changes: 8 additions & 2 deletions src/ServiceContainer/Factory/PsrFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 9bad75a

Please sign in to comment.