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

Create instance of ArrayParser directly #330

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Bug #316, #6: Support table view constraints (@Tigrov)
- Enh #324: Change property `Schema::$typeMap` to constant `Schema::TYPE_MAP` (@Tigrov)
- Enh #303: Support composite types (@Tigrov)
- Enh #330: Create instance of `ArrayParser` directly (@Tigrov)

## 1.2.0 November 12, 2023

Expand Down
10 changes: 1 addition & 9 deletions src/ColumnSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function phpTypecast(mixed $value): mixed
{
if ($this->dimension > 0) {
if (is_string($value)) {
$value = $this->getArrayParser()->parse($value);
$value = (new ArrayParser())->parse($value);
}

if (!is_array($value)) {
Expand Down Expand Up @@ -239,14 +239,6 @@ private function phpTypecastComposite(mixed $value): array|null
return $fields;
}

/**
* Creates instance of ArrayParser.
*/
private function getArrayParser(): ArrayParser
{
return new ArrayParser();
}

/**
* @return int Get the dimension of the array.
*
Expand Down