Skip to content

Commit 7c1b2db

Browse files
committed
#151 - Remove redundant comments and code
1 parent c37c5ed commit 7c1b2db

File tree

6 files changed

+6
-59
lines changed

6 files changed

+6
-59
lines changed

src/Db/Adapter/Pdo/PdoPostgresql.php

+2-16
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
use Phalcon\Db\Adapter\Pdo\Postgresql;
1717
use Phalcon\Db\Enum;
1818
use Phalcon\Db\Index;
19-
use Phalcon\Db\IndexInterface;
2019
use Phalcon\Db\Reference;
21-
use Phalcon\Db\ReferenceInterface;
2220

2321
class PdoPostgresql extends Postgresql
2422
{
@@ -27,18 +25,12 @@ class PdoPostgresql extends Postgresql
2725

2826
/**
2927
* Lists table references
30-
*
31-
* @param string $table
32-
* @param string|null $schema
33-
*
34-
* @return ReferenceInterface[]
3528
*/
3629
public function describeReferences(string $table, string $schema = null): array
3730
{
3831
$references = [];
3932

40-
$rows = $this->fetchAll($this->getDialect()
41-
->describeReferences($table, $schema), Enum::FETCH_NUM);
33+
$rows = $this->fetchAll($this->getDialect()->describeReferences($table, $schema), Enum::FETCH_NUM);
4234
foreach ($rows as $reference) {
4335
$constraintName = $reference[2];
4436
if (!isset($references[$constraintName])) {
@@ -85,12 +77,6 @@ public function describeReferences(string $table, string $schema = null): array
8577
return $referenceObjects;
8678
}
8779

88-
/**
89-
* @param string $table
90-
* @param string|null $schema
91-
*
92-
* @return IndexInterface[]
93-
*/
9480
public function describeIndexes(string $table, string $schema = null): array
9581
{
9682
$indexes = [];
@@ -121,7 +107,7 @@ public function describeIndexes(string $table, string $schema = null): array
121107
$indexObjects[$name] = new Index(
122108
$name,
123109
$index['columns'],
124-
$index['type']
110+
$index['type'],
125111
);
126112
}
127113

src/Migration/Action/Generate.php

-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,6 @@ public function createDumpFiles(
347347
/**
348348
* Prepare table columns
349349
*
350-
* @return Generator
351350
* @throws UnknownColumnTypeException
352351
*/
353352
public function getColumns(): Generator

src/Mvc/Model/Migration.php

+2-28
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Migration
8282
*
8383
* @var AbstractAdapter
8484
*/
85-
protected static $connection;
85+
protected static AbstractAdapter $connection;
8686

8787
/**
8888
* Database configuration
@@ -343,10 +343,6 @@ public static function migrate(
343343
/**
344344
* Create migration object for specified version
345345
*
346-
* @param ItemInterface $version
347-
* @param string $tableName
348-
*
349-
* @return null|Migration
350346
* @throws Exception
351347
*/
352348
private static function createClass(ItemInterface $version, string $tableName): ?Migration
@@ -374,12 +370,7 @@ private static function createClass(ItemInterface $version, string $tableName):
374370
/**
375371
* Find the last morph function in the previous migration files
376372
*
377-
* @param ItemInterface $toVersion
378-
* @param string $tableName
379-
*
380-
* @return null|Migration
381373
* @throws Exception
382-
* @internal param ItemInterface $version
383374
*/
384375
private static function createPrevClassWithMorphMethod(ItemInterface $toVersion, string $tableName): ?Migration
385376
{
@@ -404,10 +395,6 @@ private static function createPrevClassWithMorphMethod(ItemInterface $toVersion,
404395

405396
/**
406397
* Scan for all versions
407-
*
408-
* @param string $dir Directory to scan
409-
*
410-
* @return ItemInterface[]
411398
*/
412399
public static function scanForVersions(string $dir): array
413400
{
@@ -427,11 +414,6 @@ public static function scanForVersions(string $dir): array
427414

428415
/**
429416
* Look for table definition modifications and apply to real table
430-
*
431-
* @param string $tableName
432-
* @param array $definition
433-
*
434-
* @throws DbException
435417
*/
436418
public function morphTable(string $tableName, array $definition): void
437419
{
@@ -774,12 +756,8 @@ public function morphTable(string $tableName, array $definition): void
774756

775757
/**
776758
* Inserts data from a data migration file in a table
777-
*
778-
* @param string $tableName
779-
* @param mixed $fields
780-
* @param int $size Insert batch size
781759
*/
782-
public function batchInsert(string $tableName, $fields, int $size = 1024): void
760+
public function batchInsert(string $tableName, array $fields, int $size = 1024): void
783761
{
784762
$migrationData = self::$migrationPath . $this->version . '/' . $tableName . '.dat';
785763
if (!file_exists($migrationData)) {
@@ -882,10 +860,6 @@ protected function executeMultiInsert(string $table, array $columns, string $val
882860

883861
/**
884862
* Resolves the DB Schema
885-
*
886-
* @param Config $config
887-
*
888-
* @return null|string
889863
*/
890864
public static function resolveDbSchema(Config $config): ?string
891865
{

src/Mvc/Model/Migration/TableAware/ListTablesDb.php

-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ class ListTablesDb implements ListTablesInterface
2727
/**
2828
* Get table names with prefix for running migration
2929
*
30-
* @param string $tablePrefix
31-
* @param DirectoryIterator|null $iterator
32-
*
33-
* @return string
3430
* @throws DbException
3531
*/
3632
public function listTablesForPrefix(string $tablePrefix, DirectoryIterator $iterator = null): string

src/Version/IncrementalItem.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,7 @@ public function addMinor(int $number): IncrementalItem
173173
}
174174

175175
$parts = array_reverse($parts);
176-
177-
$this->setParts($parts)
178-
->regenerateVersionStamp()
179-
;
180-
176+
$this->setParts($parts)->regenerateVersionStamp();
181177
$this->version = join('.', $parts);
182178

183179
return $this;

src/Version/ItemCollection.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,8 @@ public static function setType(int $type): void
4747

4848
/**
4949
* Create new version item
50-
*
51-
* @param null|string $version
52-
*
53-
* @return IncrementalItem|TimestampedItem
5450
*/
55-
public static function createItem(string $version = null)
51+
public static function createItem(string $version = null): TimestampedItem|IncrementalItem
5652
{
5753
if (self::TYPE_INCREMENTAL === self::$type) {
5854
$version = $version ?: '0.0.0';

0 commit comments

Comments
 (0)