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

Different behavior for .phpcs config and phpcs fixer #2261

Closed
harikt opened this issue Nov 4, 2016 · 6 comments
Closed

Different behavior for .phpcs config and phpcs fixer #2261

harikt opened this issue Nov 4, 2016 · 6 comments

Comments

@harikt
Copy link

harikt commented Nov 4, 2016

Hi,

The .phpcs configuration and phpcs fixer seems to behave differently.

.phpcs contents

<?php
$finder = Symfony\CS\Finder\DefaultFinder::create()
    ->in(__DIR__ . '/config/')
;

return Symfony\CS\Config\Config::create()
    ->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
    ->finder($finder)
;

You can test the same on https://github.com/auraphp/Aura.Web_Project .

What went wrong :

namespace Aura\Web_Project_Config; renamed to namespace Aura\Web_Project\_config; when ran with phpcs fix --config-file=.php_cs . ( See small letter and caps behavior )

But running

phpcs fix config

doesnot behave the same.

Thank you.

@SpacePossum
Copy link
Contributor

Hi thanks for your report!
The phpcs as command is not related to this project, I guess you meant php-cs-fixer?
The change done as you described is prop. done by the PSR0 fixer.
To verify and to help you further please provide:

  • PHP-CS-Fixer version (php-cs-fixer -V)
  • PHP version (php -v)

@harikt
Copy link
Author

harikt commented Dec 8, 2016

The phpcs as command is not related to this project, I guess you meant php-cs-fixer?

phpcs is what I put in /usr/local/bin . So yes I meant php-cs-fixer itself.

To verify and to help you further please provide:
PHP-CS-Fixer version (php-cs-fixer -V)

PHP CS Fixer version 1.12.2 by Fabien Potencier and Dariusz Ruminski (baa7112)

PHP version (php -v)

PHP 7.0.8-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.8-0ubuntu0.16.04.1, Copyright (c) 1999-2016, by Zend Technologies

Thank you.

@SpacePossum
Copy link
Contributor

This makes sense to me now.

$ php-cs-fixer fix config

equals: fix all valid PHP files in the directory called config to SF standard, which includes PSR0 (on the 1.x line). This causes the change.
Please check your .php_cs is not used by the fixer to confirm. You can do this by add -vvv to the command, the fixer will state which configuration file it uses (if any).

phpcs fix --config-file=.php_cs

equals: fix all PHP files in the directory called config to PSR2 standard, which does not include PSR0,
so no fix is done.

@SpacePossum
Copy link
Contributor

@harikt can you confirm my idea about what is going on, I cannot help out without more feedback.

@harikt
Copy link
Author

harikt commented Feb 18, 2017

@SpacePossum sorry for being late. I missed your message some how. I have upgraded to latest version and tested and looks all good.

Thank you for taking your time looking to it.

@harikt harikt closed this as completed Feb 18, 2017
@SpacePossum
Copy link
Contributor

thanks for reporting back!
happy to see this issue is resolved :)

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

No branches or pull requests

2 participants