Skip to content

Commit

Permalink
PHPStan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed May 16, 2024
1 parent f9d89b7 commit 63471c6
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 50 deletions.
4 changes: 2 additions & 2 deletions inc/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Configuration {
*
* @phpstan-var ProjectConfig
*/
protected $config = [];
protected array $config = [];

/**
* Class constructor.
Expand Down Expand Up @@ -84,7 +84,7 @@ public function get_config(): array {
* @phpstan-param T $key
* @phpstan-return ProjectConfig[T] | null
*/
public function get_config_value( string $key ): string|array|null {
public function get_config_value( string $key ): mixed {
if ( isset( $this->config[ $key ] ) ) {
return $this->config[ $key ];
}
Expand Down
7 changes: 2 additions & 5 deletions tests/phpunit/tests/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
* Test cases for \Required\Traduttore\Export.
*/
class Export extends TestCase {
/**
* @var \GP_Translation_Set
*/
protected $translation_set;
protected \GP_Translation_Set $translation_set;

public function setUp(): void {
parent::setUp();
Expand Down Expand Up @@ -149,7 +146,7 @@ public function test_creates_multiple_json_files(): void {
* Modify the mapping of sources to translation entries.
*
* @param array<string, \Translation_Entry[]> $mapping The mapping of sources to translation entries.
* @return array<string, \Required\Traduttore\Tests\Translation_Entry[]> The maybe modified mapping.
* @return array<string, \Translation_Entry[]> The maybe modified mapping.
*/
public function filter_map_entries_to_source( array $mapping ): array {
$mapping['build.js'] = array_merge( $mapping['my-super-script.js'], $mapping['my-other-script.js'] );
Expand Down
5 changes: 1 addition & 4 deletions tests/phpunit/tests/Loader/Git.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
* @todo Mock shell execution
*/
class Git extends TestCase {
/**
* @var \Required\Traduttore\Tests\Loader\Project
*/
protected $project;
protected Project $project;

public function setUp(): void {
parent::setUp();
Expand Down
5 changes: 1 addition & 4 deletions tests/phpunit/tests/Loader/Mercurial.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
* @todo Mock shell execution
*/
class Mercurial extends TestCase {
/**
* @var \Required\Traduttore\Tests\Loader\Project
*/
protected $project;
protected Project $project;

public function setUp(): void {
parent::setUp();
Expand Down
5 changes: 1 addition & 4 deletions tests/phpunit/tests/Loader/Subversion.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
* @todo Mock shell execution
*/
class Subversion extends TestCase {
/**
* @var \Required\Traduttore\Tests\Loader\Project
*/
protected $project;
protected Project $project;

public function setUp(): void {
parent::setUp();
Expand Down
12 changes: 4 additions & 8 deletions tests/phpunit/tests/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@

use DateTime;
use DateTimeZone;
use GP_Project;
use Required\Traduttore\Project as TraduttoreProject;

/**
* Test cases for \Required\Traduttore\Project.
*/
class Project extends TestCase {
/**
* @var \Required\Traduttore\Tests\GP_Project
*/
protected $gp_project;
/**
* @var \Required\Traduttore\Tests\TraduttoreProject
*/
protected $project;
protected GP_Project $gp_project;

protected TraduttoreProject $project;

public function setUp(): void {
parent::setUp();
Expand Down
19 changes: 5 additions & 14 deletions tests/phpunit/tests/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,11 @@
* Test cases for \Required\Traduttore\Runner.
*/
class Runner extends TestCase {
/**
* @var \Required\Traduttore\Tests\Project
*/
protected $project;

/**
* @var \Required\Traduttore\Tests\R
*/
protected $runner;

/**
* @var \Required\Traduttore\Loader
*/
protected $loader;
protected Project $project;

protected R $runner;

protected Loader $loader;

public function setUp(): void {
parent::setUp();
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use GP_UnitTest_Factory;
use GP_UnitTestCase;
use WP_Error;
use WP_REST_Response;

/**
Expand Down
12 changes: 3 additions & 9 deletions tests/phpunit/tests/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,9 @@
* Test cases for \Required\Traduttore\Updater.
*/
class Updater extends TestCase {
/**
* @var \Required\Traduttore\Tests\Project
*/
protected $project;

/**
* @var \Required\Traduttore\Tests\U
*/
protected $updater;
protected Project $project;

protected U $updater;

public function setUp(): void {
parent::setUp();
Expand Down

0 comments on commit 63471c6

Please sign in to comment.