xf-typegen

xf-typegen 1.0.1

No permission to download
XF Compatibility
  1. 2.3.x
Short Description
XenForo already types most of its own runtime magic

What it does​

XenForo already types most of its own runtime magic — xf-dev:generate-phpstorm-meta (shipped in 2.2 and 2.3) resolves the string-style call sites, entities ship full @property, and on 2.3 generics handle the ::class style and the finder chain. This tool is narrow on purpose: it fills the few gaps core leaves.

What core doesn't type, either version:
  • Board options — \XF:😱ptions()->boardTitle is mixed; this gives it a real type.
  • XFCP proxies — class Foo extends XFCP_Foo points at a runtime-built class with no file, flagged undefined; this declares them.
  • Cross-add-on columns — a column another add-on adds to an entity via XFCP isn't in that entity's shipped @property; this reads the composed structure, so they're included.
On 2.2 only, it also types the finder chain (finder('XF:User')->fetchOne() to the concrete entity), which 2.2 can't do without generics.

If you're on 2.3 and none of those bite you, the stock dev tools already cover you.

  • _ide_helper_options.php — one typed property per board option.
  • _ide_helper_xfcp.php — declarations for the runtime XFCP_* proxies.
  • _ide_helper.php — typed Finder/Collection stubs (mainly for 2.2) + entity @property from the composed structure.
  • .phpstorm.meta.php — string-style call-site resolution (duplicates xf-dev:generate-phpstorm-meta; skip with --targets options,xfcp,ide-helper).


Code:
xf-typegen extract /path/to/xenforo --out /path/to/xenforo/xf-typegen.json
xf-typegen generate -i /path/to/xenforo/xf-typegen.json
Keep the _ide_helper*.php files out of your PHP autoload — static analysis only.


Open source (MIT), prebuilt for Linux / macOS / Windows:
https://github.com/wh1teend/xf-typegen
Author
axtona
Views
1
First release
Last update
Ratings 0.00 star(s) 0 ratings
Link was Broken? Send message to the Website Team and we will assist you quickly!
Support Developer If you are satisfied with the test or your project has earned you money, Click the More Information button to support the developer by purchasing.

More resources from axtona

Persona - Personalise Your Forum Identity A
Persona gives every member on your forum the tools to make their presence their own.
Attachment Integrity A
Attachment Integrity is a powerful attachment auditing, repair and storage analysis addon
Back
Top