Skip to content

Commit

Permalink
Update PHPStan level to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
TorbenLundsgaard committed May 13, 2024
1 parent 23b6223 commit 72a801f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions bin/phpstan/constants.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
/**
* Constants for PHPStan static analysis.
*
* @package GTM Kit
*/

$gtmkit_file = dirname( __DIR__ ) . '/gtm-kit.php';
define( 'GTMKIT_FILE', $gtmkit_file );
define( 'GTMKIT_PATH', plugin_dir_path( GTMKIT_FILE ) );
define( 'GTMKIT_BASENAME', plugin_basename( GTMKIT_FILE ) );
define( 'GTMKIT_URL', plugin_dir_url( $gtmkit_file ) );
define( 'GTMKIT_ADMIN_SLUG', 'gtmkit_' );
3 changes: 2 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
includes:
- phar://phpstan.phar/conf/bleedingEdge.neon
parameters:
level: 0
level: 1
bootstrapFiles:
- bin/phpstan/constants.php
- vendor/php-stubs/woocommerce-stubs/woocommerce-stubs.php
- vendor/php-stubs/woocommerce-stubs/woocommerce-packages-stubs.php
paths:
Expand Down
2 changes: 2 additions & 0 deletions src/Admin/SetupWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ public function enqueue_assets( string $hook ) {

$deps_file = GTMKIT_PATH . 'assets/admin/wizard.asset.php';
$dependency = [];
$version = false;

if ( file_exists( $deps_file ) ) {
$deps_file = require $deps_file;
$dependency = $deps_file['dependencies'];
Expand Down
1 change: 1 addition & 0 deletions src/Frontend/UserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function get_datalayer_content( array $datalayer ): array {
$include_user_id = $this->options->get( 'general', 'datalayer_user_id' );
$include_user_role = $this->options->get( 'general', 'datalayer_user_role' );

$current_user_id = 0;
if ( $include_logged_in || $include_user_id || $include_user_role ) {
$current_user_id = get_current_user_id();
}
Expand Down

0 comments on commit 72a801f

Please sign in to comment.