psalm / psalm-plugin-wordpress

WordPress stubs and plugin for Psalm
MIT License
68 stars 17 forks source link

i cant ignore custome hook #56

Open Mohammad-Ravand opened 5 days ago

Mohammad-Ravand commented 5 days ago

this is my code:

<plugins>
    <pluginClass class="PsalmWordPress\Plugin">
        <useDefaultHooks value="true" />
        <requireAllParams value="false" />
        <hooks>
            <HookNotFound errorLevel="suppress" />
        </hooks>
    </pluginClass>
    <pluginClass class="Psl\Psalm\Plugin"/>
</plugins>

i get this error:

ERROR: HookNotFound - inc/normalize.php:106:5 - Hook "wpcf7_autop_or_not" not found
add_filter('wpcf7_autop_or_not', '__return_false');
mcaskill commented 5 days ago

For context: I haven't worked on this plugin in a while, so my memory is hazy.

I think you might need to generate the stubs for CF7's hooks following this schema. Maybe providing the path to plugin might help.

For this filter, it would look like this (untested):

{
    "$schema": "https://raw.githubusercontent.com/wp-hooks/generator/0.9.0/schema.json",
    "hooks": [
        {
            "name": "wpcf7_autop_or_not",
            "file": "includes/functions.php",
            "type": "filter",
            "doc": {
                "description": "Returns true if wpcf7_autop() is applied.",
                "long_description": "",
                "long_description_html": "",
                "tags": [
                    {
                        "name": "param",
                        "content": "",
                        "types": [
                            "bool"
                        ],
                        "variable": "$autop"
                    },
                    {
                        "name": "param",
                        "content": "",
                        "types": [
                            "array",
                            "string"
                        ],
                        "variable": "$options"
                    }
                ]
            },
            "args": 2
        }
    ]
}