@@ -7,39 +7,41 @@ If you only use the `DiffHelper` and built-in `Renderer`s,
77there is no breaking change for you so you do not have to do anything.
88
99
10- ### External Breaking Changes
10+ ### Breaking Changes for Normal Users
1111
12- - The ` Diff ` class has been renamed to ` Differ ` .
13- It's easy to adapt to this by changing the class name.
12+ - The ` Diff ` class has been renamed as ` Differ ` .
13+ It should be relatively easy to adapt to this by changing the class name.
1414
15- - The term ` template ` has been renamed to ` renderer ` . Some examples are:
15+ - The term ` template ` has been renamed as ` renderer ` . Some examples are:
1616
1717 - Method ` DiffHelper::getRenderersInfo() `
1818 - Method ` DiffHelper::getAvailableRenderers() `
1919 - Constant ` RendererConstant::RENDERER_TYPES `
2020 - Constant ` AbstractRenderer::IS_TEXT_RENDERER `
2121
2222- Now a ` Renderer ` has a ` render() ` method, but a ` Differ ` does not.
23+ (because it makes more sense saying a renderer would render something)
2324 If you use those classes by yourself, it should be written like below.
2425
2526 ``` php
2627 use Jfcherng\Diff\Differ;
2728 use Jfcherng\Diff\Factory\RendererFactory;
2829
2930 $differ = new Differ(explode("\n", $old), explode("\n", $new), $diffOptions);
30- $renderer = RendererFactory::make($renderer , $rendererOptions);
31- $result = $renderer->render($differ); // <-- this has been changed
31+ $renderer = RendererFactory::make($rendererName , $rendererOptions);
32+ $result = $renderer->render($differ); // <-- this line has been changed
3233 ```
3334
34- - Add `RendererInterface::getResultForIdenticals()`.
35- `AbstractRenderer::getResultForIdenticals()` returns an empty string by default.
3635
37- - Remove the deprecated `AbstractRenderer::getIdenticalResult()`.
38- Use /implement the `AbstractRenderer::getResultForIdenticals()` instead.
36+ ### Breaking Changes for Customized Renderer Developers
3937
40-
41- ### Internal Breaking Changes
38+ - Remove the deprecated `AbstractRenderer::getIdenticalResult()` and
39+ add `RendererInterface::getResultForIdenticals()`. The returned value will be
40+ directly used before actually starting to calculate diff if we find that the
41+ two strings are the same. `AbstractRenderer::getResultForIdenticals()`
42+ returns an empty string by default.
4243
4344- Now a `Renderer` should implement `protected function renderWoker(Differ $differ): string`
44- rather than the previous `public function render(): string`. Note that `$this- >diff` no longer
45- works in `Renderer`s as it is now injected as the parameter to `Renderer::renderWoker()`.
45+ rather than the previous `public function render(): string`. Note that
46+ `$this- >diff` no longer works in `Renderer`s as it is now injected as a
47+ parameter to `Renderer::renderWoker()`.
0 commit comments