@@ -144,17 +144,17 @@ public function get_template_part_dir(): string {
144144 * Loads a template part into a template.
145145 *
146146 * @param string $slug The slug name for the generic template.
147- * @param string $name The name of the specialised template.
147+ * @param string|null $name The name of the specialised template.
148148 *
149149 * @return string
150150 */
151- public function get_template_part ( string $ slug , $ name = null ): string {
151+ public function get_template_part ( string $ slug , ? string $ name = null ): string {
152152 ob_start ();
153153 get_template_part ( $ slug , $ name , $ this ->args );
154154 $ output = ob_get_contents ();
155155 ob_end_clean ();
156156
157- return $ output ;
157+ return trim ( $ output ) ;
158158 }
159159
160160 /**
@@ -169,9 +169,9 @@ public function get_template_part( string $slug, $name = null ): string {
169169 *
170170 * @param array $attributes Block attributes.
171171 *
172- * @return false| string
172+ * @return string
173173 */
174- protected function get_content_from_template ( array $ attributes ) {
174+ protected function get_content_from_template ( array $ attributes ): string {
175175 $ class_name = join ( ' ' , $ this ->get_class_names ( $ attributes ) );
176176 $ this ->set_template_args ( 'class_name ' , $ class_name );
177177 $ path = array (
@@ -250,7 +250,7 @@ protected function get_content_from_default_template( string $name ) {
250250 * @param array $args URL query string or array of vars.
251251 * @param string $query_var query var.
252252 */
253- protected function setup_query ( array $ args , $ query_var = 'query ' ) {
253+ protected function setup_query ( array $ args , string $ query_var = 'query ' ) {
254254 $ args = apply_filters ( 'advanced_posts_blocks_posts_query ' , $ args , $ this ->name );
255255 $ this ->query = new WP_Query ( $ args );
256256 $ this ->set_template_args ( $ query_var , $ this ->query );
@@ -272,7 +272,7 @@ function ( $class ) {
272272 }
273273 );
274274
275- if ( ! empty ( $ styles ) && is_array ( $ styles ) ) {
275+ if ( ! empty ( $ styles ) ) {
276276 $ style = reset ( $ styles );
277277
278278 return str_replace ( 'is-style- ' , '' , $ style );
0 commit comments