Ensure phpstan exit code is passed along to the shell window and address some pr comments

MAILPOET-6318
This commit is contained in:
Oluwaseun Olorunsola
2024-11-28 18:34:51 +01:00
committed by Jan Lysý
parent b1cc53ec5b
commit ccc3f9ab28
4 changed files with 12 additions and 10 deletions

View File

@@ -4,9 +4,9 @@ $config = [];
$phpVersion = (int)getenv('ANALYSIS_PHP_VERSION') ?: PHP_VERSION_ID; $phpVersion = (int)getenv('ANALYSIS_PHP_VERSION') ?: PHP_VERSION_ID;
$config['parameters']['phpVersion'] = $phpVersion; $config['parameters']['phpVersion'] = $phpVersion;
// Load PHP 8 specific config // Load PHP 8.2 specific config
if ($phpVersion >= 80000) { if ($phpVersion >= 80200) {
$config['includes'][] = 'email-editor-php-8-config.neon'; $config['includes'][] = 'email-editor-php-8-config.neon';
} }
return $config; return $config;

View File

@@ -4,8 +4,8 @@ parameters:
bootstrapFiles: bootstrapFiles:
- ../../vendor/autoload.php - ../../vendor/autoload.php
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php - vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
- ../../vendor/codeception/codeception/autoload.php - ../../../tests_env/vendor/codeception/codeception/autoload.php
- ../../vendor/codeception/verify/src/Codeception/Verify/Verify.php - ../../../tests_env/vendor/codeception/verify/src/Codeception/Verify/Verify.php
scanDirectories: scanDirectories:
- ../../../packages/php/email-editor/tests/_support - ../../../packages/php/email-editor/tests/_support
- ../../../packages/php/email-editor/tests/integration - ../../../packages/php/email-editor/tests/integration

View File

@@ -47,4 +47,6 @@ $all_commands = implode( ' ', $commands );
echo "[run-phpstan] Running command: $all_commands \n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- This file is not used within WordPress environment. echo "[run-phpstan] Running command: $all_commands \n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- This file is not used within WordPress environment.
passthru( $all_commands ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_passthru -- This file is not used within WordPress environment. $result_code = 0;
passthru( $all_commands, $result_code ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_passthru -- This file is not used within WordPress environment.
exit( (int) $result_code );

View File

@@ -11,9 +11,9 @@ namespace MailPoet\EmailEditor;
use Exception; use Exception;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
class Simple_Service {} // phpcs:ignore class Simple_Service {} // phpcs:ignore -- Ignore Only one object structure is allowed in a file.
class Singleton_Service {} // phpcs:ignore class Singleton_Service {} // phpcs:ignore -- Ignore Only one object structure is allowed in a file.
/** /**
* Unit test for Container class. * Unit test for Container class.
@@ -68,8 +68,8 @@ class Container_Test extends TestCase { // phpcs:ignore
// Attempt to get a non-existing service should throw an exception. // Attempt to get a non-existing service should throw an exception.
$this->expectException( Exception::class ); $this->expectException( Exception::class );
$this->expectExceptionMessage( 'Service not found: non_existing_service' ); $this->expectExceptionMessage( 'Service not found: MailPoet\EmailEditor\Simple_Service' );
$container->get( 'non_existing_service' ); // @phpstan-ignore-line $container->get( Simple_Service::class );
} }
} }