Skip to content

DX: PHP CS Fixer - update excluded paths and apply some minor CS #52117

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
Oct 20, 2023

Conversation

keradus
Copy link
Member

@keradus keradus commented Oct 17, 2023

Q A
Branch? 6.4
Bug fix? no
New feature? no
Deprecations? no
Tickets N/A
License MIT

@@ -29,7 +29,7 @@ class CoverageListener implements TestListener
public function __construct(callable $sutFqcnResolver = null, bool $warningOnSutNotFound = false)
{
$this->sutFqcnResolver = $sutFqcnResolver ?? static function (Test $test): ?string {
$class = \get_class($test);
$class = $test::class;
Copy link
Member

Choose a reason for hiding this comment

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

these changes in the PHPUnit bridge need to be reverted as it still supports PHP 7

Copy link
Member Author

Choose a reason for hiding this comment

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

ack, reverted.

then, I strongly encourage to disable the rule, as one cannot apply current Fixer config in such case and trust to use the results.
aadeffb

Copy link
Member

Choose a reason for hiding this comment

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

What we would need would be to be able to disable some rules only for some paths. But php-cs-fixer does not support this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Very open to see such PR.
Yet, for now, if John Doe comes, see the Fixer config, apply it and see lot of changes needed, and those changes breaking CI, it's very confusing.

@@ -38,8 +38,6 @@ class GenericMetadata implements MetadataInterface
public array $constraints = [];

/**
* @var array
Copy link
Member

Choose a reason for hiding this comment

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

I suggest updating it to array<string, list<Constraint>> to have the precise type instead of removing the type.

Copy link
Member Author

Choose a reason for hiding this comment

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

sure. automate dropped the pointless type hint. if you have better one, happy to add it.

also looking at other annotations around those properties, they use Constraint[], let's be consistent on it - i followed what's already present
de34f51

@fabpot
Copy link
Member

fabpot commented Oct 20, 2023

Thank you @keradus.

@fabpot fabpot merged commit ad081be into symfony:6.4 Oct 20, 2023
@keradus keradus deleted the 6._cs branch October 20, 2023 09:21
@@ -96,7 +96,7 @@ public static function collectDeprecations($outputFile)
{
$deprecations = [];
$previousErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$deprecations, &$previousErrorHandler) {
if (\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || false === strpos($msg, '" targeting switch is equivalent to "break'))) {
if (\E_USER_DEPRECATED !== $type && \E_DEPRECATED !== $type && (\E_WARNING !== $type || !str_contains($msg, '" targeting switch is equivalent to "break'))) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm reverting all those, the phpunit-bridge doesn't support php and we don't want it to use polyfills

Copy link
Member Author

Choose a reason for hiding this comment

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

@nicolas-grekas , i'm curious then, as bridge is already using 8.1 polyfill. Why not using 8.0 polyfill ?

Copy link
Member

Choose a reason for hiding this comment

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

After checking, this is needed for testing the enum_exists mock. Also, this is require-dev!

nicolas-grekas added a commit that referenced this pull request Oct 20, 2023
…hs and apply some minor CS" (nicolas-grekas)

This PR was merged into the 6.4 branch.

Discussion
----------

Partially revert "DX: PHP CS Fixer - update excluded paths and apply some minor CS"

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT

This partially reverts #52117

Commits
-------

8511198 Partially revert "DX: PHP CS Fixer - update excluded paths and apply some minor CS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants