BetterReflection: Last call for `5.0.0` BC breaks

This is just a placeholder to make sure everyone is aware that 5.0.0 is around the corner: if nobody replies to this issue within a couple days, I will release 5.0.0 from 5.0.x (after attempting to put together some release notes @_@ )

If you need to break BC further, now is the time.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 23 (19 by maintainers)

Most upvoted comments

@ondrejmirtes I’d have some free time on Friday (I know, it’s the 24th), but IMO we should at this point:

  1. release
  2. eventually release 6.0.0 if BC breaks are necessary afterwards

Would be a good xmas present 😄

@asgrim the mutator API is your project: wdyt?

@kukulich I’m fine with removing the monkey patching feature if it isn’t useful. It isn’t the main point of the library indeed, but more of a “look what you can do with this”. 👍

At some point in the future I might make a new library that uses BR to do the monkey patching, just for fun 😁

I agree, release the kraken! 😊

I have 5.0.x integrated in PHPStan and it’s super solid. I’ll be able to release PHPStan with Enums support shortly after thanks to BR, I just need a few finishing touches that I hopefully find the time for during the holidays 😊

Closing here: will focus on writing release notes and finishing up all pending details, but no more BEE SEE BREKS!

Perhaps I’m not fully understanding the problem: can we perhaps talk about it in a call, next week?

Yeah, sure 😃 To rephrase the problem one more time, I need to wrap PhpInternalSourceLocator (with ReflectionSourceStubber) in my own PhpVersionBlacklistSourceLocator (https://github.com/phpstan/phpstan-src/blob/master/src/Reflection/BetterReflection/SourceLocator/PhpVersionBlacklistSourceLocator.php) that calls these extra PhpStormStubsSourceStubber methods so that internal PHP functions from runtime version are not considered defined if they don’t exist in the older PHP version set by the user.

The usefulness is demonstrated in the PHPStan playground: https://phpstan.org/r/656bc0ac-949b-45ef-919c-9365d4ebffac - it always runs on PHP 8.0 but sets different phpVersion for its PHPStan config when running analysis. If I didn’t use PhpVersionBlacklistSourceLocator, the linked code snippet wouldn’t report an error on PHP 7.x.

because the structure of those autoloader files is potentially subject to changes

It’s not parsing Composer autoloader files, it’s parsing the PHP files in the analysed codebase to look for defined classes, interfaces, traits, enums, functions…

Hi, I’m really enjoying. the 5.0.x. branch. Previously my fork has been based off BR 4.3. Now I successfully based my new fork on top of 5.0.x and established a downgrading process so that it works on PHP 7.1+. PHPStan’s tests and PHPStan-on-PHPStan are now green with the new fork. But there’s a bit more work to be done so a few more bugfixes might be submitted.

This is a list of what it does additionally/differently that might be interesting to the original version:

Additional things are not part of my fork, but are commited directly to phpstan-src:

Let me know if anything from this list is interesting to land in BetterReflection. Thanks.

Ok, I suggest to remove the monkey patching feature 😃