Skip to content

Commit

Permalink
Support TOML v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hason committed Dec 26, 2024
1 parent b09d074 commit 3b890eb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CHANGELOG
* PHP 8.4 support
* Drop PHP 7 support
* Remove MtHAML filter
* Add support for TOML v1.0.0

2.0.0 (2024-02-22)
------------------
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
},
"require-dev": {
"ext-json": "*",
"devium/toml": "^1.0",
"friendsofphp/php-cs-fixer": "^3.65",
"league/commonmark": "^2.0",
"nette/neon": "^2.2 || ^3.0",
"phpunit/phpunit": "^10.5",
"phpstan/phpstan": "^2.0",
"twig/twig": "^3.0",
"yosymfony/toml": "^1.0"
"twig/twig": "^3.0"
},
"suggest": {
"nette/neon": "If you want to use NEON as front matter",
"yosymfony/toml": "If you want to use TOML as front matter"
"devium/toml": "If you want to use TOML v1.0.0 as front matter",
"nette/neon": "If you want to use NEON as front matter"
},
"config": {
"sort-packages": true
Expand Down
8 changes: 6 additions & 2 deletions src/Processor/TomlProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@

namespace Webuni\FrontMatter\Processor;

use Yosymfony\Toml\Toml;
use Devium\Toml\Toml;
use Devium\Toml\TomlError;

final class TomlProcessor implements ProcessorInterface
{
/**
* @throws TomlError
*/
public function parse(string $string): array
{
return (array) Toml::parse($string);
return (array) Toml::decode($string);
}

public function dump(array $data): string
Expand Down

0 comments on commit 3b890eb

Please sign in to comment.