From fc905f200fc52dd433ab67248c5c40dccc0372f8 Mon Sep 17 00:00:00 2001 From: Joshua Kisb Date: Sat, 11 May 2024 16:36:55 +0300 Subject: [PATCH 1/3] fix tests and other syntax errors --- composer.lock | 557 ++++++++++++---------- src/Parser.php | 311 ++++++------ src/Parser/Interfaces/ParserInterface.php | 46 +- src/Writer.php | 113 ++--- tests/ParserTest.php | 3 +- tests/WriterTest.php | 149 +++--- tests/issue/Issue00012Test.php | 2 +- tests/issue/Issue00017Test.php | 2 +- tests/issue/Issue00018Test.php | 2 +- tests/library/Gedcom/GedcomTest.php | 2 +- tests/library/Gedcom/ParserTest.php | 156 +++--- 11 files changed, 650 insertions(+), 693 deletions(-) diff --git a/composer.lock b/composer.lock index 05048e24..68ff55d8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "76123b376a15970fff7f40fd701021a6", + "content-hash": "78b9dc09818e5ee5b609d7f8f16967a2", "packages": [], "packages-dev": [ { @@ -102,25 +102,27 @@ }, { "name": "nikic/php-parser", - "version": "v4.17.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -128,7 +130,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -152,26 +154,27 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" }, - "time": "2023-08-13T19:53:39+00:00" + "time": "2024-03-05T20:51:40+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -212,9 +215,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -269,16 +278,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.35", + "version": "1.10.67", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3" + "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e730e5facb75ffe09dfb229795e8c01a459f26c3", - "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/16ddbe776f10da6a95ebd25de7c1dbed397dc493", + "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493", "shasum": "" }, "require": { @@ -321,45 +330,41 @@ { "url": "https://github.com/phpstan", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" } ], - "time": "2023-09-19T15:27:56+00:00" + "time": "2024-04-16T07:22:02+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "10.1.6", + "version": "11.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "56f33548fe522c8d82da7ff3824b42829d324364" + "reference": "7e35a2cbcabac0e6865fd373742ea432a3c34f92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/56f33548fe522c8d82da7ff3824b42829d324364", - "reference": "56f33548fe522c8d82da7ff3824b42829d324364", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e35a2cbcabac0e6865fd373742ea432a3c34f92", + "reference": "7e35a2cbcabac0e6865fd373742ea432a3c34f92", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", - "php": ">=8.1", - "phpunit/php-file-iterator": "^4.0", - "phpunit/php-text-template": "^3.0", - "sebastian/code-unit-reverse-lookup": "^3.0", - "sebastian/complexity": "^3.0", - "sebastian/environment": "^6.0", - "sebastian/lines-of-code": "^2.0", - "sebastian/version": "^4.0", + "nikic/php-parser": "^5.0", + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.0", + "phpunit/php-text-template": "^4.0", + "sebastian/code-unit-reverse-lookup": "^4.0", + "sebastian/complexity": "^4.0", + "sebastian/environment": "^7.0", + "sebastian/lines-of-code": "^3.0", + "sebastian/version": "^5.0", "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^10.1" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -368,7 +373,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.1-dev" + "dev-main": "11.0-dev" } }, "autoload": { @@ -397,7 +402,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.3" }, "funding": [ { @@ -405,32 +410,32 @@ "type": "github" } ], - "time": "2023-09-19T04:59:03+00:00" + "time": "2024-03-12T15:35:40+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "4.1.0", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" + "reference": "99e95c94ad9500daca992354fa09d7b99abe2210" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", - "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/99e95c94ad9500daca992354fa09d7b99abe2210", + "reference": "99e95c94ad9500daca992354fa09d7b99abe2210", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -458,7 +463,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.0.0" }, "funding": [ { @@ -466,28 +471,28 @@ "type": "github" } ], - "time": "2023-08-31T06:24:48+00:00" + "time": "2024-02-02T06:05:04+00:00" }, { "name": "phpunit/php-invoker", - "version": "4.0.0", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" + "reference": "5d8d9355a16d8cc5a1305b0a85342cfa420612be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", - "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5d8d9355a16d8cc5a1305b0a85342cfa420612be", + "reference": "5d8d9355a16d8cc5a1305b0a85342cfa420612be", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-pcntl": "*" @@ -495,7 +500,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -521,7 +526,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.0" }, "funding": [ { @@ -529,32 +535,32 @@ "type": "github" } ], - "time": "2023-02-03T06:56:09+00:00" + "time": "2024-02-02T06:05:50+00:00" }, { "name": "phpunit/php-text-template", - "version": "3.0.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" + "reference": "d38f6cbff1cdb6f40b03c9811421561668cc133e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", - "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/d38f6cbff1cdb6f40b03c9811421561668cc133e", + "reference": "d38f6cbff1cdb6f40b03c9811421561668cc133e", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -581,7 +587,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.0" }, "funding": [ { @@ -589,32 +595,32 @@ "type": "github" } ], - "time": "2023-08-31T14:07:24+00:00" + "time": "2024-02-02T06:06:56+00:00" }, { "name": "phpunit/php-timer", - "version": "6.0.0", + "version": "7.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" + "reference": "8a59d9e25720482ee7fcdf296595e08795b84dc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", - "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8a59d9e25720482ee7fcdf296595e08795b84dc5", + "reference": "8a59d9e25720482ee7fcdf296595e08795b84dc5", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -640,7 +646,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.0" }, "funding": [ { @@ -648,20 +655,20 @@ "type": "github" } ], - "time": "2023-02-03T06:57:52+00:00" + "time": "2024-02-02T06:08:01+00:00" }, { "name": "phpunit/phpunit", - "version": "10.3.5", + "version": "11.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503" + "reference": "d475be032238173ca3b0a516f5cc291d174708ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/747c3b2038f1139e3dcd9886a3f5a948648b7503", - "reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d475be032238173ca3b0a516f5cc291d174708ae", + "reference": "d475be032238173ca3b0a516f5cc291d174708ae", "shasum": "" }, "require": { @@ -674,23 +681,22 @@ "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", - "php": ">=8.1", - "phpunit/php-code-coverage": "^10.1.5", - "phpunit/php-file-iterator": "^4.0", - "phpunit/php-invoker": "^4.0", - "phpunit/php-text-template": "^3.0", - "phpunit/php-timer": "^6.0", - "sebastian/cli-parser": "^2.0", - "sebastian/code-unit": "^2.0", - "sebastian/comparator": "^5.0", - "sebastian/diff": "^5.0", - "sebastian/environment": "^6.0", - "sebastian/exporter": "^5.1", - "sebastian/global-state": "^6.0.1", - "sebastian/object-enumerator": "^5.0", - "sebastian/recursion-context": "^5.0", - "sebastian/type": "^4.0", - "sebastian/version": "^4.0" + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0", + "phpunit/php-file-iterator": "^5.0", + "phpunit/php-invoker": "^5.0", + "phpunit/php-text-template": "^4.0", + "phpunit/php-timer": "^7.0", + "sebastian/cli-parser": "^3.0", + "sebastian/code-unit": "^3.0", + "sebastian/comparator": "^6.0", + "sebastian/diff": "^6.0", + "sebastian/environment": "^7.0", + "sebastian/exporter": "^6.0", + "sebastian/global-state": "^7.0", + "sebastian/object-enumerator": "^6.0", + "sebastian/type": "^5.0", + "sebastian/version": "^5.0" }, "suggest": { "ext-soap": "To be able to generate mocks based on WSDL files" @@ -701,7 +707,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.3-dev" + "dev-main": "11.1-dev" } }, "autoload": { @@ -733,7 +739,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.5" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.1.3" }, "funding": [ { @@ -749,25 +755,25 @@ "type": "tidelift" } ], - "time": "2023-09-19T05:42:37+00:00" + "time": "2024-04-24T06:34:25+00:00" }, { "name": "rector/rector", - "version": "0.18.3", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "ba7988e3e028e68e07191d75b0d5473ac320c5e7" + "reference": "73eb63e4f9011dba6b7c66c3262543014e352f34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/ba7988e3e028e68e07191d75b0d5473ac320c5e7", - "reference": "ba7988e3e028e68e07191d75b0d5473ac320c5e7", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/73eb63e4f9011dba6b7c66c3262543014e352f34", + "reference": "73eb63e4f9011dba6b7c66c3262543014e352f34", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.31" + "phpstan/phpstan": "^1.10.57" }, "conflict": { "rector/rector-doctrine": "*", @@ -775,6 +781,9 @@ "rector/rector-phpunit": "*", "rector/rector-symfony": "*" }, + "suggest": { + "ext-dom": "To manipulate phpunit.xml via the custom-rule command" + }, "bin": [ "bin/rector" ], @@ -797,7 +806,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.18.3" + "source": "https://github.com/rectorphp/rector/tree/1.0.5" }, "funding": [ { @@ -805,32 +814,32 @@ "type": "github" } ], - "time": "2023-09-12T20:18:14+00:00" + "time": "2024-05-10T05:31:15+00:00" }, { "name": "sebastian/cli-parser", - "version": "2.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae" + "reference": "00a74d5568694711f0222e54fb281e1d15fdf04a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/efdc130dbbbb8ef0b545a994fd811725c5282cae", - "reference": "efdc130dbbbb8ef0b545a994fd811725c5282cae", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/00a74d5568694711f0222e54fb281e1d15fdf04a", + "reference": "00a74d5568694711f0222e54fb281e1d15fdf04a", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -853,7 +862,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.0" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.1" }, "funding": [ { @@ -861,32 +871,32 @@ "type": "github" } ], - "time": "2023-02-03T06:58:15+00:00" + "time": "2024-03-02T07:26:58+00:00" }, { "name": "sebastian/code-unit", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" + "reference": "6634549cb8d702282a04a774e36a7477d2bd9015" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", - "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/6634549cb8d702282a04a774e36a7477d2bd9015", + "reference": "6634549cb8d702282a04a774e36a7477d2bd9015", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -909,7 +919,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.0" }, "funding": [ { @@ -917,32 +928,32 @@ "type": "github" } ], - "time": "2023-02-03T06:58:43+00:00" + "time": "2024-02-02T05:50:41+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "3.0.0", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" + "reference": "df80c875d3e459b45c6039e4d9b71d4fbccae25d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", - "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/df80c875d3e459b45c6039e4d9b71d4fbccae25d", + "reference": "df80c875d3e459b45c6039e4d9b71d4fbccae25d", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -964,7 +975,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.0" }, "funding": [ { @@ -972,36 +984,36 @@ "type": "github" } ], - "time": "2023-02-03T06:59:15+00:00" + "time": "2024-02-02T05:52:17+00:00" }, { "name": "sebastian/comparator", - "version": "5.0.1", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2db5010a484d53ebf536087a70b4a5423c102372" + "reference": "bd0f2fa5b9257c69903537b266ccb80fcf940db8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", - "reference": "2db5010a484d53ebf536087a70b4a5423c102372", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/bd0f2fa5b9257c69903537b266ccb80fcf940db8", + "reference": "bd0f2fa5b9257c69903537b266ccb80fcf940db8", "shasum": "" }, "require": { "ext-dom": "*", "ext-mbstring": "*", - "php": ">=8.1", - "sebastian/diff": "^5.0", - "sebastian/exporter": "^5.0" + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^10.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1041,7 +1053,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/comparator/tree/6.0.0" }, "funding": [ { @@ -1049,33 +1061,33 @@ "type": "github" } ], - "time": "2023-08-14T13:18:12+00:00" + "time": "2024-02-02T05:53:45+00:00" }, { "name": "sebastian/complexity", - "version": "3.0.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "c70b73893e10757af9c6a48929fa6a333b56a97a" + "reference": "88a434ad86150e11a606ac4866b09130712671f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/c70b73893e10757af9c6a48929fa6a333b56a97a", - "reference": "c70b73893e10757af9c6a48929fa6a333b56a97a", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/88a434ad86150e11a606ac4866b09130712671f0", + "reference": "88a434ad86150e11a606ac4866b09130712671f0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.10", - "php": ">=8.1" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1099,7 +1111,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.0" }, "funding": [ { @@ -1107,33 +1119,33 @@ "type": "github" } ], - "time": "2023-08-31T09:55:53+00:00" + "time": "2024-02-02T05:55:19+00:00" }, { "name": "sebastian/diff", - "version": "5.0.3", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b" + "reference": "ab83243ecc233de5655b76f577711de9f842e712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b", - "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ab83243ecc233de5655b76f577711de9f842e712", + "reference": "ab83243ecc233de5655b76f577711de9f842e712", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0", + "phpunit/phpunit": "^11.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1166,7 +1178,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.1" }, "funding": [ { @@ -1174,27 +1186,27 @@ "type": "github" } ], - "time": "2023-05-01T07:48:21+00:00" + "time": "2024-03-02T07:30:33+00:00" }, { "name": "sebastian/environment", - "version": "6.0.1", + "version": "7.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951" + "reference": "4eb3a442574d0e9d141aab209cd4aaf25701b09a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/43c751b41d74f96cbbd4e07b7aec9675651e2951", - "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4eb3a442574d0e9d141aab209cd4aaf25701b09a", + "reference": "4eb3a442574d0e9d141aab209cd4aaf25701b09a", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-posix": "*" @@ -1202,7 +1214,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "7.1-dev" } }, "autoload": { @@ -1230,7 +1242,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/6.0.1" + "source": "https://github.com/sebastianbergmann/environment/tree/7.1.0" }, "funding": [ { @@ -1238,34 +1250,34 @@ "type": "github" } ], - "time": "2023-04-11T05:39:26+00:00" + "time": "2024-03-23T08:56:34+00:00" }, { "name": "sebastian/exporter", - "version": "5.1.0", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344" + "reference": "f291e5a317c321c0381fa9ecc796fa2d21b186da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c3fa8483f9539b190f7cd4bfc4a07631dd1df344", - "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f291e5a317c321c0381fa9ecc796fa2d21b186da", + "reference": "f291e5a317c321c0381fa9ecc796fa2d21b186da", "shasum": "" }, "require": { "ext-mbstring": "*", - "php": ">=8.1", - "sebastian/recursion-context": "^5.0" + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1308,7 +1320,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.0" + "source": "https://github.com/sebastianbergmann/exporter/tree/6.0.1" }, "funding": [ { @@ -1316,35 +1328,35 @@ "type": "github" } ], - "time": "2023-09-18T07:15:37+00:00" + "time": "2024-03-02T07:28:20+00:00" }, { "name": "sebastian/global-state", - "version": "6.0.1", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4" + "reference": "c3a307e832f2e69c7ef869e31fc644fde0e7cb3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/7ea9ead78f6d380d2a667864c132c2f7b83055e4", - "reference": "7ea9ead78f6d380d2a667864c132c2f7b83055e4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c3a307e832f2e69c7ef869e31fc644fde0e7cb3e", + "reference": "c3a307e832f2e69c7ef869e31fc644fde0e7cb3e", "shasum": "" }, "require": { - "php": ">=8.1", - "sebastian/object-reflector": "^3.0", - "sebastian/recursion-context": "^5.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1363,14 +1375,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", "security": "https://github.com/sebastianbergmann/global-state/security/policy", - "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.1" + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.1" }, "funding": [ { @@ -1378,33 +1390,33 @@ "type": "github" } ], - "time": "2023-07-19T07:19:23+00:00" + "time": "2024-03-02T07:32:10+00:00" }, { "name": "sebastian/lines-of-code", - "version": "2.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d" + "reference": "376c5b3f6b43c78fdc049740bca76a7c846706c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/649e40d279e243d985aa8fb6e74dd5bb28dc185d", - "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/376c5b3f6b43c78fdc049740bca76a7c846706c0", + "reference": "376c5b3f6b43c78fdc049740bca76a7c846706c0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.10", - "php": ">=8.1" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1428,7 +1440,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.1" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.0" }, "funding": [ { @@ -1436,34 +1448,34 @@ "type": "github" } ], - "time": "2023-08-31T09:25:50+00:00" + "time": "2024-02-02T06:00:36+00:00" }, { "name": "sebastian/object-enumerator", - "version": "5.0.0", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" + "reference": "f75f6c460da0bbd9668f43a3dde0ec0ba7faa678" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", - "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f75f6c460da0bbd9668f43a3dde0ec0ba7faa678", + "reference": "f75f6c460da0bbd9668f43a3dde0ec0ba7faa678", "shasum": "" }, "require": { - "php": ">=8.1", - "sebastian/object-reflector": "^3.0", - "sebastian/recursion-context": "^5.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1485,7 +1497,8 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.0" }, "funding": [ { @@ -1493,32 +1506,32 @@ "type": "github" } ], - "time": "2023-02-03T07:08:32+00:00" + "time": "2024-02-02T06:01:29+00:00" }, { "name": "sebastian/object-reflector", - "version": "3.0.0", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" + "reference": "bb2a6255d30853425fd38f032eb64ced9f7f132d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", - "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/bb2a6255d30853425fd38f032eb64ced9f7f132d", + "reference": "bb2a6255d30853425fd38f032eb64ced9f7f132d", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1540,7 +1553,8 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.0" }, "funding": [ { @@ -1548,32 +1562,32 @@ "type": "github" } ], - "time": "2023-02-03T07:06:18+00:00" + "time": "2024-02-02T06:02:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "5.0.0", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "05909fb5bc7df4c52992396d0116aed689f93712" + "reference": "b75224967b5a466925c6d54e68edd0edf8dd4ed4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", - "reference": "05909fb5bc7df4c52992396d0116aed689f93712", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b75224967b5a466925c6d54e68edd0edf8dd4ed4", + "reference": "b75224967b5a466925c6d54e68edd0edf8dd4ed4", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1603,7 +1617,8 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.0" }, "funding": [ { @@ -1611,32 +1626,32 @@ "type": "github" } ], - "time": "2023-02-03T07:05:40+00:00" + "time": "2024-02-02T06:08:48+00:00" }, { "name": "sebastian/type", - "version": "4.0.0", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" + "reference": "b8502785eb3523ca0dd4afe9ca62235590020f3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", - "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8502785eb3523ca0dd4afe9ca62235590020f3f", + "reference": "b8502785eb3523ca0dd4afe9ca62235590020f3f", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^10.0" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1659,7 +1674,8 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/5.0.0" }, "funding": [ { @@ -1667,29 +1683,29 @@ "type": "github" } ], - "time": "2023-02-03T07:10:45+00:00" + "time": "2024-02-02T06:09:34+00:00" }, { "name": "sebastian/version", - "version": "4.0.1", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" + "reference": "13999475d2cb1ab33cb73403ba356a814fdbb001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", - "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/13999475d2cb1ab33cb73403ba356a814fdbb001", + "reference": "13999475d2cb1ab33cb73403ba356a814fdbb001", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1712,7 +1728,8 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/5.0.0" }, "funding": [ { @@ -1720,19 +1737,19 @@ "type": "github" } ], - "time": "2023-02-07T11:34:05+00:00" + "time": "2024-02-02T06:10:47+00:00" }, { "name": "squizlabs/php_codesniffer", "version": "3.6.2", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", "shasum": "" }, @@ -1776,20 +1793,34 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], "time": "2021-12-12T21:44:58+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -1818,7 +1849,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -1826,7 +1857,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2024-03-03T12:36:25+00:00" } ], "aliases": [], @@ -1835,8 +1866,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=8.2" + "php": ">=8.3" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/src/Parser.php b/src/Parser.php index 8e1126c6..592aa48e 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -21,6 +21,12 @@ namespace Gedcom; +/** + * Parser class for GEDCOM files. + * + * Implements the ParserInterface to provide methods for parsing GEDCOM files, navigating through the file, + * and extracting data according to the GEDCOM standard. + */ class Parser implements \Gedcom\Parser\Interfaces\ParserInterface { protected $_file; @@ -39,20 +45,27 @@ class Parser implements \Gedcom\Parser\Interfaces\ParserInterface protected $_returnedLine = ''; + /** + * Constructs a Parser instance. + * + * Initializes a new Parser object, optionally with a pre-existing Gedcom object. + * + * @param Gedcom|null $gedcom An optional Gedcom object to use. + */ public function __construct(Gedcom $gedcom = null) { $this->_gedcom = is_null($gedcom) ? new Gedcom() : $gedcom; } + /** + * Advances the parser to the next line in the GEDCOM file. + * + * If a line was previously returned by the back() method, it sets that as the current line. Otherwise, + * it reads the next line from the file. + * + * @return $this The instance of the Parser for method chaining. + */ public function forward() -/** - * Constructs a Parser instance. - * - * Initializes a new Parser object, optionally with a pre-existing Gedcom object. - * - * @param Gedcom|null $gedcom An optional Gedcom object to use. - */ -use Gedcom\Parser\Interfaces\ParserInterface; { // if there was a returned line by back(), set that as our current // line and blank out the returnedLine variable, otherwise grab @@ -70,21 +83,14 @@ public function forward() return $this; } + /** + * Moves the parser back to the previously read line. + * + * Stores the current line for the previous parser to analyze, effectively moving the parser's position back. + * + * @return $this The instance of the Parser for method chaining. + */ public function back() - { -/** - * Parser class for GEDCOM files. - * - * Implements the ParserInterface to provide methods for parsing GEDCOM files, navigating through the file, - * and extracting data according to the GEDCOM standard. - */ - * Advances the parser to the next line in the GEDCOM file. - * - * If a line was previously returned by the back() method, it sets that as the current line. Otherwise, - * it reads the next line from the file. - * - * @return $this The instance of the Parser for method chaining. - */ { // our parser object encountered a line it wasn't meant to parse // store this line for the previous parser to analyze @@ -94,20 +100,16 @@ public function back() return $this; } + /** - * Jump to the next level in the GEDCOM that is <= $level. This will leave the parser at the line above - * this level, such that calling $parser->forward() will result in landing at the correct level. + * Skips to the next level in the GEDCOM file that is less than or equal to the specified level. * - * @param int $level + * This method leaves the parser at the line above the specified level, such that calling forward() will + * result in landing at the correct level. + * + * @param int $level The level to skip to. */ public function skipToNextLevel($level) -/** - * Moves the parser back to the previously read line. - * - * Stores the current line for the previous parser to analyze, effectively moving the parser's position back. - * - * @return $this The instance of the Parser for method chaining. - */ { $currentDepth = 999; @@ -120,38 +122,34 @@ public function skipToNextLevel($level) $this->back(); } + /** + * Retrieves the Gedcom object associated with this parser. + * + * @return Gedcom The Gedcom object being parsed. + */ public function getGedcom() { return $this->_gedcom; } + /** + * Checks if the end of the GEDCOM file has been reached. + * + * @return bool True if the end of the file has been reached, false otherwise. + */ public function eof() { return feof($this->_file); } /** - * @return string + * Parses a multi-line record from the GEDCOM file. + * + * This method handles records that span multiple lines, aggregating the data according to the GEDCOM standard. + * + * @return string The aggregated data from the multi-line record. */ public function parseMultiLineRecord() -/** - * Skips to the next level in the GEDCOM file that is less than or equal to the specified level. - * - * This method leaves the parser at the line above the specified level, such that calling forward() will - * result in landing at the correct level. - * - * @param int $level The level to skip to. - */ -/** - * Retrieves the Gedcom object associated with this parser. - * - * @return Gedcom The Gedcom object being parsed. - */ -/** - * Checks if the end of the GEDCOM file has been reached. - * - * @return bool True if the end of the file has been reached, false otherwise. - */ { $record = $this->getCurrentLineRecord(); @@ -171,62 +169,56 @@ public function parseMultiLineRecord() } switch ($recordType) { -/** - * Parses a multi-line record from the GEDCOM file. - * - * This method handles records that span multiple lines, aggregating the data according to the GEDCOM standard. - * - * @return string The aggregated data from the multi-line record. - */ - case 'DATA': - $dataInstance = new \Gedcom\Record\Data(); - $this->forward(); - - while (!$this->eof()) { - $record = $this->getCurrentLineRecord(); - $recordTypeData = strtoupper(trim((string) $record[1])); - $dataDepth = (int) $record[0]; - - if ($dataDepth <= $currentDepth) { - $this->back(); - break; - } - switch ($recordTypeData) { - case 'TEXT': - $textData = isset($record[2]) ? trim((string) $record[2]) : ''; - $dataInstance->setText($textData); - break; - case 'CONT': - $contData = isset($record[2]) ? "\n" + trim((string) $record[2]) : "\n"; - $dataInstance->setText($dataInstance->getText() + $contData); - break; - default: + case 'DATA': + $dataInstance = new \Gedcom\Record\Data(); + $this->forward(); + + while (!$this->eof()) { + $record = $this->getCurrentLineRecord(); + $recordTypeData = strtoupper(trim((string) $record[1])); + $dataDepth = (int) $record[0]; + + if ($dataDepth <= $currentDepth) { $this->back(); - break 2; + break; + } + + switch ($recordTypeData) { + case 'TEXT': + $textData = isset($record[2]) ? trim((string) $record[2]) : ''; + $dataInstance->setText($textData); + break; + case 'CONT': + $contData = isset($record[2]) ? "\n" + trim((string) $record[2]) : "\n"; + $dataInstance->setText($dataInstance->getText() + $contData); + break; + default: + $this->back(); + break 2; + } + + $this->forward(); } - $this->forward(); - } - - // Logic to associate $dataInstance with its parent object goes here + // Logic to associate $dataInstance with its parent object goes here - break; - case 'CONT': - $data .= "\n"; + break; + case 'CONT': + $data .= "\n"; - if (isset($record[2])) { - $data .= trim((string) $record[2]); - } - break; - case 'CONC': - if (isset($record[2])) { - $data .= ' '.trim((string) $record[2]); - } - break; - default: - $this->back(); - break 2; + if (isset($record[2])) { + $data .= trim((string) $record[2]); + } + break; + case 'CONC': + if (isset($record[2])) { + $data .= ' ' . trim((string) $record[2]); + } + break; + default: + $this->back(); + break 2; } $this->forward(); @@ -236,13 +228,23 @@ public function parseMultiLineRecord() } /** - * @return string The current line + * Retrieves the current line from the GEDCOM file. + * + * @return string The current line being parsed. */ public function getCurrentLine() { return $this->_line; } + /** + * Splits the current line into record components. + * + * This method splits the current line based on the specified number of pieces, caching the result for efficiency. + * + * @param int $pieces The number of pieces to split the line into. + * @return array|false The split line as an array of components, or false if the line is empty. + */ public function getCurrentLineRecord($pieces = 3) { if (!is_null($this->_lineRecord) && $this->_linePieces == $pieces) { @@ -261,72 +263,65 @@ public function getCurrentLineRecord($pieces = 3) return $this->_lineRecord; } + /** + * Logs an error encountered during parsing. + * + * This method adds an error message to the internal log for later retrieval. + * + * @param string $error The error message to log. + */ protected function logError($error) { $this->_errorLog[] = $error; } + /** + * Logs an unhandled record encountered during parsing. + * + * This method logs a record that could not be handled, along with optional additional information. + * + * @param string $additionalInfo Optional additional information about the unhandled record. + */ public function logUnhandledRecord($additionalInfo = '') -/** - * Retrieves the current line from the GEDCOM file. - * - * @return string The current line being parsed. - */ -/** - * Splits the current line into record components. - * - * This method splits the current line based on the specified number of pieces, caching the result for efficiency. - * - * @param int $pieces The number of pieces to split the line into. - * @return array|false The split line as an array of components, or false if the line is empty. - */ { $this->logError( - $this->_linesParsed.': (Unhandled) '.trim(implode('|', $this->getCurrentLineRecord())). - (empty($additionalInfo) ? '' : ' - '.$additionalInfo) + $this->_linesParsed . ': (Unhandled) ' . trim(implode('|', $this->getCurrentLineRecord())) . + (empty($additionalInfo) ? '' : ' - ' . $additionalInfo) ); } + /** + * Logs a record that was skipped during parsing. + * + * This method logs a record that was intentionally skipped, along with optional additional information. + * + * @param string $additionalInfo Optional additional information about the skipped record. + */ public function logSkippedRecord($additionalInfo = '') { $this->logError( - $this->_linesParsed.': (Skipping) '.trim(implode('|', $this->getCurrentLineRecord())). - (empty($additionalInfo) ? '' : ' - '.$additionalInfo) + $this->_linesParsed . ': (Skipping) ' . trim(implode('|', $this->getCurrentLineRecord())) . + (empty($additionalInfo) ? '' : ' - ' . $additionalInfo) ); } + /** + * Retrieves the list of errors logged during parsing. + * + * @return array An array of error messages logged during parsing. + */ public function getErrors() { return $this->_errorLog; } + /** + * Normalizes an identifier by trimming whitespace and '@' characters. + * + * @param string $identifier The identifier to normalize. + * @return string The normalized identifier. + */ public function normalizeIdentifier($identifier) -/** - * Logs an error encountered during parsing. - * - * This method adds an error message to the internal log for later retrieval. - * - * @param string $error The error message to log. - */ -/** - * Logs an unhandled record encountered during parsing. - * - * This method logs a record that could not be handled, along with optional additional information. - * - * @param string $additionalInfo Optional additional information about the unhandled record. - */ -/** - * Logs a record that was skipped during parsing. - * - * This method logs a record that was intentionally skipped, along with optional additional information. - * - * @param string $additionalInfo Optional additional information about the skipped record. - */ -/** - * Retrieves the list of errors logged during parsing. - * - * @return array An array of error messages logged during parsing. - */ { $identifier = trim((string) $identifier); @@ -334,9 +329,12 @@ public function normalizeIdentifier($identifier) } /** - * @param string $fileName + * Parses a GEDCOM file. + * + * Opens and reads a GEDCOM file, parsing its contents and populating the Gedcom object. * - * @return Gedcom + * @param string $fileName The path to the GEDCOM file to parse. + * @return Gedcom|null The Gedcom object populated with data from the file, or null on failure. */ public function parse($fileName) { @@ -349,20 +347,7 @@ public function parse($fileName) $this->forward(); while (!$this->eof()) { -/** - * Normalizes an identifier by trimming whitespace and '@' characters. - * - * @param string $identifier The identifier to normalize. - * @return string The normalized identifier. - */ -/** - * Parses a GEDCOM file. - * - * Opens and reads a GEDCOM file, parsing its contents and populating the Gedcom object. - * - * @param string $fileName The path to the GEDCOM file to parse. - * @return Gedcom|null The Gedcom object populated with data from the file, or null on failure. - */ + $record = $this->getCurrentLineRecord(); if ($record === false) { @@ -402,10 +387,10 @@ public function parse($fileName) // EOF break; } else { - $this->logUnhandledRecord(self::class.' @ '.__LINE__); + $this->logUnhandledRecord(self::class . ' @ ' . __LINE__); } } else { - $this->logUnhandledRecord(self::class.' @ '.__LINE__); + $this->logUnhandledRecord(self::class . ' @ ' . __LINE__); } $this->forward(); diff --git a/src/Parser/Interfaces/ParserInterface.php b/src/Parser/Interfaces/ParserInterface.php index 71f807bd..348d6470 100644 --- a/src/Parser/Interfaces/ParserInterface.php +++ b/src/Parser/Interfaces/ParserInterface.php @@ -1,7 +1,9 @@ -<?php +getHead(); $subn = $gedcom->getSubn(); @@ -108,15 +47,27 @@ protected static function convertHead($head, string $format, string $formatInfor $formatInformation = FormatInformation::addFormatInformation($format); $output .= self::convertHead($head, $format, $formatInformation); - // subn - $output .= { + $output .= self::convertSubn($subn); + $output .= self::convertSubms($subms); + $output .= self::convertSours($sours); + $output .= self::convertIndis($indis); + $output .= self::convertFams($fams); + $output .= self::convertNotes($notes); + $output .= self::convertRepos($repos); + $output .= self::convertObjes($objes); + + // EOF + $output .= "0 TRLR\n"; + + return $output; + + } + /** - * Convert head section of GEDCOM. + * @param $gedcom The GEDCOM object + * @param string $format The format to convert the GEDCOM object to * - * @param mixed $head - * @param string $format - * @param string $formatInformation - * @return string + * @return string The contents of the document in the converted format */ protected static function convertHead($head, string $format, string $formatInformation): string { @@ -126,11 +77,7 @@ protected static function convertHead($head, string $format, string $formatInfor } return $output; } - $output .= self::convertSubms($subms); - $output .= self::convertSours($sours); - // indis - if (!empty($indis) && $indis !== []) { protected static function convertSubn($subn): string { $output = ''; @@ -161,9 +108,7 @@ protected static function convertSours(array $sours): string } return $output; } - $output .= self::convertFams($fams); - // notes - if (!empty($notes) && $notes !== []) { + protected static function convertIndis(array $indis): string { $output = ''; @@ -189,11 +134,8 @@ protected static function convertFams(array $fams): string } return $output; } - $output .= self::convertNotes($notes); - $output .= self::convertRepos($repos); - $output .= self::convertRepos($repos); -} -} + + protected static function convertNotes(array $notes): string { $output = ''; @@ -226,3 +168,4 @@ protected static function convertObjes(array $objes): string } return $output; } +} diff --git a/tests/ParserTest.php b/tests/ParserTest.php index ee99ec15..f79493cf 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -31,7 +31,7 @@ public function testParseWithNonEmptyNamesArray() $this->assertNotEmpty($output); $this->assertStringContainsString('I1: Doe, John', $output); } -} + private function generateOutputFromParsedGedcom($gedcomFileName) { $parser = new Parser(); @@ -50,3 +50,4 @@ private function generateOutputFromParsedGedcom($gedcomFileName) return $output; } +} \ No newline at end of file diff --git a/tests/WriterTest.php b/tests/WriterTest.php index f9f1ef66..72e7c3af 100644 --- a/tests/WriterTest.php +++ b/tests/WriterTest.php @@ -9,8 +9,9 @@ class WriterTest extends TestCase { - public function testConvertWithMultipleFamProperties() { - private function createMockGedcom($properties = []) { + + private function createMockGedcom($properties = []) + { $gedcom = $this->createMock(Gedcom::class); foreach ($properties as $property => $mock) { $gedcom->expects($this->once()) @@ -20,114 +21,114 @@ private function createMockGedcom($properties = []) { return $gedcom; } - private function assertConvertOutput($output, $expected) { + private function assertConvertOutput($output, $expected) + { $this->assertEquals($expected, $output); } - $gedcom = $this->createMockGedcom(['Fam' => [$fam1, $fam2]]); + + public function testConvert() + { + $gedcom = $this->createMockGedcom(); $output = Writer::convert($gedcom); $this->assertConvertOutput($output, 'expected_output'); // Add assertions for the basic functionality of the convert method - // ... + } + + public function testConvertWithMultipleFamProperties() { - $gedcom = $this->createMockGedcom(); + + $gedcom = $this->createMockGedcom(['Fam' => [$fam1, $fam2]]); $output = Writer::convert($gedcom); $this->assertConvertOutput($output, 'expected_output'); // Add assertions for the basic functionality of the convert method - // ... + } public function testConvertWithCustomFormat() { $gedcom = $this->createMockGedcom(); $output = Writer::convert($gedcom, 'custom_format'); - $this->assertConvertOutput($output, 'expected_output'); - { - $sour1 = $this->createMock(Sour::class); - $sour2 = $this->createMock(Sour::class); - $gedcom = $this->createMockGedcom(['Sour' => [$sour1, $sour2]]); - $output = Writer::convert($gedcom); - $this->assertConvertOutput($output, 'expected_output'); + $this->assertConvertOutput($output, 'expected_output'); { + $sour1 = $this->createMock(Sour::class); + $sour2 = $this->createMock(Sour::class); + $gedcom = $this->createMockGedcom(['Sour' => [$sour1, $sour2]]); + $output = Writer::convert($gedcom); + $this->assertConvertOutput($output, 'expected_output'); + } } - // Add more test methods to cover different scenarios and edge cases - - // ... - -} public function testConvertWithSubnProperty() { $subn = $this->createMock(Subn::class); $gedcom = $this->createMockGedcom(['Subn' => $subn]); $output = Writer::convert($gedcom); $this->assertConvertOutput($output, 'expected_output'); - + // Assert the correctness of the output $this->assertEquals('expected_output', $output); // Add assertions for the basic functionality of the convert method - // ... + } - public function testConvertWithCustomFormat() - { - // Create a mock Gedcom object - $gedcom = $this->createMock(Gedcom::class); + // public function testConvertWithCustomFormat() + // { + // // Create a mock Gedcom object + // $gedcom = $this->createMock(Gedcom::class); - // Set up expectations for the mock Gedcom object - // ... + // // Set up expectations for the mock Gedcom object - // Call the convert method with a custom format - $output = Writer::convert($gedcom, 'custom_format'); - // Assert the correctness of the output - $this->assertEquals('expected_output', $output); - // Add assertions for the basic functionality of the convert method - // ... - } + // // Call the convert method with a custom format + // $output = Writer::convert($gedcom, 'custom_format'); - public function testConvertWithMultipleNoteProperties() - { - // Create a mock Gedcom object with a Head property - $gedcom = $this->createMock(Gedcom::class); - $head = $this->createMock(Head::class); - $gedcom->expects($this->once()) - ->method('getHead') - ->willReturn($head); + // // Assert the correctness of the output + // $this->assertEquals('expected_output', $output); + // // Add assertions for the basic functionality of the convert method - // Set up expectations for the mock Gedcom object with multiple Repo properties with multiple Repo properties - // ... + // } - // Call the convert method - $output = Writer::convertHeadHead($gedcom); + // public function testConvertWithMultipleNoteProperties() + // { + // // Create a mock Gedcom object with a Head property + // $gedcom = $this->createMock(Gedcom::class); + // $head = $this->createMock(Head::class); + // $gedcom->expects($this->once()) + // ->method('getHead') + // ->willReturn($head); - // Assert the correctness of the output - $this->assertEquals('expected_output', $output); - // Add assertions for the basic functionality of the convert method - // ... - } - // Add more test methods to cover different scenarios and edge cases - // ... + // // Set up expectations for the mock Gedcom object with multiple Repo properties with multiple Repo properties - public function testConvertWithMultipleNoteProperties() - { - // Create a mock Gedcom object with multiple Note properties - $gedcom = $this->createMock(Gedcom::class); - $head = $this->createMock(Head::class); - $gedcom->expects($this->once()) - ->method('getHead') - ->willReturn([$note1, $note2]); - // Set up expectations for the mock Gedcom object - // ... + // // Call the convert method + // $output = Writer::convertHeadHead($gedcom); - // Call the convert method - $output = Writer::convert($gedcom); + // // Assert the correctness of the output + // $this->assertEquals('expected_output', $output); + // // Add assertions for the basic functionality of the convert method + + // } + + // public function testConvertWithMultipleNoteProperties() + // { + // // Create a mock Gedcom object with multiple Note properties + // $gedcom = $this->createMock(Gedcom::class); + // $head = $this->createMock(Head::class); + // $gedcom->expects($this->once()) + // ->method('getHead') + // ->willReturn([$note1, $note2]); + + // // Set up expectations for the mock Gedcom object + + + // // Call the convert method + // $output = Writer::convert($gedcom); + + // // Assert the correctness of the output for multiple Note properties + // $this->assertEquals('expected_output', $output); + // // Add assertions for the basic functionality of the convert method + + // } - // Assert the correctness of the output for multiple Note properties - $this->assertEquals('expected_output', $output); - // Add assertions for the basic functionality of the convert method - // ... - } - // Add more test methods to cover different scenarios and edge cases public function testConvertWithHeadProperty() { // Create a mock Gedcom object with a Head property @@ -138,7 +139,7 @@ public function testConvertWithHeadProperty() ->willReturn($head); // Set up expectations for the mock Gedcom object - // ... + // Call the convert method $output = Writer::convert($gedcom); @@ -146,8 +147,9 @@ public function testConvertWithHeadProperty() // Assert the correctness of the output $this->assertEquals('expected_output', $output); // Add assertions for the basic functionality of the convert method - // ... + } + public function testSourConvert() { // Test case with title and multiple notes @@ -172,3 +174,4 @@ public function testSourConvert() // Add more test cases as needed to cover different scenarios and edge cases } +} diff --git a/tests/issue/Issue00012Test.php b/tests/issue/Issue00012Test.php index c741bc30..bac4f150 100644 --- a/tests/issue/Issue00012Test.php +++ b/tests/issue/Issue00012Test.php @@ -7,7 +7,7 @@ /** * Class Issue00012Test. */ -class Issue00012Test extends \PHPUnit_Framework_TestCase +class Issue00012Test extends \PHPUnit\Framework\TestCase { public function testBirthDate() { diff --git a/tests/issue/Issue00017Test.php b/tests/issue/Issue00017Test.php index afea316f..d2e4b21f 100644 --- a/tests/issue/Issue00017Test.php +++ b/tests/issue/Issue00017Test.php @@ -7,7 +7,7 @@ /** * Class Issue00017Test. */ -class Issue00017Test extends \PHPUnit_Framework_TestCase +class Issue00017Test extends \PHPUnit\Framework\TestCase { /** * Test an empty 1 FAMC under an INDI. diff --git a/tests/issue/Issue00018Test.php b/tests/issue/Issue00018Test.php index 3e9c0b60..68997a1b 100644 --- a/tests/issue/Issue00018Test.php +++ b/tests/issue/Issue00018Test.php @@ -7,7 +7,7 @@ /** * Class Issue00018Test. */ -class Issue00018Test extends \PHPUnit_Framework_TestCase +class Issue00018Test extends \PHPUnit\Framework\TestCase { /** * Test handling an empty note. diff --git a/tests/library/Gedcom/GedcomTest.php b/tests/library/Gedcom/GedcomTest.php index fe521f80..6c0c7880 100644 --- a/tests/library/Gedcom/GedcomTest.php +++ b/tests/library/Gedcom/GedcomTest.php @@ -1,4 +1,4 @@ -<?php +parser = new Parser(); - $this->gedcom = $this->parser->parse(TEST_DIR.'/stresstestfiles/TGC551LF.ged'); + $this->gedcom = $this->parser->parse(TEST_DIR . '/stresstestfiles/TGC551LF.ged'); } public function testNoErrors() @@ -63,80 +64,8 @@ public function testHead() $this->assertEquals( $head->getSour()->getCorp()->getAddr()->getAddr(), "7108 South Pine Cone Street\nSalt Lake City, UT 84121\nUSA" -use PHPUnit\Framework\TestCase; - -class ParserTest extends TestCase -{ - protected $parser; - protected $gedcom; - - protected function setUp(): void - { - parent::setUp(); - $this->parser = new \Gedcom\Parser(); - } - public function testParseValidFile() - { - $this->gedcom = $this->parser->parse(TEST_DIR.'/validFiles/validTest.ged'); - $this->assertNotNull($this->gedcom, 'Gedcom object should not be null for a valid file.'); - } - - public function testParseInvalidFile() - { - $this->expectException(\Exception::class); - $this->parser->parse(TEST_DIR.'/invalidFiles/invalidTest.ged'); - } - public function testForwardFunctionality() - { - $this->parser->parse(TEST_DIR.'/validFiles/forwardTest.ged'); - $this->assertEquals('2 INDI', trim($this->parser->forward()->getCurrentLine()), 'Forward method should move to the next line.'); - } - - public function testBackFunctionality() - { - $this->parser->parse(TEST_DIR.'/validFiles/backTest.ged'); - $this->parser->forward(); // Move forward to allow back to work - $this->assertEquals('0 HEAD', trim($this->parser->back()->getCurrentLine()), 'Back method should revert to the previous line.'); - } - - public function testSkipToNextLevelFunctionality() - { - $this->parser->parse(TEST_DIR.'/validFiles/skipToNextLevelTest.ged'); - $this->parser->skipToNextLevel(1); - $this->assertStringContainsString('1 BIRT', $this->parser->forward()->getCurrentLine(), 'SkipToNextLevel should skip to the specified level.'); - } - - public function testParseMultiLineRecord() - { - $this->parser->parse(TEST_DIR.'/validFiles/multiLineRecordTest.ged'); - $data = $this->parser->parseMultiLineRecord(); - $this->assertStringContainsString('Lorem ipsum dolor sit amet', $data, 'parseMultiLineRecord should correctly parse multi-line records.'); - } - - public function testEofFunctionality() - { - $this->parser->parse(TEST_DIR.'/validFiles/eofTest.ged'); - while (!$this->parser->eof()) { - $this->parser->forward(); - } - $this->assertTrue($this->parser->eof(), 'EOF should be true after reading the last line of the file.'); - } - - public function testErrorLogging() - { - $this->parser->parse(TEST_DIR.'/validFiles/errorLoggingTest.ged'); - $errors = $this->parser->getErrors(); - $this->assertNotEmpty($errors, 'Errors should be logged during parsing.'); - } - - public function testNormalizeIdentifier() - { - $normalized = $this->parser->normalizeIdentifier('@I1@'); - $this->assertEquals('I1', $normalized, 'normalizeIdentifier should remove @ characters.'); - } -} ); $this->assertEquals($head->getSour()->getCorp()->getAddr()->getCity(), 'Salt Lake City'); $this->assertEquals($head->getSour()->getCorp()->getAddr()->getStae(), 'UT'); @@ -197,10 +126,10 @@ public function testSubm() $this->assertEquals($subm['SUBMITTER']->getName(), 'John A. Nairn'); $this->assertEquals( $subm['SUBMITTER']->getAddr()->getAddr(), - "Submitter address line 1\n". - "Submitter address line 2\n". - "Submitter address line 3\n". - 'Submitter address line 4' + "Submitter address line 1\n" . + "Submitter address line 2\n" . + "Submitter address line 3\n" . + 'Submitter address line 4' ); $this->assertEquals($subm['SUBMITTER']->getAddr()->getAdr1(), 'Submitter address line 1'); @@ -234,8 +163,8 @@ public function testSubm() $this->assertEquals($subm['SM2']->getName(), 'Secondary Submitter'); $this->assertEquals( $subm['SM2']->getAddr()->getAddr(), - "Secondary Submitter Address 1\n". - 'Secondary Submitter Address 2' + "Secondary Submitter Address 1\n" . + 'Secondary Submitter Address 2' ); $lang = $subm['SM2']->getLang(); @@ -248,8 +177,8 @@ public function testSubm() $this->assertEquals($subm['SM3']->getName(), 'H. Eichmann'); $this->assertEquals( $subm['SM3']->getAddr()->getAddr(), - "email: h.eichmann@@mbox.iqo.uni-hannover.de\n". - 'or: heiner_eichmann@@h.maus.de (no more than 16k!!!!)' + "email: h.eichmann@@mbox.iqo.uni-hannover.de\n" . + 'or: heiner_eichmann@@h.maus.de (no more than 16k!!!!)' ); $this->assertEquals($subm['SM3']->getChan()->getDate(), '13 Jun 2000'); $this->assertEquals($subm['SM3']->getChan()->getTime(), '17:07:32'); @@ -299,4 +228,67 @@ public function testNote() $this->assertEquals($firstNote->getChan()->getDate(), '24 May 1999'); $this->assertEquals($firstNote->getChan()->getTime(), '16:39:55'); } + + + + public function testParseValidFile() + { + $this->gedcom = $this->parser->parse(TEST_DIR . '/validFiles/validTest.ged'); + $this->assertNotNull($this->gedcom, 'Gedcom object should not be null for a valid file.'); + } + + public function testParseInvalidFile() + { + $this->expectException(\Exception::class); + $this->parser->parse(TEST_DIR . '/invalidFiles/invalidTest.ged'); + } + + public function testForwardFunctionality() + { + $this->parser->parse(TEST_DIR . '/validFiles/forwardTest.ged'); + $this->assertEquals('2 INDI', trim($this->parser->forward()->getCurrentLine()), 'Forward method should move to the next line.'); + } + + public function testBackFunctionality() + { + $this->parser->parse(TEST_DIR . '/validFiles/backTest.ged'); + $this->parser->forward(); // Move forward to allow back to work + $this->assertEquals('0 HEAD', trim($this->parser->back()->getCurrentLine()), 'Back method should revert to the previous line.'); + } + + public function testSkipToNextLevelFunctionality() + { + $this->parser->parse(TEST_DIR . '/validFiles/skipToNextLevelTest.ged'); + $this->parser->skipToNextLevel(1); + $this->assertStringContainsString('1 BIRT', $this->parser->forward()->getCurrentLine(), 'SkipToNextLevel should skip to the specified level.'); + } + + public function testParseMultiLineRecord() + { + $this->parser->parse(TEST_DIR . '/validFiles/multiLineRecordTest.ged'); + $data = $this->parser->parseMultiLineRecord(); + $this->assertStringContainsString('Lorem ipsum dolor sit amet', $data, 'parseMultiLineRecord should correctly parse multi-line records.'); + } + + public function testEofFunctionality() + { + $this->parser->parse(TEST_DIR . '/validFiles/eofTest.ged'); + while (!$this->parser->eof()) { + $this->parser->forward(); + } + $this->assertTrue($this->parser->eof(), 'EOF should be true after reading the last line of the file.'); + } + + public function testErrorLogging() + { + $this->parser->parse(TEST_DIR . '/validFiles/errorLoggingTest.ged'); + $errors = $this->parser->getErrors(); + $this->assertNotEmpty($errors, 'Errors should be logged during parsing.'); + } + + public function testNormalizeIdentifier() + { + $normalized = $this->parser->normalizeIdentifier('@I1@'); + $this->assertEquals('I1', $normalized, 'normalizeIdentifier should remove @ characters.'); + } } From b41b8257e4c7fc27adb690d9259a967ee435f1ad Mon Sep 17 00:00:00 2001 From: Joshua Kisb Date: Sat, 11 May 2024 17:13:22 +0300 Subject: [PATCH 2/3] more bug fixes --- src/Models/RecordInterface.php | 45 +++++++------- src/Parser.php | 3 +- src/Parser/Indi.php | 4 ++ src/Parser/Indi/Lds.php | 2 +- src/Record.php | 106 ++++++++++++++------------------- tests/ParserTest.php | 2 +- 6 files changed, 78 insertions(+), 84 deletions(-) diff --git a/src/Models/RecordInterface.php b/src/Models/RecordInterface.php index 47f7ef4e..5a8415d1 100644 --- a/src/Models/RecordInterface.php +++ b/src/Models/RecordInterface.php @@ -1,4 +1,4 @@ -<?php +_file = fopen($fileName, 'r'); //explode("\n", mb_convert_encoding($contents, 'UTF-8')); if (!$this->_file) { + error_log("Failed to open file: ". $fileName); return null; } @@ -355,7 +356,7 @@ public function parse($fileName) } $depth = (int) $record[0]; - + // We only process 0 level records here. Sub levels are processed // in methods for those data types (individuals, sources, etc) diff --git a/src/Parser/Indi.php b/src/Parser/Indi.php index e641f66f..8d5b5e03 100644 --- a/src/Parser/Indi.php +++ b/src/Parser/Indi.php @@ -45,6 +45,8 @@ public static function parse(\Gedcom\Parser $parser) break; } + error_log("RECORD:".$recordType); + if ($recordType == 'BURI') { $a = ''; } @@ -59,6 +61,7 @@ public static function parse(\Gedcom\Parser $parser) case 'NAME': $name = \Gedcom\Parser\Indi\Name::parse($parser); $indi->addName($name); + error_log("NAME:".$name->getName()); break; case 'SEX': $indi->setSex(isset($record[2]) ? trim((string) $record[2]) : ''); @@ -199,6 +202,7 @@ public static function parse(\Gedcom\Parser $parser) $parser->forward(); } + error_log("VAL: ".json_encode($indi->getName())); return $indi; } } diff --git a/src/Parser/Indi/Lds.php b/src/Parser/Indi/Lds.php index 9bcaa804..d9027c82 100644 --- a/src/Parser/Indi/Lds.php +++ b/src/Parser/Indi/Lds.php @@ -21,7 +21,7 @@ public static function parse(\Gedcom\Parser $parser) $record = $parser->getCurrentLineRecord(); $depth = (int) $record[0]; if (isset($record[1])) { - $className = 'GedcomRecordIndi'.ucfirst(strtolower(trim((string) $record[1]))); + $className = '\\Gedcom\\Record\\Indi\\'.ucfirst(strtolower(trim((string) $record[1]))); $lds = new $className(); } else { $parser->skipToNextLevel($depth); diff --git a/src/Record.php b/src/Record.php index f74517ce..4318b6f3 100644 --- a/src/Record.php +++ b/src/Record.php @@ -1,4 +1,5 @@ _id ?? null; } + /** + * Sets the ID of the record. + * + * @param mixed $id The new ID of the record. + */ public function setId($id) { $this->_id = $id; } + /** + * Retrieves the name of the record. + * + * @return string|null The name of the record, or null if not set. + */ public function getName() { return $this->_name ?? null; } - public function setName($name) -/** - * Sets the ID of the record. - * - * @param mixed $id The new ID of the record. - */ -/** - * Retrieves the name of the record. - * - * @return string|null The name of the record, or null if not set. - */ -/** - * Sets the name of the record. - * - * @param string $name The new name of the record. - */ - - public function setId($id) - { - $this->_id = $id; - } - - public function getName() - { - return $this->_name ?? null; - } - + /** + * Sets the name of the record. + * + * @param string $name The new name of the record. + */ public function setName($name) { $this->_name = $name; } -{ + public function __call($method, $args) { if (str_starts_with((string) $method, 'add')) { $arr = strtolower(substr((string) $method, 3)); - if (!property_exists($this, '_'.$arr) || !is_array($this->{'_'.$arr})) { - throw new \Exception('Unknown '.static::class.'::'.$arr); + if (!property_exists($this, '_' . $arr) || !is_array($this->{'_' . $arr})) { + throw new \Exception('Unknown ' . static::class . '::' . $arr); } if (!is_array($args)) { - throw new \Exception('Incorrect arguments to '.$method); + throw new \Exception('Incorrect arguments to ' . $method); } if (!isset($args[0])) { // Argument can be empty since we trim it's value return; - throw new \Exception('Unknown '.static::class.'::'.$arr); + throw new \Exception('Unknown ' . static::class . '::' . $arr); } if (!is_array($args)) { - throw new \Exception('Incorrect arguments to '.$method); + throw new \Exception('Incorrect arguments to ' . $method); } if (!isset($args[0])) { @@ -105,18 +99,18 @@ public function __call($method, $args) // Type safety? } - $this->{'_'.$arr}[] = $args[0]; + $this->{'_' . $arr}[] = $args[0]; return $this; } elseif (str_starts_with((string) $method, 'set')) { $arr = strtolower(substr((string) $method, 3)); - if (!property_exists($this, '_'.$arr)) { - throw new \Exception('Unknown '.static::class.'::'.$arr); + if (!property_exists($this, '_' . $arr)) { + throw new \Exception('Unknown ' . static::class . '::' . $arr); } if (!is_array($args)) { - throw new \Exception('Incorrect arguments to '.$method); + throw new \Exception('Incorrect arguments to ' . $method); } if (!isset($args[0])) { @@ -128,7 +122,7 @@ public function __call($method, $args) // Type safety? } - $this->{'_'.$arr} = $args[0]; + $this->{'_' . $arr} = $args[0]; return $this; } elseif (str_starts_with((string) $method, 'get')) { @@ -137,26 +131,33 @@ public function __call($method, $args) // hotfix getData if ('data' == $arr) { if (!property_exists($this, '_text')) { - throw new \Exception('Unknown '.static::class.'::'.$arr); + throw new \Exception('Unknown ' . static::class . '::' . $arr); } return $this->{'_text'}; } - if (!property_exists($this, '_'.$arr)) { - throw new \Exception('Unknown '.static::class.'::'.$arr); + if (!property_exists($this, '_' . $arr)) { + throw new \Exception('Unknown ' . static::class . '::' . $arr); } - return $this->{'_'.$arr}; + return $this->{'_' . $arr}; } else { - throw new \Exception('Unknown method called: '.$method); + throw new \Exception('Unknown method called: ' . $method); } } + /** + * Magic method to prevent setting of undefined properties. + * + * @param string $var The name of the property being set. + * @param mixed $val The value being assigned to the property. + * @throws \Exception Always thrown to indicate an undefined property. + */ public function __set($var, $val) { // this class does not have any public vars - throw new \Exception('Undefined property '.self::class.'::'.$var); + throw new \Exception('Undefined property ' . self::class . '::' . $var); } /** @@ -169,21 +170,6 @@ public function __set($var, $val) */ public function hasAttribute($var) { - return property_exists($this, '_'.$var) || property_exists($this, $var); + return property_exists($this, '_' . $var) || property_exists($this, $var); } } -/** - * Magic method to prevent setting of undefined properties. - * - * @param string $var The name of the property being set. - * @param mixed $val The value being assigned to the property. - * @throws \Exception Always thrown to indicate an undefined property. - */ -/** - * Checks if this GEDCOM object has the provided attribute. - * - * Determines if the specified attribute exists below the current object in its tree. - * - * @param string $var The name of the attribute. - * @return bool True if this object has the provided attribute, false otherwise. - */ diff --git a/tests/ParserTest.php b/tests/ParserTest.php index f79493cf..c5952e54 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -37,7 +37,7 @@ private function generateOutputFromParsedGedcom($gedcomFileName) $parser = new Parser(); $gedcom = $parser->parse($gedcomFileName); $output = ''; - + error_log(json_encode($gedcom)); ob_start(); foreach ($gedcom->getIndi() as $individual) { $names = $individual->getName(); From 421741c34f05a48a75f9a0fb88fbc8b62108af47 Mon Sep 17 00:00:00 2001 From: Joshua Kisb Date: Sat, 11 May 2024 17:17:26 +0300 Subject: [PATCH 3/3] more bug fixes --- tests/ParserTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ParserTest.php b/tests/ParserTest.php index c5952e54..72c9125d 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -37,7 +37,7 @@ private function generateOutputFromParsedGedcom($gedcomFileName) $parser = new Parser(); $gedcom = $parser->parse($gedcomFileName); $output = ''; - error_log(json_encode($gedcom)); + ob_start(); foreach ($gedcom->getIndi() as $individual) { $names = $individual->getName();