Pārlūkot izejas kodu

Tronar: Enforce strict typing in PHP files (#7472)

* Add declare( strict_types = 1 ) to functions.php

* Add declare( strict_types = 1 ) to all pattern files
Sarah Norris 1 gadu atpakaļ
vecāks
revīzija
d0db47d2b6

+ 1 - 0
tronar/functions.php

@@ -8,6 +8,7 @@
  * @since Tronar 1.0
  */
 
+declare( strict_types = 1 );
 
 if ( ! function_exists( 'tronar_support' ) ) :
 

+ 2 - 0
tronar/patterns/404.php

@@ -4,6 +4,8 @@
  * Slug: tronar/404
  * Inserter: no
  */
+
+declare( strict_types = 1 );
 ?>
 
 <!-- wp:heading {"level":1,"fontSize":"xx-large"} -->

+ 3 - 1
tronar/patterns/footer.php

@@ -5,6 +5,8 @@
  * Categories: footer
  * Block Types: core/template-part/footer
  */
+
+declare( strict_types = 1 );
 ?>
 
 <!-- wp:group {"align":"full","style":{"spacing":{"padding":{"top":"var:preset|spacing|50","right":"var:preset|spacing|50","bottom":"var:preset|spacing|50","left":"var:preset|spacing|50"}}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"space-between"}} -->
@@ -20,7 +22,7 @@
 				esc_html__( 'Designed with %1$s', 'tronar' ),
 				$wordpress_link
 			);
-		?>
+			?>
 	</p>
 	<!-- /wp:paragraph -->
 </div>

+ 2 - 0
tronar/patterns/header-with-cover.php

@@ -5,6 +5,8 @@
  * Categories: header
  * Block Types: core/template-part/header
  */
+
+declare( strict_types = 1 );
 ?>
 
 <!-- wp:group {"layout":{"type":"default"}} -->

+ 2 - 0
tronar/patterns/header-with-sticky-post.php

@@ -5,6 +5,8 @@
  * Categories: header
  * Block Types: core/template-part/header
  */
+
+declare( strict_types = 1 );
 ?>
 
 <!-- wp:query {"query":{"perPage":"1","pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"only","inherit":false}} -->

+ 2 - 0
tronar/patterns/header.php

@@ -5,6 +5,8 @@
  * Categories: header
  * Block Types: core/template-part/header
  */
+
+declare( strict_types = 1 );
 ?>
 
 <!-- wp:group {"style":{"spacing":{"padding":{"right":"var:preset|spacing|50","left":"var:preset|spacing|50","top":"var:preset|spacing|50","bottom":"var:preset|spacing|50"}},"border":{"bottom":{"color":"var:preset|color|secondary","width":"1px"}}},"layout":{"type":"default"}} -->

+ 2 - 0
tronar/patterns/latest-post-heading.php

@@ -4,6 +4,8 @@
  * Slug: tronar/latest-post-heading
  * Inserter: no
  */
+
+declare( strict_types = 1 );
 ?>
 
 <!-- wp:group {"align":"wide","style":{"spacing":{"blockGap":"0.5rem","margin":{"bottom":"var:preset|spacing|60"}}},"layout":{"type":"default"}} -->

+ 2 - 0
tronar/patterns/no-results-content.php

@@ -4,6 +4,8 @@
  * Slug: tronar/no-results-content
  * Inserter: no
  */
+
+declare( strict_types = 1 );
 ?>
 
 <!-- wp:paragraph -->

+ 2 - 0
tronar/patterns/post-author.php

@@ -4,6 +4,8 @@
  * Slug: tronar/post-author
  * Categories: featured, text
  */
+
+declare( strict_types = 1 );
 ?>
 
 <!-- wp:group {"style":{"spacing":{"blockGap":"1rem","padding":{"top":"var:preset|spacing|50","bottom":"var:preset|spacing|50"}},"border":{"top":{"color":"var:preset|color|secondary","width":"1px"},"right":{},"bottom":{},"left":{}}},"layout":{"type":"flex","flexWrap":"nowrap","verticalAlignment":"top"}} -->

+ 2 - 0
tronar/patterns/post-list.php

@@ -4,6 +4,8 @@
  * Slug: tronar/post-list
  * Categories: featured, posts
  */
+
+declare( strict_types = 1 );
 ?>
 
 <!-- wp:group {"align":"wide","style":{"spacing":{"margin":{"top":"var:preset|spacing|60","bottom":"var:preset|spacing|60"}}},"layout":{"type":"constrained"}} -->

+ 2 - 0
tronar/patterns/search.php

@@ -4,6 +4,8 @@
  * Slug: tronar/search
  * Inserter: no
  */
+
+declare( strict_types = 1 );
 ?>
 
 <!-- wp:search {"label":"Search","showLabel":false,"placeholder":"<?php echo esc_html_x( 'Search...', 'This is a placeholder text in a search field', 'tronar' ); ?>","buttonText":"Search","buttonPosition":"button-inside","buttonUseIcon":true} /-->