glomberg/wpdb-unsafe-methods

Psalm plugin to forbid calling provided `$wpdb` methods

1.0.0 2024-08-27 15:39 UTC

This package is auto-updated.

Last update: 2024-09-27 15:50:33 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>