php-readability
php-readability copied to clipboard
Readability 3.0
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 could you elaborate on 4th and 6th items?
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.