Hi all, Just like along with *get* *is* is also a *getter*, the same way *with* is also a *setter*. If you really want to distinguish it, it is a *fluent setter*.
Using *with* methods has nothing to do with the object being immutable and does not enforce that the method will return a new instance. It's a common practice to use them for builder pattern for example: $car = (new CarBuilder())->withNumberOfWeels(4)->withColor(CarColor::RED())->withFuelType(FuelType::DIESEL())->build(); Probably the CardBuilder *with** methods with not return a new instance. But if the implementer decides, it could also make the CarBuilder immutable and always return a fresh instance. Your keep linking the *with* methods (from the interface) with the immutability property (of the implementation) and I believe it will not bring any benefit on the long run; people might confuse them. Related to interface, I think it is ok-ish, although I don't really believe in interface that contains setters. It could be fine if we think it is also a creator/builder/factory inside that class that can create more objects and we want to standardize the way it works. If you decide to go with it, what I think it would be good is a set of interface tests so that an implementation could easily run them. We could test immutability there ;). We could use another interface for changing the object (just to separate the concerns) that will have methods like LinkChanger::changeHref(Link $link, $href) : Link. But that will not enforce immutability also; you can only write tests to check that the initial object didn't change. Regards, Alex On Mon, Aug 1, 2016 at 10:17 PM, Larry Garfield <la...@garfieldtech.com> wrote: > On 08/01/2016 09:31 AM, Matthew Weier O'Phinney wrote: > >> On Fri, Jul 29, 2016 at 3:02 PM, Théo FIDRY <theo.fi...@gmail.com> wrote: >> >>> Although it's not proper english, "Wither" has the advantage to be 1. >>> simple >>> (with -> wither) and in line with "getter" and "setter". There may be a >>> better word to describe those non-static factories, but "wither" is good >>> enough IMO. >>> >> As a native English speaker, "wither" has another meaning entirely: to >> shrivel and die. >> >> I'm personally +1 for Evolvable: >> >> - EvolvableLinkInterface >> - EvolvableLinkCollectionInterface >> > > Evolvable works for me. PR is here: > > https://github.com/php-fig/fig-standards/pull/788 > > Matthew, please merge in a day or three if no one else comments. After > that, I think we're ready for Review. > > --Larry Garfield > > -- > You received this message because you are subscribed to the Google Groups > "PHP Framework Interoperability Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to php-fig+unsubscr...@googlegroups.com. > To post to this group, send email to php-fig@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/php-fig/e14fb93c-ce1c-97ca-c158-8e231fd23678%40garfieldtech.com > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscr...@googlegroups.com. To post to this group, send email to php-fig@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAAwdEzBgyR-vr7ipve-e0TL62A3-yKxZ%3DgOet26JmeW%3Dk9yJVQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.