Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect return type for wpcf7_swv_create_rule() mentioned in PhpDoc #1404

Merged
merged 1 commit into from Mar 14, 2024

Conversation

koloml
Copy link
Contributor

@koloml koloml commented Mar 13, 2024

Function wpcf7_swv_create_rule mentions Rule class without a namespace. This is causing IDE to show type warnings when adding rules to the WPCF7_SWV_Schema object:

class Example
{
    public function add_rules( \WPCF7_SWV_Schema $schema ): void
    {
        $schema->add_rule(
            wpcf7_swv_create_rule( 'required', [
                'field' => 'example',
                'error' => wpcf7_get_message( 'invalid_required' )
            ] )
        );
    }
}

Here is a screenshot of this warning from PhpStorm:

Screenshot of the warning message in PhpStorm

After adding the namespace to the returned type, warning goes away.

@takayukister takayukister merged commit 4520c75 into rocklobster-in:master Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants