From 1ce300e70b97ac77333dfb63d4be423a01dc3cef Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Wed, 29 Nov 2023 22:32:33 +0100 Subject: [PATCH 01/10] Update phpcr-shell to Symfony 7 --- composer.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 3f81bbc..09a000f 100644 --- a/composer.json +++ b/composer.json @@ -3,15 +3,15 @@ "description": "Shell for PHPCR", "require": { "php": "^8.0", - "symfony/console": "^5.0 || ^6.0", + "symfony/console": "^5.0 || ^6.0 || ^7.0", "jackalope/jackalope": "^1.3.4", "phpcr/phpcr": "^2.1", - "phpcr/phpcr-utils": "^1.2", - "symfony/finder": "^5.0 || ^6.0", - "symfony/serializer": "^5.0 || ^6.0", - "symfony/yaml": "^5.0 || ^6.0", - "symfony/dependency-injection": "^5.0 || ^6.0", - "symfony/expression-language": "^5.0 || ^6.0", + "phpcr/phpcr-utils": "^1.2 || ^2.0", + "symfony/finder": "^5.0 || ^6.0 || ^7.0", + "symfony/serializer": "^5.0 || ^6.0 || ^7.0", + "symfony/yaml": "^5.0 || ^6.0 || ^7.0", + "symfony/dependency-injection": "^5.0 || ^6.0 || ^7.0", + "symfony/expression-language": "^5.0 || ^6.0 || ^7.0", "dantleech/glob-finder": "^1.0" }, "require-dev": { From d97d2b9859a5074c33c0b091c07dbb68b2c804a9 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Thu, 30 Nov 2023 11:41:55 +0100 Subject: [PATCH 02/10] Fix compatibility to NodeNormalizer --- src/PHPCR/Shell/Serializer/NodeNormalizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PHPCR/Shell/Serializer/NodeNormalizer.php b/src/PHPCR/Shell/Serializer/NodeNormalizer.php index 3735feb..2dd3571 100644 --- a/src/PHPCR/Shell/Serializer/NodeNormalizer.php +++ b/src/PHPCR/Shell/Serializer/NodeNormalizer.php @@ -42,7 +42,7 @@ public function getNotes() /** * {@inheritdoc} */ - public function normalize($node, $format = null, array $context = []) + public function normalize($node, $format = null, array $context = []): ArrayObject|array|string|int|float|bool|null { $res = []; From f1737d0a4f9e7438248c6df19ed2b64e40da63a9 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Thu, 30 Nov 2023 11:45:51 +0100 Subject: [PATCH 03/10] Install dev dependencies on 8.2 --- .github/workflows/test-application.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index 5d43b66..bcfd912 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -48,14 +48,17 @@ jobs: - php-version: '8.2' dependencies: highest behat-suite: standalone + composer-stability: 'dev' - php-version: '8.2' dependencies: highest behat-suite: embedded + composer-stability: 'dev' - php-version: '8.2' dependencies: highest behat-suite: cli + composer-stability: 'dev' steps: - name: Checkout project @@ -74,6 +77,10 @@ jobs: php-version: ${{ matrix.php-version }} tools: 'composer:v2' + - name: Set composer stability + if: ${{ matrix.composer-stability }} + run: composer config minimum-stability ${{ matrix.composer-stability }} + - name: Install dependencies with Composer uses: ramsey/composer-install@v2 with: From 382a75494edfc86773061d59a32aab1c995cf440 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Thu, 30 Nov 2023 11:47:46 +0100 Subject: [PATCH 04/10] Fix compatibility to NodeNormalizer supportsNormalization --- src/PHPCR/Shell/Serializer/NodeNormalizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PHPCR/Shell/Serializer/NodeNormalizer.php b/src/PHPCR/Shell/Serializer/NodeNormalizer.php index 2dd3571..be36aa7 100644 --- a/src/PHPCR/Shell/Serializer/NodeNormalizer.php +++ b/src/PHPCR/Shell/Serializer/NodeNormalizer.php @@ -85,7 +85,7 @@ public function normalize($node, $format = null, array $context = []): ArrayObje /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null) + public function supportsNormalization($data, $format = null): bool { return is_object($data) && $data instanceof NodeInterface; } From 57f5bb8067fd6efcf3d6a7a82a341bcc27f6566f Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 19 Feb 2024 18:19:11 +0100 Subject: [PATCH 05/10] Update test matrix --- .github/workflows/test-application.yaml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index bcfd912..dbc478b 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -48,16 +48,28 @@ jobs: - php-version: '8.2' dependencies: highest behat-suite: standalone - composer-stability: 'dev' - php-version: '8.2' dependencies: highest behat-suite: embedded - composer-stability: 'dev' - php-version: '8.2' dependencies: highest behat-suite: cli + + - php-version: '8.3' + dependencies: highest + behat-suite: standalone + composer-stability: 'dev' + + - php-version: '8.3' + dependencies: highest + behat-suite: embedded + composer-stability: 'dev' + + - php-version: '8.3' + dependencies: highest + behat-suite: cli composer-stability: 'dev' steps: From afd82bbbce58afa0c6739766d68b04d26e7ba3a9 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 19 Feb 2024 18:22:14 +0100 Subject: [PATCH 06/10] Add missing context to node normalizer --- src/PHPCR/Shell/Serializer/NodeNormalizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PHPCR/Shell/Serializer/NodeNormalizer.php b/src/PHPCR/Shell/Serializer/NodeNormalizer.php index be36aa7..42acba3 100644 --- a/src/PHPCR/Shell/Serializer/NodeNormalizer.php +++ b/src/PHPCR/Shell/Serializer/NodeNormalizer.php @@ -85,7 +85,7 @@ public function normalize($node, $format = null, array $context = []): ArrayObje /** * {@inheritdoc} */ - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data instanceof NodeInterface; } From 0f9adaa9434c1e5422ecd50a6a45e024c10ad082 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 19 Feb 2024 18:24:04 +0100 Subject: [PATCH 07/10] Fix return type of denormalize --- src/PHPCR/Shell/Serializer/NodeNormalizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PHPCR/Shell/Serializer/NodeNormalizer.php b/src/PHPCR/Shell/Serializer/NodeNormalizer.php index 42acba3..6a864d3 100644 --- a/src/PHPCR/Shell/Serializer/NodeNormalizer.php +++ b/src/PHPCR/Shell/Serializer/NodeNormalizer.php @@ -93,7 +93,7 @@ public function supportsNormalization($data, $format = null, array $context = [] /** * {@inheritdoc} */ - public function denormalize($data, $class, $format = null, array $context = []) + public function denormalize($data, $class, $format = null, array $context = []): mixed { if (!$data) { throw new \InvalidArgumentException( From 4a393110c6cf8e49ceddab786833eec0a0f79487 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 19 Feb 2024 18:29:15 +0100 Subject: [PATCH 08/10] Fix return type of supportsdenormalize --- src/PHPCR/Shell/Serializer/NodeNormalizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PHPCR/Shell/Serializer/NodeNormalizer.php b/src/PHPCR/Shell/Serializer/NodeNormalizer.php index 6a864d3..f1e608b 100644 --- a/src/PHPCR/Shell/Serializer/NodeNormalizer.php +++ b/src/PHPCR/Shell/Serializer/NodeNormalizer.php @@ -166,7 +166,7 @@ public function denormalize($data, $class, $format = null, array $context = []): /** * {@inheritdoc} */ - public function supportsDenormalization($data, $type, $format = null) + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === 'PHPCR\NodeInterface'; } From 80ec3808782e1945ffd34e5ab35a40eaca96f3cc Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 19 Feb 2024 18:33:26 +0100 Subject: [PATCH 09/10] Add missing getSupportedTypes --- src/PHPCR/Shell/Serializer/NodeNormalizer.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/PHPCR/Shell/Serializer/NodeNormalizer.php b/src/PHPCR/Shell/Serializer/NodeNormalizer.php index f1e608b..49c06d0 100644 --- a/src/PHPCR/Shell/Serializer/NodeNormalizer.php +++ b/src/PHPCR/Shell/Serializer/NodeNormalizer.php @@ -82,6 +82,13 @@ public function normalize($node, $format = null, array $context = []): ArrayObje return $res; } + public function getSupportedTypes(?string $format): array + { + return [ + NodeInterface::class => true, + ]; + } + /** * {@inheritdoc} */ From 9b9b3c8b22268a00334e51fb0774b0b73a02f335 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 19 Feb 2024 18:53:30 +0100 Subject: [PATCH 10/10] Fix compatibility --- src/PHPCR/Shell/Serializer/NodeNormalizer.php | 18 +++++++++--------- src/PHPCR/Shell/Serializer/YamlEncoder.php | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/PHPCR/Shell/Serializer/NodeNormalizer.php b/src/PHPCR/Shell/Serializer/NodeNormalizer.php index 49c06d0..9c265ff 100644 --- a/src/PHPCR/Shell/Serializer/NodeNormalizer.php +++ b/src/PHPCR/Shell/Serializer/NodeNormalizer.php @@ -39,14 +39,21 @@ public function getNotes() return $this->notes; } + public function getSupportedTypes(?string $format): array + { + return [ + NodeInterface::class => true, + ]; + } + /** * {@inheritdoc} */ - public function normalize($node, $format = null, array $context = []): ArrayObject|array|string|int|float|bool|null + public function normalize($object, $format = null, array $context = []): array { $res = []; - foreach ($node->getProperties() as $property) { + foreach ($object->getProperties() as $property) { if (false === $this->isPropertyEditable($property)) { continue; } @@ -82,13 +89,6 @@ public function normalize($node, $format = null, array $context = []): ArrayObje return $res; } - public function getSupportedTypes(?string $format): array - { - return [ - NodeInterface::class => true, - ]; - } - /** * {@inheritdoc} */ diff --git a/src/PHPCR/Shell/Serializer/YamlEncoder.php b/src/PHPCR/Shell/Serializer/YamlEncoder.php index e63667d..9f87aab 100644 --- a/src/PHPCR/Shell/Serializer/YamlEncoder.php +++ b/src/PHPCR/Shell/Serializer/YamlEncoder.php @@ -33,7 +33,7 @@ public function encode($data, $format, array $context = []): string return Yaml::dump($data); } - public function decode($data, $format, array $context = []) + public function decode($data, $format, array $context = []): mixed { $arr = Yaml::parse($data);