Skip to content

Homogenize PHP-CS-Fixer configuration with symfony/symfony, and run it #2768

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

Merged
merged 1 commit into from
May 26, 2025

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented May 23, 2025

Q A
Bug fix? no
New feature? no
Docs? no
Issues Fix #...
License MIT

@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label May 23, 2025
@Kocal
Copy link
Member Author

Kocal commented May 23, 2025

Interesting, because PHP-CS-Fixer changed:

namespace Symfony\UX\LiveComponent\Tests\Integration;

use Symfony\UX\LiveComponent\Tests\Fixtures\Dto\Address;

// ...

/**
 * @var \Symfony\UX\LiveComponent\Tests\Fixtures\Dto\Address[]
 */
#[LiveProp(writable: true, useSerializerForHydration: true)]

for:

namespace Symfony\UX\LiveComponent\Tests\Integration;

use Symfony\UX\LiveComponent\Tests\Fixtures\Dto\Address;

// ...

/**
 * @var Address[]
 */
#[LiveProp(writable: true, useSerializerForHydration: true)]

The following error now happens:

1) Symfony\UX\LiveComponent\Tests\Integration\LiveComponentHydratorTest::testCanDehydrateAndHydrateComponentWithTestCases with data set "Array with DTOs: fully writable allows anything to change" (Closure Object (...))
Symfony\Component\Serializer\Exception\NotNormalizableValueException: Could not denormalize object of type "\Address[]", no supporting normalizer found.

/home/runner/work/ux/ux/src/LiveComponent/vendor/symfony/serializer/Serializer.php:222
/home/runner/work/ux/ux/src/LiveComponent/src/LiveComponentHydrator.php:292
/home/runner/work/ux/ux/src/LiveComponent/src/LiveComponentHydrator.php:169
/home/runner/work/ux/ux/src/LiveComponent/tests/Integration/LiveComponentHydratorTest.php:128
/home/runner/work/ux/ux/src/LiveComponent/tests/Integration/LiveComponentHydratorTest.php:157

That's weird, I would expect Address from the PHPDoc to be resolved to \Symfony\UX\LiveComponent\Tests\Fixtures\Dto\Address. Maybe that's because of the anonymous class?

EDIT: yes that's because of anonymous classes:
image

@Kocal Kocal force-pushed the chore/run-php-cs-fixer branch from cf1862a to b150af3 Compare May 24, 2025 05:58
Copy link
Member

@smnandre smnandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, always some troubles with anonymous classes in test & php-cs-fixer ..

For the rest, thanks!

@Kocal Kocal force-pushed the chore/run-php-cs-fixer branch from b150af3 to 4f44267 Compare May 24, 2025 17:18
@Kocal
Copy link
Member Author

Kocal commented May 24, 2025

Thanks for the review @smnandre 🙏🏻 it should be better now!


return (new PhpCsFixer\Config())
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRules([
'@PHP71Migration' => true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we need this addition ?

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels May 24, 2025
@Kocal Kocal force-pushed the chore/run-php-cs-fixer branch from 4f44267 to 8c1cdf4 Compare May 26, 2025 06:21
@Kocal Kocal force-pushed the chore/run-php-cs-fixer branch from 8c1cdf4 to cefa074 Compare May 26, 2025 06:21
@Kocal Kocal merged commit 3221c18 into symfony:2.x May 26, 2025
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants