Skip to content

Commit 66953b1

Browse files
committed
Apply Rector fixes
1 parent 8698219 commit 66953b1

File tree

15 files changed

+26
-31
lines changed

15 files changed

+26
-31
lines changed

rector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666

6767
// Are there files or rules you need to skip?
6868
$rectorConfig->skip([
69+
__DIR__ . '/src/Archiver/Handlers/CliHandler.php', // Rector doesn't like the Kint modifier
6970
__DIR__ . '/src/Views',
7071

7172
JsonThrowOnErrorRector::class,
@@ -114,6 +115,6 @@
114115
$rectorConfig->rule(NormalizeNamespaceByPSR4ComposerAutoloadRector::class);
115116
$rectorConfig
116117
->ruleWithConfiguration(TypedPropertyRector::class, [
117-
TypedPropertyRector::INLINE_PUBLIC => true,
118+
TypedPropertyRector::INLINE_PUBLIC => false,
118119
]);
119120
};

src/Collectors/Schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function getTitleDetails(): string
7070
return '(No tables)';
7171
}
7272

73-
return '(' . count($this->schema->tables) . ' tables)';
73+
return '(' . (is_countable($this->schema->tables) ? count($this->schema->tables) : 0) . ' tables)';
7474
}
7575

7676
//--------------------------------------------------------------------

src/Language/en/Schemas.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace Tatter\Schemas\Language\en;
4+
35
return [
46
'methodNotImplemented' => '{0} does not have a {1} method',
57
'unsupportedHandler' => 'Handler not supported: {0}',

src/Reader/Handlers/CacheHandler.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ public function __construct(?SchemasConfig $config = null, ?CacheInterface $cach
3232
$this->cacheInit($cache);
3333

3434
// Start $tables as the cached scaffold version
35-
if ($scaffold = $this->cache->get($this->cacheKey)) {
36-
if (isset($scaffold->tables)) {
37-
$this->tables = $scaffold->tables ?? new Mergeable();
38-
$this->ready = true;
39-
}
35+
if (($scaffold = $this->cache->get($this->cacheKey)) && isset($scaffold->tables)) {
36+
$this->tables = $scaffold->tables ?? new Mergeable();
37+
$this->ready = true;
4038
}
4139
}
4240

@@ -131,7 +129,7 @@ public function __isset($name): bool
131129
*/
132130
public function count(): int
133131
{
134-
return count($this->tables);
132+
return $this->tables === null ? 0 : count($this->tables);
135133
}
136134

137135
/**

src/Structures/Mergeable.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ class Mergeable implements Countable, IteratorAggregate
1111
{
1212
/**
1313
* Merge two structures together.
14-
*
15-
* @return $this
1614
*/
1715
public function merge(?Mergeable $object): Mergeable
1816
{

src/Traits/CacheHandlerTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait CacheHandlerTrait
1111
/**
1212
* The cache handler instance.
1313
*
14-
* @var \CodeIgniter\Cache\CacheInterface
14+
* @var CacheInterface
1515
*/
1616
protected $cache;
1717

tests/_support/Database/Migrations/2019-09-02-092335_create_test_tables.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
namespace Tests\Support\Database\Migrations;
44

5+
use CodeIgniter\Database\BaseConnection;
56
use CodeIgniter\Database\Migration;
67

78
/**
8-
* @property \CodeIgniter\Database\BaseConnection $db
9+
* @property BaseConnection $db
910
*/
1011
class CreateTestTables extends Migration
1112
{

tests/_support/Database/Seeds/TestSeeder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace Tests\Support\Database\Seeds;
44

5-
class TestSeeder extends \CodeIgniter\Database\Seeder
5+
use CodeIgniter\Database\Seeder;
6+
7+
class TestSeeder extends Seeder
68
{
79
public function run()
810
{

tests/_support/DatabaseTestCase.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use CodeIgniter\Test\CIUnitTestCase;
66
use CodeIgniter\Test\DatabaseTestTrait;
7+
use Tatter\Schemas\Config\Schemas;
78

89
/**
910
* @internal
@@ -64,7 +65,7 @@ protected function setUp(): void
6465
{
6566
parent::setUp();
6667

67-
$config = new \Tatter\Schemas\Config\Schemas();
68+
$config = new Schemas();
6869
$config->silent = false;
6970
$config->ignoredTables = ['migrations'];
7071
$config->ignoredNamespaces = [];

tests/_support/Schemas/Good/Products.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Tests\Support;
3+
namespace Tests\Support\Schemas\Good;
44

55
use Tatter\Schemas\Structures\Relation;
66
use Tatter\Schemas\Structures\Schema;

0 commit comments

Comments
 (0)