renttek/magento2-psalm

Magenot 2 psalm plugin

1.1.2 2023-06-12 13:24 UTC

This package is auto-updated.

Last update: 2024-04-12 15:50:35 UTC


README

This module is based on vismadc/magento2-psalm and tdgroot/magento2-psalm but rewritten from scratch.

Installation

composer require --dev renttek/magento2-psalm
vendor/bin/psalm-plugin enable renttek/magento2-psalm

Features

  • Mocking of Extension Attribute classes
  • Mocking of Factory classes
  • Mocking of Proxy classes
  • Stubs for badly annotated classes

Configuration

If you don't want to enable one of the mock categories or the loading of the stubs, you can disable them in your psalm.xml by setting these flags:

<?xml version="1.0"?>
<psalm>
    <!-- ... -->
    <plugins>
        <pluginClass class="Renttek\Magento2Psalm\Plugin">
            <enableExtensionAttributeMocker>false</enableExtensionAttributeMocker> <!-- disables mocking of extension attribute classes -->
            <enableFactoryMocker>false</enableFactoryMocker> <!-- disables mocking of factory classes -->
            <enableProxyMocker>false</enableProxyMocker> <!-- disables mocking of proxy classes -->
            <loadStubs>false</loadStubs> <!-- disables loading of static stub files -->
        </pluginClass>
    </plugins>
    <!-- ... -->
</psalm>