mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-03 13:37:27 +02:00
Merge pull request #476 from sjokkateer/improvement/EAV
EAV: Update missing type declarations
This commit is contained in:
@@ -15,7 +15,7 @@ class Attribute implements \Stringable
|
|||||||
$this->values = new SplObjectStorage();
|
$this->values = new SplObjectStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addValue(Value $value)
|
public function addValue(Value $value): void
|
||||||
{
|
{
|
||||||
$this->values->attach($value);
|
$this->values->attach($value);
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@ class Entity implements \Stringable
|
|||||||
/**
|
/**
|
||||||
* @param Value[] $values
|
* @param Value[] $values
|
||||||
*/
|
*/
|
||||||
public function __construct(private string $name, $values)
|
public function __construct(private string $name, array $values)
|
||||||
{
|
{
|
||||||
$this->values = new SplObjectStorage();
|
$this->values = new SplObjectStorage();
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
|
|
||||||
class EAVTest extends TestCase
|
class EAVTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testCanAddAttributeToEntity()
|
public function testCanAddAttributeToEntity(): void
|
||||||
{
|
{
|
||||||
$colorAttribute = new Attribute('color');
|
$colorAttribute = new Attribute('color');
|
||||||
$colorSilver = new Value($colorAttribute, 'silver');
|
$colorSilver = new Value($colorAttribute, 'silver');
|
||||||
|
Reference in New Issue
Block a user