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

no_spaces_after_function_name conflict with single_space_after_construct #5712

Closed
KacerCZ opened this issue May 13, 2021 · 4 comments
Closed
Labels
contribution welcome Core team is looking for a contribution kind/bug topic/whitespace Indentation, spacing, new lines

Comments

@KacerCZ
Copy link

KacerCZ commented May 13, 2021

Bug report

Using PHP CS Fixer 3.0.0 run on PHP 8.0.5 with following config:

<?php

$finder = \PhpCsFixer\Finder::create()
        ->in( __DIR__ )
        ->path( '/^*.php/' );

$rules = [
        'no_spaces_after_function_name' => TRUE,
        'single_space_after_construct' => [ 'constructs' => [ 'echo' ] ],
];

$config = new \PhpCsFixer\Config();
$config->setRules( $rules )
        ->setRiskyAllowed( TRUE )
        ->setIndent( "\t" )
        ->setFinder( $finder );

return $config;

or using --rules='{"no_spaces_after_function_name": true, "single_space_after_construct": {"constructs": ["echo"]}}' CLI param.

Code snippet that reproduces the problem

Save content to file echo_bug.php:

<?php

echo ( $flag ? 'yes' : 'no' ) . "\n";

Run vendor/bin/php-cs-fixer fix -v --dry-run --diff echo_bug.php.

Following fix is suggested:

   1) echo_bug.php (no_spaces_after_function_name)
      ---------- begin diff ----------
--- /tmp/fixer-bug/echo_bug.php
+++ /tmp/fixer-bug/echo_bug.php
@@ -1,4 +1,4 @@
 <?php
 
-echo ( $flag ? 'yes' : 'no' ) . "\n";
+echo( $flag ? 'yes' : 'no' ) . "\n";

Expected result is that no change is suggested.

@Wirone
Copy link
Member

Wirone commented May 10, 2023

Reproduced on 3.16:

image

@Wirone Wirone added contribution welcome Core team is looking for a contribution topic/whitespace Indentation, spacing, new lines labels May 10, 2023
@github-actions

This comment was marked as outdated.

This comment was marked as outdated.

@Wirone Wirone changed the title no_spaces_after_function_name conflict with single_space_after_construct no_spaces_after_function_name conflict with single_space_after_construct Nov 8, 2023
@keradus
Copy link
Member

keradus commented Dec 7, 2023

The original snippet

<?php

echo ( $flag ? 'yes' : 'no' ) . "\n";

is no longer modified after #7430 was merged and released.
kudos @kubawerlos

@keradus keradus closed this as completed Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome Core team is looking for a contribution kind/bug topic/whitespace Indentation, spacing, new lines
Projects
None yet
Development

No branches or pull requests

3 participants