File tree Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -31,9 +31,6 @@ there is no breaking change for you so you do not have to do anything.
3131 $result = $renderer->render($differ); // <-- this has been changed
3232 ```
3333
34- - If you call `Differ::getGroupedOpcodes()` by yourself,
35- you must call `Differ::finalize()` before it.
36-
3734- Add `RendererInterface::getResultForIdenticals()`.
3835 `AbstractRenderer::getResultForIdenticals()` returns an empty string by default.
3936
Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ public function getOptions(): array
198198 */
199199 public function getOldNewComparison (): int
200200 {
201- return $ this ->oldNewComparison ;
201+ return $ this ->finalize ()-> oldNewComparison ;
202202 }
203203
204204 /**
@@ -223,6 +223,8 @@ public static function getInstance(): self
223223 */
224224 public function getGroupedOpcodes (): array
225225 {
226+ $ this ->finalize ();
227+
226228 if (!empty ($ this ->groupedOpcodes )) {
227229 return $ this ->groupedOpcodes ;
228230 }
@@ -232,17 +234,17 @@ public function getGroupedOpcodes(): array
232234 }
233235
234236 /**
235- * Claim this class has settled down which means properties will not
236- * be changed before doing diff calculations .
237+ * Claim this class has settled down and we could calculate cached
238+ * properties by current properties .
237239 *
238- * Properties will be re-propagated to other classes. This method must be
239- * re-called after any property changed before doing calculations .
240+ * This method must be called before accessing cached properties to
241+ * make suer that you will not get a outdated cached value .
240242 *
241- * This method is called in AbstractRenderer::render() automatically.
243+ * @internal
242244 *
243245 * @return self
244246 */
245- public function finalize (): self
247+ private function finalize (): self
246248 {
247249 if ($ this ->isCacheDirty ) {
248250 $ this ->resetCachedResults ();
Original file line number Diff line number Diff line change @@ -111,10 +111,8 @@ public function getResultForIdenticals(): string
111111 /**
112112 * {@inheritdoc}
113113 */
114- public function render (Differ $ differ ): string
114+ final public function render (Differ $ differ ): string
115115 {
116- $ differ ->finalize ();
117-
118116 // the "no difference" situation may happen frequently
119117 return $ differ ->getOldNewComparison () === 0
120118 ? $ this ->getResultForIdenticals ()
You can’t perform that action at this time.
0 commit comments