php-readability icon indicating copy to clipboard operation
php-readability copied to clipboard

Readability 3.0

Open jtojnar opened this issue 1 year ago • 2 comments

Some BC breaking suggestions:

  • [ ] Make all classes final.
  • [ ] Properties private.
  • [ ] Type hints everywhere.
  • [ ] Decouple Readability (stateless worker object) from result?
  • [ ] PHPStan level max.
  • [ ] Drop JSLikeHTMLElement in favour of static functions?

jtojnar avatar Mar 31 '23 01:03 jtojnar

@jtojnar could you elaborate on 4th and 6th items?

Kdecherf avatar Jul 23 '23 11:07 Kdecherf

Sure. I am not sure how feasible these are, though.

Decouple Readability (stateless worker object) from result

I was thinking something like making Readability a factory for an immutable ReadableArticle data object. That way it should be harder to have internally inconsistent state like in https://github.com/j0k3r/graby/pull/307

Drop JSLikeHTMLElement in favour of static functions

registerNodeClass is hard to make work with static analysis – we could just create getInnerHtml(DOMElement): string function and use that instead ->innerHTML magic property.

jtojnar avatar Jul 23 '23 11:07 jtojnar