-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from butschster/hotfix/10
Fixes some problems with syntax
- Loading branch information
Showing
10 changed files
with
436 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Butschster\Dbml\Ast\Table\Column; | ||
|
||
class SizeNode | ||
{ | ||
public function __construct( | ||
private int $offset, | ||
private string $value, | ||
) { | ||
} | ||
|
||
public function getOffset(): int | ||
{ | ||
return $this->offset; | ||
} | ||
|
||
public function getValue(): array | ||
{ | ||
return array_map('intval', explode(',', substr($this->value, 1, -1))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Butschster\Tests\Ast\Table\Column; | ||
|
||
use Butschster\Dbml\Ast\Table\Column\SizeNode; | ||
use Butschster\Tests\Ast\TestCase; | ||
|
||
class SizeNodeTest extends TestCase | ||
{ | ||
function test_gets_offset() | ||
{ | ||
$node = new SizeNode(123, '(1)'); | ||
$this->assertEquals(123, $node->getOffset()); | ||
} | ||
|
||
function test_gets_value() | ||
{ | ||
$node = new SizeNode(123, '(1)'); | ||
$this->assertSame([1], $node->getValue()); | ||
} | ||
|
||
function test_gets_coma_separated_value() | ||
{ | ||
$node = new SizeNode(123, '(8,2)'); | ||
$this->assertSame([8,2], $node->getValue()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.