phpspec / prophecy

Highly opinionated mocking framework for PHP 5.3+
MIT License
8.53k stars 241 forks source link

Support for readonly classes #559

Closed stof closed 1 year ago

stof commented 2 years ago

https://wiki.php.net/rfc/readonly_classes

kschatzle commented 2 years ago

@stof anyone working on the PHP8.2? Don't want to duplicate work, but I can pick these up.

kschatzle commented 2 years ago

Was playing around with this idea. Essentially make the underlying "testing" class be capable of being readonly. Can't be sure if this is a good idea, just playing with it.

https://gist.github.com/kschatzle/5394a3abc427659d21ef6f854e01c0f6

stof commented 2 years ago

@kschatzle not that I'm aware off.

stof commented 2 years ago

Note that the initial compat with PHP 8.2 might be to have a clear error message saying that doubling a readonly class is not supported yet, in case supporting this case require more time.

kschatzle commented 2 years ago

Ok, yeah, I saw some isFinal checks in various places. I could see a similar isReadOnly() working similar.

ciaranmcnulty commented 2 years ago

Yeah I've not seen any activity on it so go ahead if you have the time

kschatzle commented 1 year ago

Initial support as requested. https://github.com/phpspec/prophecy/pull/564