mralaminahamed/storeengine-stubs

StoreEngine function and class declaration stubs for static analysis.

Maintainers

Package info

github.com/mralaminahamed/phpstan-storeengine-stubs

Language:Shell

pkg:composer/mralaminahamed/storeengine-stubs

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v2.2.0.1 2026-07-31 12:54 UTC

This package is auto-updated.

Last update: 2026-07-31 12:55:47 UTC


README

Latest Version Downloads License PHP Version

PHP stub declarations for the StoreEngine plugin, for IDE completion and static analysis. Generated with php-stubs/generator directly from the plugin source.

Generated from StoreEngine 2.2.0 — 708 classes · 9 interfaces · 27 traits · 173 functions · 1 constant.

🚀 Features

  • Complete class, interface, trait and function declarations
  • Constants in a separate file, so PHPStan can scan them rather than analyse them
  • IDE autocompletion for a plugin that is not a Composer dependency
  • Reproducible: the source is downloaded from WordPress.org, never vendored

📋 Requirements

  • PHP >= 7.4
  • Composer

📦 Installation

composer require --dev mralaminahamed/storeengine-stubs

Or download the stub files directly:

🔧 Configuration

Add both files to PHPStan. scanFiles rather than bootstrapFiles: the stubs declare symbols for analysis, they are not meant to be executed.

parameters:
    scanFiles:
        - vendor/mralaminahamed/storeengine-stubs/storeengine-stubs.stub
        - vendor/mralaminahamed/storeengine-stubs/storeengine-constants-stubs.stub

For IDE completion, point your IDE at the same files — in PhpStorm, mark them as an Include Path rather than a source root, so the empty method bodies never shadow the real plugin.

🔍 Quick usage example

<?php
$product = new \StoreEngine\Classes\Product();

// Note: most STOREENGINE_* constants are defined at runtime — see Limitations.

⚠️ Limitations

  • Stubs are a snapshot. They describe StoreEngine 2.2.0. Regenerate when the plugin changes a signature, or pin the stub version alongside the plugin version you support.
  • Method bodies are empty by design. PHPStan reads declarations and types; it never needs the implementation. Do not load these files at runtime.
  • Only top-level constants are captured. Only STOREENGINE_CHECKOUT is captured. StoreEngine defines the rest inside StoreEngine::define_constants(), and a stub generator reads top-level declarations only — see Limitations below. A constant defined inside a function or method is invisible to any stub generator; declare those in your own bootstrapFiles, or list them under PHPStan's dynamicConstantNames.

🔄 Regenerating

composer install
composer generate          # reads source/storeengine, writes both .stub files
composer release           # tag a new version for each untagged upstream release

bin/generate.sh expects the plugin unpacked at source/storeengine; bin/release-latest-versions.sh downloads each version from WordPress.org and tags it. Sources are gitignored — the repository carries stubs, not a copy of the plugin.

The finder reads includes/ and addons/. Assets, templates, language files and vendor/ are excluded: they declare nothing a consumer calls, and vendored packages ship their own stubs.

📁 Package structure

phpstan-storeengine-stubs/
├── bin/                              # generate.sh, release scripts
├── configs/                          # finder.php (what to read), bootstrap.php (WP constants)
├── source/                           # plugin source, gitignored
├── tests/                            # smoke tests over the generated stubs
├── storeengine-stubs.stub               # classes, interfaces, traits, functions
├── storeengine-constants-stubs.stub     # constants only
└── phpstan.neon                      # analyses the stubs themselves

📝 License

The tooling in this repository is MIT. The generated stubs are derived from StoreEngine, which is GPL-licensed; using them for static analysis is fair use of the declarations, but redistributing them as your own product is not. See LICENSE.