diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 969af06..9f5be6c 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: true matrix: - php: [8.0] # 7.2, 7.3, + php: [8.0, 8.1] # 7.2, 7.3, os: [ubuntu-latest, macOS-latest] # windows-latest, # include: # will not testing on php 7.2 # - os: 'ubuntu-latest' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1940bb5..20ab951 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,18 +55,6 @@ jobs: php kite.phar git cl prev last --style gh-release --no-merges --fetch-tags --unshallow --file changelog.md cat changelog.md - # https://github.com/meeDamian/github-release -# - name: Create release and upload assets -# uses: meeDamian/github-release@2.0 -# with: -# gzip: false -# token: ${{ secrets.GITHUB_TOKEN }} -# tag: ${{ env.RELEASE_TAG }} -# name: ${{ env.RELEASE_TAG }} -# body: | -# ${{ steps.changelog.outputs.CHLOGBODY }} -# files: kite-${{ env.RELEASE_TAG }}.phar - # https://github.com/softprops/action-gh-release - name: Create release and upload assets uses: softprops/action-gh-release@v1 diff --git a/README.md b/README.md index c5a8f2b..fad2bc0 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ composer require phppkg/ini example ini: -```text +```ini ; comments line // comments line # comments line @@ -44,19 +44,19 @@ multi-line = ''' this is a multi line string - ''' +''' # simple inline list array inlineList = [ab, 23, 34.5] -# simple multi-line list array, equals the 'simpleList' +# simple multi-line list array, equals the 'simpleList1' simpleList[] = 567 simpleList[] = "some value" # simple multi-line list array [simpleList1] -[] = 567 -[] = "some value" +- = 567 +- = "some value" # simple k-v map [simpleMap] diff --git a/composer.json b/composer.json index 19fb593..3b3e75e 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "require": { "php": ">8.0", "ext-mbstring": "*", - "toolkit/stdlib":"~1.0" + "toolkit/stdlib":"~2.0" }, "autoload": { "psr-4": { diff --git a/src/IniParser.php b/src/IniParser.php index e5cca75..5bd6e92 100644 --- a/src/IniParser.php +++ b/src/IniParser.php @@ -223,8 +223,8 @@ protected function collectValue(string $key, mixed $val): void // in section. eg: [arrayName] -> $sectionName='arrayName' $section = $this->sectionName; - // is list array value. eg `[] = "arr_elem_one"` - if ($key === '[]') { + // is list array value. eg `- = "arr_elem_one"` `[] = "arr_elem_one"` + if ($key === '-' || $key === '[]') { if (!isset($this->data[$section]) || !is_array($this->data[$section])) { $this->data[$section] = []; } diff --git a/test/IniParserTest.php b/test/IniParserTest.php index 495644e..a8c7b46 100644 --- a/test/IniParserTest.php +++ b/test/IniParserTest.php @@ -35,14 +35,14 @@ public function testParseIni_full(): void # simple inline list array inlineList = [ab, 23, 34.5] -# simple multi-line list array, equals the 'simpleList' +# simple multi-line list array, equals the 'simpleList1' simpleList[] = 567 simpleList[] = "some value" # simple multi-line list array [simpleList1] [] = 567 -[] = "some value" +- = "some value" # simple k-v map [simpleMap] diff --git a/test/IniTestCase.php b/test/IniTestCase.php index 6472114..ebe9de8 100644 --- a/test/IniTestCase.php +++ b/test/IniTestCase.php @@ -27,13 +27,13 @@ abstract class IniTestCase extends TestCase * $ret = $rftMth->invokeArgs($obj, $invokeArgs); * ``` * - * @param string|object $class + * @param object|string $class * @param string $method * * @return ReflectionMethod * @throws ReflectionException */ - protected static function getMethod($class, string $method): ReflectionMethod + protected static function getMethod(object|string $class, string $method): ReflectionMethod { $refMth = new ReflectionMethod($class, $method); $refMth->setAccessible(true); diff --git a/test/testdata/.keep b/test/testdata/.keep deleted file mode 100644 index e69de29..0000000