Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

NathanIsaac's avatar

PHP Coding Standards Fixer PSR2 On Windows

I am developing on windows and would like to use to following PHP Coding Standards Fixer. However, I would like to change the line ending for be windows specific instead of linux specific. Any thoughts on how to change this?

https://github.com/FriendsOfPHP/PHP-CS-Fixer

<?php

// Current .php_cs file

$finder = Symfony\CS\Finder\DefaultFinder::create()
    ->exclude(['vendor', 'storage', 'resources', 'public', 'node_modules'])
    ->in(__DIR__)
;

return Symfony\CS\Config\Config::create()
    ->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
    ->fixers(['-eof_ending'])
    ->finder($finder)
;

I found this link on how to change line endings in squizlabs/PHP_CodeSniffer here http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php.

Here is what the config looks like.

<!--
    Another useful example of changing sniff settings is
    to specify the end of line character that your standard
    should check for.
 -->
 <rule ref="Generic.Files.LineEndings">
  <properties>
   <property name="eolChar" value="\r\n"/>
  </properties>
 </rule>

Any thoughts on how to do the same thing with https://github.com/FriendsOfPHP/PHP-CS-Fixer?

Thanks,

Nathan

0 likes
1 reply
jlrdw's avatar

I use NetBeans and there's a plugin for that, works like a champ.

Please or to participate in this conversation.