Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type hints to codebase #1995

Merged
merged 28 commits into from
Aug 3, 2021
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
937871c
starting adding types to codebase
MasterOdin Jun 17, 2021
3cfd71a
more typing
MasterOdin Jun 17, 2021
88bc125
replace rest of types
MasterOdin Jun 19, 2021
761495d
fix types in tests
MasterOdin Jun 19, 2021
0baf356
fix type hint on Config class
MasterOdin Jun 19, 2021
6ef2a2c
replace mixed with concrete types
MasterOdin Jun 19, 2021
df0901f
fix typehint on NullGenerator
MasterOdin Jun 19, 2021
f8d4391
return ConfigInterface not Config
MasterOdin Jun 19, 2021
f385bbb
fix tests
MasterOdin Jun 19, 2021
f8f1aad
fix phpstan errors
MasterOdin Jun 19, 2021
1296fee
getValues can be null
MasterOdin Jun 19, 2021
a3e86e7
more things can be null
MasterOdin Jun 19, 2021
cfb4f9f
more nulls
MasterOdin Jun 19, 2021
2e4b1e8
fix accidental test failures
MasterOdin Jun 19, 2021
223d553
more nulls
MasterOdin Jun 19, 2021
166b310
convert int to float for Column::
MasterOdin Jun 19, 2021
0dd2a06
fix int/float typing
MasterOdin Jun 20, 2021
5978259
remove typing on RawBufferedOutput
MasterOdin Jun 20, 2021
5dbfd1e
parseDefault may receive null
MasterOdin Jun 20, 2021
32d7368
Update src/Phinx/Db/Adapter/AdapterFactory.php
MasterOdin Jul 28, 2021
8d608dd
Apply suggestions from code review
MasterOdin Jul 28, 2021
be536ff
more review comment addressing
MasterOdin Jul 28, 2021
1d638fe
add inline type hint for phpstan
MasterOdin Jul 28, 2021
f7d6a2f
review comment
MasterOdin Jul 28, 2021
2c9a111
Merge branch '0.next' into add_typing
MasterOdin Aug 3, 2021
d15e3da
Update phpstan-baseline.neon
MasterOdin Aug 3, 2021
468c283
Fix limit type hint back to int
MasterOdin Aug 3, 2021
5222f12
missed a test
MasterOdin Aug 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
76 changes: 38 additions & 38 deletions src/Phinx/Db/Table/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,37 +76,37 @@ class Column
/**
* @var mixed|null
*/
protected $default;
protected $default = null;
dereuromark marked this conversation as resolved.
Show resolved Hide resolved

/**
* @var bool
*/
protected $identity = false;

/**
* @var int
* @var int|null
*/
protected $seed;
protected $seed = null;
MasterOdin marked this conversation as resolved.
Show resolved Hide resolved

/**
* @var int
* @var int|null
*/
protected $increment;
protected $increment = null;

/**
* @var int
* @var int|null
*/
protected $scale = null;

/**
* @var string
* @var string|null
*/
protected $after;
protected $after = null;

/**
* @var string
* @var string|null
*/
protected $update;
protected $update = null;

/**
* @var string|null
Expand All @@ -129,19 +129,19 @@ class Column
protected $properties = [];

/**
* @var string|string
* @var string|null
*/
protected $collation;
protected $collation = null;

/**
* @var string|string
* @var string|null
*/
protected $encoding = null;

/**
* @var int|null
*/
protected $srid;
protected $srid = null;

/**
* @var array|null
Expand Down Expand Up @@ -197,10 +197,10 @@ public function getType()
/**
* Sets the column limit.
*
* @param int|null $limit Limit
* @param int $limit Limit
* @return $this
*/
public function setLimit(?int $limit)
public function setLimit(int $limit)
{
$this->limit = $limit;

Expand All @@ -210,7 +210,7 @@ public function setLimit(?int $limit)
/**
* Gets the column limit.
*
* @return int
* @return int|null
*/
public function getLimit(): ?int
{
Expand Down Expand Up @@ -266,7 +266,7 @@ public function setDefault($default)
/**
* Gets the default column value.
*
* @return mixed
* @return mixed|null
*/
public function getDefault()
{
Expand Down Expand Up @@ -322,9 +322,9 @@ public function setAfter(string $after)
/**
* Returns the name of the column to add this column after.
*
* @return string
* @return string|null
*/
public function getAfter(): string
public function getAfter(): ?string
{
return $this->after;
}
Expand All @@ -345,9 +345,9 @@ public function setUpdate(string $update)
/**
* Returns the value of the ON UPDATE column function.
*
* @return string
* @return string|null
*/
public function getUpdate(): string
public function getUpdate(): ?string
{
return $this->update;
}
Expand All @@ -358,10 +358,10 @@ public function getUpdate(): string
* For example `DECIMAL(5,2)`, 5 is the precision and 2 is the scale,
* and the column could store value from -999.99 to 999.99.
*
* @param int|null $precision Number precision
* @param int $precision Number precision
* @return $this
*/
public function setPrecision(?int $precision)
public function setPrecision(int $precision)
{
$this->setLimit($precision);

Expand All @@ -382,21 +382,24 @@ public function getPrecision(): ?int
}

/**
* Gets the column identity seed.
* Sets the column identity increment.
*
* @return int
* @param int $increment Number increment
* @return $this
*/
public function getSeed(): int
public function setIncrement(int $increment)
{
return $this->seed;
$this->increment = $increment;

return $this;
}

/**
* Gets the column identity increment.
*
* @return int
* @return int|null
*/
public function getIncrement(): int
public function getIncrement(): ?int
{
return $this->increment;
}
Expand All @@ -415,16 +418,13 @@ public function setSeed(int $seed)
}

/**
* Sets the column identity increment.
* Gets the column identity seed.
*
* @param int $increment Number increment
* @return $this
* @return int
*/
public function setIncrement(int $increment)
public function getSeed(): ?int
{
$this->increment = $increment;

return $this;
return $this->seed;
}

/**
Expand All @@ -436,7 +436,7 @@ public function setIncrement(int $increment)
* @param int|null $scale Number scale
* @return $this
*/
public function setScale(?int $scale)
public function setScale(int $scale)
{
$this->scale = $scale;

Expand Down