phpstan-wordpress icon indicating copy to clipboard operation
phpstan-wordpress copied to clipboard

Add WPINC constant

Open mikemanger opened this issue 1 year ago • 4 comments

WPINC is not overridable but often used to include core files for functions such as fetch_feed()

mikemanger avatar Aug 23 '24 11:08 mikemanger

Thank you for your PR.

How do you start WordPress without including wp-includes/feed.php? https://github.com/WordPress/WordPress/blob/83c20455880fae0f11ed823b8eb9d4a8640d0255/wp-settings.php#L231

szepeviktor avatar Aug 23 '24 11:08 szepeviktor

Oh you're right, the include isn't needed (thanks!). I think we just assumed it was because it is in the example in the dev documentation, I'll add a feedback note mentioning this.

There is a mention about adding WPINC in the WordPress performance lab plugin for their test suite but I'm not sure if it is needed as tests already get excluded from a lot of PHPStan things.

mikemanger avatar Aug 27 '24 09:08 mikemanger

I know there is no core function to get the value of WPINC but I do not want to encourage the users of this package to use WPINC.

szepeviktor avatar Aug 27 '24 09:08 szepeviktor

What about includes_url()?

EDIT: forget it. Retrieves the url as indicated by the "_url" :-D

IanDelMar avatar Aug 27 '24 21:08 IanDelMar

Lets close this as I was mistaken for our original needs. I agree it has limited use and encourages bad practices.

mikemanger avatar Sep 04 '24 08:09 mikemanger