Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty labels for checkbox items are removed #4238

Closed
DavidBruchmann opened this issue Apr 18, 2024 · 7 comments · Fixed by #4240
Closed

empty labels for checkbox items are removed #4238

DavidBruchmann opened this issue Apr 18, 2024 · 7 comments · Fixed by #4240
Labels

Comments

@DavidBruchmann
Copy link

Bug Report

Subject Details
Rector version at least 2.2 - 2.4

In definitions like this:

            'config' => [
                'type' => 'check',
                'items' => [
                    [
                        'label' => '',
                    ],
                ],
            ],

the item-array gets completely removed by the typo3-rector rules SimplifyCheckboxItemsTCARector and MigrateItemsIndexedKeysToAssociativeRector, both have to be excluded to keep the definitions.

Minimal PHP Code Causing Issue

Sorry, I don't know how to load the Ssch namespace there:
https://getrector.com/demo/890354e6-9ea1-439a-95d7-fe7bf1e798eb

Expected Behaviour

the "items" array is required by TYPO3 and shouldn't be removed entirely.
One item with label is also required, even if it's empty.

@DavidBruchmann
Copy link
Author

Docu v12
Docu v11

@simonschaufi
Copy link
Collaborator

simonschaufi commented Apr 18, 2024

The website getrector.com doesn't include TYPO3 stuff, so this can't work. This used to work in the past though but the template is outedated. sorry.

Changelogs:

Can you please have a a look at both?

I guess this one causes the problem: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72056

@DavidBruchmann
Copy link
Author

DavidBruchmann commented Apr 18, 2024

Yes I agree, I just don't know how to make TYPO3 and rector happy with the same notation.
Perhaps @brotkrueml can shine a light on it?

The contradiction seems being inside TYPO3 itself already, I think.

@simonschaufi
Copy link
Collaborator

The best is to have a look at the styleguide extension.

Having a look at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72056/2/typo3/sysext/backend/Tests/Unit/Utility/BackendUtilityTest.php#b505 it might be that my migration is wrong. Let me add a test case...

@DavidBruchmann
Copy link
Author

your example looks outdated as it never has the label key

@simonschaufi
Copy link
Collaborator

simonschaufi commented Apr 18, 2024

No, in this case both rules depend on each other. This should just remove index 1 and the other one linked above should then change index 0 to "label".

@DavidBruchmann
Copy link
Author

ok, I can't follow completely, as my example looks differently, but let's see what you're coming forward with

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants