weirdan/codeception-psalm-module
Codeception module that integrates Psalm static analysis into your test workflow. Run Psalm checks as part of Codeception suites to catch type issues and improve PHP code quality during CI and local testing.
Full Changelog: https://github.com/psalm/codeception-psalm-module/compare/0.13.1...0.14.0
default_file config value was removed and is no longer honored (#30). To allow safe usage of Psalm cache the file name could no longer be kept fixed. Instead, the file for I have the following code step is now generated from the hash of the file content.Now you can use regular expressions to match the issue type (see #28)
This release extends the supported version range to PHP 8.
This release extends the supported version range to Psalm 4.x
I have .. package satisfying ..This realease adds a new step that allows you to conditionally run tests, depending on whether a package satisfies particular version constraints. Constraint syntax is the same as those used by Composer:
Scenario: Running when dependency is satisfied
Given I have the "codeception/module-cli" package satisfying the "*"
And I have the following code
"""
atan("zz");
"""
When I run Psalm
Then I see these errors
| Type | Message |
| InvalidScalarArgument | /./ |
And I see no other errors
You can also check for the version of the module itself:
Scenario: Running when dependency is satisfied
Given I have the "weirdan/codeception-psalm-module" package satisfying the "^0.5 || ^0.6"
And I have the following code
"""
atan("zz");
"""
When I run Psalm
Then I see these errors
| Type | Message |
| InvalidScalarArgument | /./ |
And I see no other errors
Given I have the :packageName package satisfying the :versionConstraints (thanks @adrienlucas)This release adds two new steps definitions, [@Given](https://github.com/Given) I have Psalm with taint analysis and [@When](https://github.com/When) I run Psalm with taint analysis, which allow you to use taint analysis:
Scenario: Running with taint analysis
Given I have Psalm with taint analysis
And I have the following code
"""
<?php echo $_GET['param'];
"""
When I run Psalm with taint analysis
Then I see these errors
| Type | Message |
| TaintedInput | /./ |
And I see no other errors
composer/semver:2+ and vimeo/psalm:dev-masterThis release allows composer/semver 2.0 and 3.0 (the latter is a requirement for composer/composer 2.0).
Now you can make assertions on Psalm's exit code (#10, #9, thanks to @mr-feek):
When I run Psalm
Then I see exit code 255
Now you can use regular expressions to match the issue message (see #8)
Previously, Psalm crashes were ignored and the run was considered successful even when Psalm crashed. This release changes it, so that if Psalm crashes you would see your test failing.
Now you can compose SUT projects of multiple files.
I have the following code in "filename.php" to create a fileI run Psalm on "filename.php" to run Psalm on a single fileI have the following classmap together with a table of class -> file mappingsIf you use custom psalm config (I have the following config) you would need to add %s placeholder for autoloader attribute:
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true" %s>
<projectFiles>
<directory name="."/>
</projectFiles>
<issueHandlers>
<InvalidScalarArgument errorLevel="suppress"/>
</issueHandlers>
</psalm>
"""
The module will use it to add autoloader="autoload.php" when necessary.
Minimum requirements were raised (#4, #5, thanks @Lctrs):
muglug/package-versions-56 when ocramius/package-version is availableHow can I help you explore Laravel packages today?