Skip to content

Commit

Permalink
Pimcore 11
Browse files Browse the repository at this point in the history
  • Loading branch information
limenet committed Oct 5, 2023
1 parent feff6e6 commit a1dd9d6
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 76 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ jobs:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest ]
php: [ "8.0", "8.1" ]
pimcore: [ '^10.0' ]
php: [ "8.1", "8.2" ]
pimcore: [ '^11.0' ]
stability: [ prefer-lowest, prefer-stable ]
exclude:
- stability: prefer-lowest # TODO: remove ASAP


steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

Expand Down Expand Up @@ -54,7 +52,7 @@ jobs:
operating-system: [ ubuntu-latest ]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
14 changes: 4 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"description": "Forms for Pimcore",
"type": "pimcore-bundle",
"require": {
"php": "^8.0",
"php": "^8.1",
"ext-json": "*",
"limenius/liform": "dev-master#28828461425acfb9d30ae02f554055be17ca5530",
"pimcore/pimcore": "^10.0",
"limenius/liform": "^0.19",
"pimcore/pimcore": "^11.0",
"ramsey/uuid": "^4.0",
"symfony/form": "^5.0",
"symfony/form": "^6.0",
"voku/portable-ascii": "^1.5 || ^2.0"
},
"require-dev": {
Expand All @@ -18,12 +18,6 @@
"phpstan/phpstan-deprecation-rules": "^1.1.4",
"phpstan/extension-installer": "^1.3.1"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/phpwutz/Liform"
}
],
"autoload": {
"psr-4": {
"Valantic\\PimcoreFormsBundle\\": "src/"
Expand Down
18 changes: 0 additions & 18 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ parameters:
count: 1
path: src/Form/FormErrorNormalizer.php

-
message: """
#^Call to deprecated method setSubject\\(\\) of class Pimcore\\\\Mail\\:
use subject\\(\\) instead\\. Will be removed in Pimcore 11$#
"""
count: 1
path: src/Form/Output/EmailOutput.php

-
message: "#^Method Valantic\\\\PimcoreFormsBundle\\\\Form\\\\Transformer\\\\ButtonTransformer\\:\\:transform\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -73,11 +65,6 @@ parameters:
count: 1
path: src/Form/Transformer/ChoiceTransformer.php

-
message: "#^Method Valantic\\\\PimcoreFormsBundle\\\\Form\\\\Transformer\\\\ChoiceTransformer\\:\\:transformMultiple\\(\\) has no return type specified\\.$#"
count: 1
path: src/Form/Transformer/ChoiceTransformer.php

-
message: "#^Method Valantic\\\\PimcoreFormsBundle\\\\Form\\\\Transformer\\\\ChoiceTransformer\\:\\:transformMultiple\\(\\) has parameter \\$choices with no type specified\\.$#"
count: 1
Expand All @@ -88,11 +75,6 @@ parameters:
count: 1
path: src/Form/Transformer/ChoiceTransformer.php

-
message: "#^Method Valantic\\\\PimcoreFormsBundle\\\\Form\\\\Transformer\\\\ChoiceTransformer\\:\\:transformSingle\\(\\) has no return type specified\\.$#"
count: 1
path: src/Form/Transformer/ChoiceTransformer.php

-
message: "#^Method Valantic\\\\PimcoreFormsBundle\\\\Form\\\\Transformer\\\\ChoiceTransformer\\:\\:transformSingle\\(\\) has parameter \\$choices with no type specified\\.$#"
count: 1
Expand Down
24 changes: 24 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\Config\RectorConfig;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php80\Rector\FunctionLike\MixedTypeRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src',
]);

$rectorConfig->skip([
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_81,
SetList::CODE_QUALITY,
]);
};
2 changes: 1 addition & 1 deletion src/Controller/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function apiAction(string $name, FormService $formService, Request $reque
$form = $formService->buildForm($name);
$form->handleRequest($request);

if (!$form->isSubmitted() && $request->getContentType() === 'json') {
if (!$form->isSubmitted() && $request->getContentTypeFormat() === 'json') {
$content = (string) $request->getContent();
$data = json_decode($content, true, flags: \JSON_THROW_ON_ERROR);

Expand Down
2 changes: 1 addition & 1 deletion src/Form/Output/EmailOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function handle(OutputResponse $outputResponse): OutputResponse
$subject = $this->getSubject();

if ($subject !== null) {
$mail->setSubject($subject);
$mail->subject($subject);
}

$from = $this->getFrom();
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Transformer/ButtonTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ButtonTransformer extends AbstractTransformer
{
use OverwriteAbstractTransformerTrait;

public function transform(FormInterface $form, array $extensions = [], $widget = null)
public function transform(FormInterface $form, array $extensions = [], $widget = null): array
{
$schema = ['type' => 'string'];

Expand Down
12 changes: 9 additions & 3 deletions src/Form/Transformer/ChoiceTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ChoiceTransformer extends \Limenius\Liform\Transformer\ChoiceTransformer
/**
* {@inheritDoc}
*/
public function transform(FormInterface $form, array $extensions = [], $widget = null)
public function transform(FormInterface $form, array $extensions = [], $widget = null): array
{
$formView = $form->createView();

Expand All @@ -47,7 +47,10 @@ public function transform(FormInterface $form, array $extensions = [], $widget =
return $this->addCommonSpecs($form, $schema, $extensions, $widget);
}

private function transformSingle(FormInterface $form, $choices, $titles)
/**
* @return array<string,mixed>
*/
private function transformSingle(FormInterface $form, $choices, $titles): array
{
$formView = $form->createView();

Expand All @@ -67,7 +70,10 @@ private function transformSingle(FormInterface $form, $choices, $titles)
return $schema;
}

private function transformMultiple(FormInterface $form, $choices, $titles)
/**
* @return array<string,mixed>
*/
private function transformMultiple(FormInterface $form, $choices, $titles): array
{
$formView = $form->createView();

Expand Down
2 changes: 1 addition & 1 deletion src/Form/Transformer/FileTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class FileTransformer extends StringTransformer
/**
* {@inheritDoc}
*/
public function transform(FormInterface $form, array $extensions = [], $widget = null)
public function transform(FormInterface $form, array $extensions = [], $widget = null): array
{
$schema = ['type' => 'file'];

Expand Down
17 changes: 0 additions & 17 deletions src/Resources/public/js/pimcore/startup.js

This file was deleted.

7 changes: 0 additions & 7 deletions src/ValanticPimcoreFormsBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ public function build(ContainerBuilder $container): void
$container->addCompilerPass(new ExtensionCompilerPass());
}

public function getJsPaths(): array
{
return [
'/bundles/valanticpimcoreforms/js/pimcore/startup.js',
];
}

protected function getComposerPackageName(): string
{
$composer = file_get_contents(__DIR__ . '/../composer.json');
Expand Down
2 changes: 1 addition & 1 deletion vendor-bin/phpcs/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.34.0"
"friendsofphp/php-cs-fixer": "^3.34.1"
}
}
17 changes: 7 additions & 10 deletions vendor-bin/phpcs/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a1dd9d6

Please sign in to comment.