From dfef4690467b3f6dceba4d2d1f7e4b51d38889ff Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Fri, 29 Nov 2024 10:21:12 -0500 Subject: [PATCH 1/3] make sure php 8.4 also works --- .github/workflows/phpstan.yml | 20 ++++++++++++++++++++ .github/workflows/phpunit.yml | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/phpstan.yml diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000..5b55d48 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,20 @@ +name: phpstan-CI +on: + [push, pull_request] +jobs: + phpstan: + runs-on: ubuntu-latest + name: PHPStan + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.4 + - name: Checkout + uses: actions/checkout@v4 + - name: composer install + run: composer install + - name: PHPStan + run: vendor/bin/phpstan + env: + REQUIRE_DEV: true diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index b4ab93f..40affe1 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -13,6 +13,7 @@ jobs: php-version: - "8.2" - "8.3" + - "8.4" deps: - "normal" include: @@ -21,7 +22,7 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" with: fetch-depth: 2 From 0378a7ecf5896412c2ce0d014d821d644e1114d6 Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Fri, 29 Nov 2024 10:24:52 -0500 Subject: [PATCH 2/3] updates for php 8.4 compatibility --- src/Limenius/Liform/FormUtil.php | 2 +- src/Limenius/Liform/Resolver.php | 2 +- src/Limenius/Liform/ResolverInterface.php | 2 +- src/Limenius/Liform/Transformer/AbstractTransformer.php | 2 +- src/Limenius/Liform/Transformer/ArrayTransformer.php | 4 ++-- src/Limenius/Liform/Transformer/BooleanTransformer.php | 2 +- src/Limenius/Liform/Transformer/ChoiceTransformer.php | 2 +- src/Limenius/Liform/Transformer/CompoundTransformer.php | 2 +- src/Limenius/Liform/Transformer/IntegerTransformer.php | 2 +- src/Limenius/Liform/Transformer/NumberTransformer.php | 2 +- src/Limenius/Liform/Transformer/StringTransformer.php | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Limenius/Liform/FormUtil.php b/src/Limenius/Liform/FormUtil.php index 2ceee8d..00e818b 100644 --- a/src/Limenius/Liform/FormUtil.php +++ b/src/Limenius/Liform/FormUtil.php @@ -38,7 +38,7 @@ public static function typeAncestry(FormInterface $form) * * @return void */ - public static function typeAncestryForType(array &$types, ResolvedFormTypeInterface $formType = null): void + public static function typeAncestryForType(array &$types, ?ResolvedFormTypeInterface $formType = null): void { if (!($formType instanceof ResolvedFormTypeInterface)) { return; diff --git a/src/Limenius/Liform/Resolver.php b/src/Limenius/Liform/Resolver.php index b7fca9e..13e1be9 100644 --- a/src/Limenius/Liform/Resolver.php +++ b/src/Limenius/Liform/Resolver.php @@ -30,7 +30,7 @@ class Resolver implements ResolverInterface * @param TransformerInterface $transformer * @param string|null $widget */ - public function setTransformer($formType, TransformerInterface $transformer, $widget = null): void + public function setTransformer($formType, TransformerInterface $transformer, ?string $widget = null): void { $this->transformers[$formType] = [ 'transformer' => $transformer, diff --git a/src/Limenius/Liform/ResolverInterface.php b/src/Limenius/Liform/ResolverInterface.php index 02f862c..f889357 100644 --- a/src/Limenius/Liform/ResolverInterface.php +++ b/src/Limenius/Liform/ResolverInterface.php @@ -24,7 +24,7 @@ interface ResolverInterface * @param TransformerInterface $transformer * @param string|null $widget */ - public function setTransformer($formType, TransformerInterface $transformer, $widget = null); + public function setTransformer($formType, TransformerInterface $transformer, ?string $widget = null); /** * @param FormInterface $form diff --git a/src/Limenius/Liform/Transformer/AbstractTransformer.php b/src/Limenius/Liform/Transformer/AbstractTransformer.php index d1ee2cc..a23fbe2 100644 --- a/src/Limenius/Liform/Transformer/AbstractTransformer.php +++ b/src/Limenius/Liform/Transformer/AbstractTransformer.php @@ -59,7 +59,7 @@ protected function applyExtensions(array $extensions, FormInterface $form, array * * @return array */ - protected function addCommonSpecs(FormInterface $form, array $schema, array $extensions = [], $widget = null) + protected function addCommonSpecs(FormInterface $form, array $schema, array $extensions = [], ?string $widget = null) { $schema = $this->addLabel($form, $schema); $schema = $this->addAttr($form, $schema); diff --git a/src/Limenius/Liform/Transformer/ArrayTransformer.php b/src/Limenius/Liform/Transformer/ArrayTransformer.php index 00aa771..5ed76ef 100644 --- a/src/Limenius/Liform/Transformer/ArrayTransformer.php +++ b/src/Limenius/Liform/Transformer/ArrayTransformer.php @@ -32,7 +32,7 @@ class ArrayTransformer extends AbstractTransformer * @param FormTypeGuesserInterface|null $validatorGuesser * @param ResolverInterface $resolver */ - public function __construct(TranslatorInterface $translator, ResolverInterface $resolver, FormTypeGuesserInterface $validatorGuesser = null) + public function __construct(TranslatorInterface $translator, ResolverInterface $resolver, ?FormTypeGuesserInterface $validatorGuesser = null) { parent::__construct($translator, $validatorGuesser); $this->resolver = $resolver; @@ -41,7 +41,7 @@ public function __construct(TranslatorInterface $translator, ResolverInterface $ /** * {@inheritdoc} */ - public function transform(FormInterface $form, array $extensions = [], $widget = null): array + public function transform(FormInterface $form, array $extensions = [], ?string $widget = null): array { $children = []; diff --git a/src/Limenius/Liform/Transformer/BooleanTransformer.php b/src/Limenius/Liform/Transformer/BooleanTransformer.php index 3d4a547..01da95b 100644 --- a/src/Limenius/Liform/Transformer/BooleanTransformer.php +++ b/src/Limenius/Liform/Transformer/BooleanTransformer.php @@ -21,7 +21,7 @@ class BooleanTransformer extends AbstractTransformer /** * {@inheritdoc} */ - public function transform(FormInterface $form, array $extensions = [], $widget = null): array + public function transform(FormInterface $form, array $extensions = [], ?string $widget = null): array { $schema = ['type' => 'boolean']; $schema = $this->addCommonSpecs($form, $schema, $extensions, $widget); diff --git a/src/Limenius/Liform/Transformer/ChoiceTransformer.php b/src/Limenius/Liform/Transformer/ChoiceTransformer.php index 83fa95b..17c4a0c 100644 --- a/src/Limenius/Liform/Transformer/ChoiceTransformer.php +++ b/src/Limenius/Liform/Transformer/ChoiceTransformer.php @@ -22,7 +22,7 @@ class ChoiceTransformer extends AbstractTransformer /** * {@inheritdoc} */ - public function transform(FormInterface $form, array $extensions = [], $widget = null): array + public function transform(FormInterface $form, array $extensions = [], ?string $widget = null): array { $formView = $form->createView(); diff --git a/src/Limenius/Liform/Transformer/CompoundTransformer.php b/src/Limenius/Liform/Transformer/CompoundTransformer.php index 332e3ba..fd7efc6 100644 --- a/src/Limenius/Liform/Transformer/CompoundTransformer.php +++ b/src/Limenius/Liform/Transformer/CompoundTransformer.php @@ -40,7 +40,7 @@ public function __construct(TranslatorInterface $translator, ResolverInterface $ /** * {@inheritdoc} */ - public function transform(FormInterface $form, array $extensions = [], $widget = null): array + public function transform(FormInterface $form, array $extensions = [], ?string $widget = null): array { $data = []; $order = 1; diff --git a/src/Limenius/Liform/Transformer/IntegerTransformer.php b/src/Limenius/Liform/Transformer/IntegerTransformer.php index 9a486f1..cc91505 100644 --- a/src/Limenius/Liform/Transformer/IntegerTransformer.php +++ b/src/Limenius/Liform/Transformer/IntegerTransformer.php @@ -21,7 +21,7 @@ class IntegerTransformer extends AbstractTransformer /** * {@inheritdoc} */ - public function transform(FormInterface $form, array $extensions = [], $widget = null): array + public function transform(FormInterface $form, array $extensions = [], ?string $widget = null): array { $schema = ['type' => 'integer']; $schema = $this->addCommonSpecs($form, $schema, $extensions, $widget); diff --git a/src/Limenius/Liform/Transformer/NumberTransformer.php b/src/Limenius/Liform/Transformer/NumberTransformer.php index 39368e0..3bd3539 100644 --- a/src/Limenius/Liform/Transformer/NumberTransformer.php +++ b/src/Limenius/Liform/Transformer/NumberTransformer.php @@ -21,7 +21,7 @@ class NumberTransformer extends AbstractTransformer /** * {@inheritdoc} */ - public function transform(FormInterface $form, array $extensions = [], $widget = null): array + public function transform(FormInterface $form, array $extensions = [], ?string $widget = null): array { $schema = ['type' => 'number']; $schema = $this->addCommonSpecs($form, $schema, $extensions, $widget); diff --git a/src/Limenius/Liform/Transformer/StringTransformer.php b/src/Limenius/Liform/Transformer/StringTransformer.php index a70341f..219842f 100644 --- a/src/Limenius/Liform/Transformer/StringTransformer.php +++ b/src/Limenius/Liform/Transformer/StringTransformer.php @@ -23,7 +23,7 @@ class StringTransformer extends AbstractTransformer /** * {@inheritdoc} */ - public function transform(FormInterface $form, array $extensions = [], $widget = null): array + public function transform(FormInterface $form, array $extensions = [], ?string $widget = null): array { $schema = ['type' => 'string']; $schema = $this->addCommonSpecs($form, $schema, $extensions, $widget); From 3c02c2625e46bb1d9ed7c257f813842fbbb3231f Mon Sep 17 00:00:00 2001 From: Tac Tacelosky Date: Fri, 29 Nov 2024 10:26:09 -0500 Subject: [PATCH 3/3] nullable syntax for php 8.4 --- src/Limenius/Liform/Transformer/CompoundTransformer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Limenius/Liform/Transformer/CompoundTransformer.php b/src/Limenius/Liform/Transformer/CompoundTransformer.php index fd7efc6..3e2b078 100644 --- a/src/Limenius/Liform/Transformer/CompoundTransformer.php +++ b/src/Limenius/Liform/Transformer/CompoundTransformer.php @@ -31,7 +31,7 @@ class CompoundTransformer extends AbstractTransformer * @param ResolverInterface $resolver * @param FormTypeGuesserInterface|null $validatorGuesser */ - public function __construct(TranslatorInterface $translator, ResolverInterface $resolver, FormTypeGuesserInterface $validatorGuesser = null) + public function __construct(TranslatorInterface $translator, ResolverInterface $resolver, ?FormTypeGuesserInterface $validatorGuesser = null) { parent::__construct($translator, $validatorGuesser); $this->resolver = $resolver;