On 21/05/2024 21:58, Claude Pache wrote:
> 
> 
>> Le 21 mai 2024 à 21:00, Matthew Weier O'Phinney <mweierophin...@gmail.com> a 
>> écrit :
>>
>>     (But again, I prefer that all those methods work on instances, as it was 
>> the case before PHP 8. They shouldn’t have been switched to 
>> static-but-broken-for-subclasses without discussion.)
>>
>>
>> Fixing the existing ones would be a potential BC break, depending on whether 
>> or not instance usage is completely eliminated.
> 
> Yes, of course. But there exist options that don’t make the API even more 
> inconsistent than it already is. I hereby propose:
> 
> * `XMLReader::fromUrl()` as replacement for `(new XMLReader)->open()`
> * `XMLReader::fromString()` as replacement for `(new XMLReader)->xml()`
> 
> … which would make me happy. (The old, inconsistently-named, 
> instance-and-semi-broken-static methods could be kept for BC and marked as 
> soft-deprecated in the manual.)
> 
> —Claude 

Okay, that seems reasonable to me and I can do that.
I'll make them return static and do "new static()" like I proposed with the new 
static method.

For XMLWriter, I suppose we also want the static counterparts:
* `XMLWriter::toMemory()` for `(new XMLWriter)->openMemory()`
* `XMLWriter::toUri()` for `(new XMLWriter)->openUri()`

If that sounds good I'll update the RFC.

Niels

Reply via email to