Resolve PHPStan level 6 findings

This commit is contained in:
2024-08-30 09:24:25 -04:00
parent 9e0e663811
commit 0a188a80c2
29 changed files with 185 additions and 112 deletions

View File

@@ -25,7 +25,7 @@ class ConfigurationTest extends TestCase
}
#[TestDox('ID field change succeeds')]
public function testIdFieldChangeSucceeds()
public function testIdFieldChangeSucceeds(): void
{
try {
Configuration::$idField = 'EyeDee';

View File

@@ -18,21 +18,21 @@ use PHPUnit\Framework\TestCase;
#[TestDox('String Mapper (Unit tests)')]
class StringMapperTest extends TestCase
{
public function testMapSucceedsWhenFieldIsPresentAndString()
public function testMapSucceedsWhenFieldIsPresentAndString(): void
{
$result = ['test_field' => 'test_value'];
$mapper = new StringMapper('test_field');
$this->assertEquals('test_value', $mapper->map($result), 'String value not returned correctly');
}
public function testMapSucceedsWhenFieldIsPresentAndNotString()
public function testMapSucceedsWhenFieldIsPresentAndNotString(): void
{
$result = ['a_number' => 6.7];
$mapper = new StringMapper('a_number');
$this->assertEquals('6.7', $mapper->map($result), 'Number value not returned correctly');
}
public function testMapSucceedsWhenFieldIsNotPresent()
public function testMapSucceedsWhenFieldIsNotPresent(): void
{
$mapper = new StringMapper('something_else');
$this->assertNull($mapper->map([]), 'Missing value not returned correctly');

View File

@@ -48,7 +48,7 @@ class RemoveFieldsTest extends TestCase
}
#[TestDox('By ID succeeds for PostgreSQL')]
public function testByIdSucceedsForPostgreSQL()
public function testByIdSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
$this->assertEquals("UPDATE churro SET data = data - :bite::text[] WHERE data->>'id' = :id",
@@ -56,7 +56,7 @@ class RemoveFieldsTest extends TestCase
}
#[TestDox('By ID succeeds for SQLite')]
public function testByIdSucceedsForSQLite()
public function testByIdSucceedsForSQLite(): void
{
Configuration::overrideMode(Mode::SQLite);
$this->assertEquals("UPDATE quesadilla SET data = json_remove(data, :bite0) WHERE data->>'id' = :id",
@@ -72,7 +72,7 @@ class RemoveFieldsTest extends TestCase
}
#[TestDox('By fields succeeds for PostgreSQL')]
public function testByFieldsSucceedsForPostgreSQL()
public function testByFieldsSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
$this->assertEquals("UPDATE enchilada SET data = data - :sauce::text[] WHERE data->>'cheese' = :queso",
@@ -82,7 +82,7 @@ class RemoveFieldsTest extends TestCase
}
#[TestDox('By fields succeeds for SQLite')]
public function testByFieldsSucceedsForSQLite()
public function testByFieldsSucceedsForSQLite(): void
{
Configuration::overrideMode(Mode::SQLite);
$this->assertEquals(

View File

@@ -207,7 +207,7 @@ class QueryTest extends TestCase
Query::save('test_tbl'), 'INSERT ON CONFLICT statement not constructed correctly');
}
public function testUpdateSucceeds()
public function testUpdateSucceeds(): void
{
$this->assertEquals("UPDATE testing SET data = :data WHERE data->>'id' = :id", Query::update('testing'),
'UPDATE statement not constructed correctly');