@@ -68,11 +68,6 @@ protected function render(RenderingContext $context, \Closure $templateResolver)
6868 $ template = $ templateResolver ($ this ->templateResolver );
6969 $ compileResult = $ this ->compile ($ template );
7070
71- // Early return if template is empty
72- if ($ compileResult === null ) {
73- return '' ;
74- }
75-
7671 // Merge variables with default variables
7772 $ mergedVariables = array_merge ($ this ->variableBag ->get (), $ context ->getVariables ());
7873
@@ -100,13 +95,8 @@ protected function render(RenderingContext $context, \Closure $templateResolver)
10095 /**
10196 * Compile given template by Handlebars compiler.
10297 */
103- protected function compile (string $ template ): ? string
98+ protected function compile (string $ template ): string
10499 {
105- // Early return if template is empty
106- if (trim ($ template ) === '' ) {
107- return null ;
108- }
109-
110100 // Disable cache if debugging is enabled or caching is disabled
111101 if ($ this ->isDebugModeEnabled () || $ this ->isCachingDisabled ()) {
112102 $ cache = new Cache \NullCache ();
@@ -154,28 +144,22 @@ protected function getKnownHelpers(): array
154144 /**
155145 * Resolve given partial using partial resolver.
156146 *
157- * Tries to resolve the given partial using the {@see $templateResolver}. If
158- * no partial resolver is registered, `null` is returned. Otherwise, the
159- * compiled partial is returned. Returning `null` will be handled as "partial
160- * not found" by the renderer.
147+ * Tries to resolve the given partial using the {@see $templateResolver}
148+ * and returns the compiled partial.
161149 *
162150 * @param string $name Name of the partial to be resolved
163- * @return \Closure|null Compiled partial if partial could be resolved, `null` otherwise
151+ * @return \Closure Compiled partial if partial could be resolved
164152 * @throws Exception\PartialPathIsNotResolvable
165153 * @throws Exception\TemplateFileIsInvalid
166154 * @throws Exception\TemplateFormatIsNotSupported
167155 * @throws Exception\ViewIsNotProperlyInitialized
168156 */
169- protected function resolvePartial (string $ name ): ? \Closure
157+ protected function resolvePartial (string $ name ): \Closure
170158 {
171159 $ context = new RenderingContext ($ name );
172160 $ template = $ context ->getPartial ($ this ->templateResolver );
173161 $ compileResult = $ this ->compile ($ template );
174162
175- if ($ compileResult === null ) {
176- return null ;
177- }
178-
179163 return Handlebars \Handlebars::template ($ compileResult );
180164 }
181165
0 commit comments