Skip to content

RFC: Standardise Psalm Configuration #127

Description

@gsteel

Thanks to @boesing, I recently discovered some psalm configuration options that'll be potentially helpful to improving code quality.

I'd like to start discussion about which of those options we should switch on or off by default for Laminas and Mezzio projects so that we can define a standard configuration.

Once a standard has been decided, it should be applied everywhere with an expanded baseline so that new code will need to pass a stricter set of requirements as enforced by CI.

To start discussion off, I'm thinking something like this:

<?xml version="1.0"?>
<psalm
    errorLevel="1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="https://getpsalm.org/schema/config"
    xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
    errorBaseline="psalm-baseline.xml"
    ignoreInternalFunctionFalseReturn="false"
    ignoreInternalFunctionNullReturn="false"
    allowInternalNamedArgumentCalls="false"
    allowNamedArgumentCalls="false"
    strictBinaryOperands="true"
    disableSuppressAll="true"
    memoizeMethodCallResults="true"
    checkForThrowsDocblock="false"
    findUnusedVariablesAndParams="true"
    findUnusedCode="false"
    findUnusedPsalmSuppress="true"
>
    <projectFiles>
        <directory name="src"/>
        <directory name="test"/>
        <ignoreFiles>
            <directory name="vendor"/>
        </ignoreFiles>
    </projectFiles>

    <plugins>
        <pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
    </plugins>
</psalm>

Reference: https://psalm.dev/docs/running_psalm/configuration/

Perhaps, once decided, a template can be stored in the Laminas .github organisation repo?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions