glomberg/wpdb-unsafe-methods

Psalm plugin to forbid calling provided `$wpdb` methods

1.0.1 2024-11-18 06:45 UTC

This package is auto-updated.

Last update: 2024-12-18 06:57:31 UTC


README

Installation

composer require --dev glomberg/wpdb-unsafe-methods
vendor/bin/psalm --init
vendor/bin/psalm-plugin enable glomberg/wpdb-unsafe-methods

Features

Configuration

If you follow the installation instructions, the psalm-plugin command will add this plugin configuration to the psalm.xml configuration file.

<?xml version="1.0"?>
<psalm errorLevel="1">
    <!--  project configuration -->

    <plugins>
        <pluginClass class="Glomberg\WpdbUnsafeMethods\Plugin" />
    </plugins>
</psalm>

Do not forget to add method tags with the names of the methods you want to forbid.

<pluginClass class="Glomberg\WpdbUnsafeMethods\Plugin">
    <method>query</method>
    <method>get_results</method>
</pluginClass>