diff --git a/CHANGELOG.md b/CHANGELOG.md index 3552a86..9f99431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ CHANGELOG ========= -### ??? ### +### Unreleased ### + +### 1.0.1 (2015-12-13) ### + +* fix #28, NoSpaceBeforeComma should not change spaces inside digits ### 1.0 (2015-12-13) ### diff --git a/README.md b/README.md index 8781fdd..8ae3edd 100644 --- a/README.md +++ b/README.md @@ -254,7 +254,7 @@ Add your own Fixer / Contribute a Fixer - You MUST write code in english; - you MUST follow PSR2 and Symfony coding standard (run `./vendor/bin/php-cs-fixer -vvv fix` on your branch); -- you MUST run the tests (run `phpunit`); +- you MUST run the tests (run `./vendor/bin/phpunit`); - you MUST comply to the MIT license; - you SHOULD write documentation. diff --git a/composer.json b/composer.json index 8dbd94c..d834ca1 100644 --- a/composer.json +++ b/composer.json @@ -27,6 +27,7 @@ } }, "require-dev": { - "fabpot/php-cs-fixer": "^1.11" + "fabpot/php-cs-fixer": "^1.11", + "phpunit/phpunit": "@stable" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 59d5061..75afc07 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,5 @@ - + tests/JoliTypo/ diff --git a/src/JoliTypo/Fixer/NoSpaceBeforeComma.php b/src/JoliTypo/Fixer/NoSpaceBeforeComma.php index eabc096..bff978f 100644 --- a/src/JoliTypo/Fixer/NoSpaceBeforeComma.php +++ b/src/JoliTypo/Fixer/NoSpaceBeforeComma.php @@ -20,7 +20,7 @@ class NoSpaceBeforeComma implements FixerInterface { public function fix($content, StateBag $stateBag = null) { - $content = preg_replace('@(\w+)['.Fixer::ALL_SPACES.']*(,)['.Fixer::ALL_SPACES.']*@mu', '$1$2 ', $content); + $content = preg_replace('@([^\d\s]+)['.Fixer::ALL_SPACES.']*(,)['.Fixer::ALL_SPACES.']*@mu', '$1$2 ', $content); return $content; } diff --git a/tests/JoliTypo/Tests/Fixer/NoSpaceBeforeCommaTest.php b/tests/JoliTypo/Tests/Fixer/NoSpaceBeforeCommaTest.php index a19b1ee..44caf1a 100644 --- a/tests/JoliTypo/Tests/Fixer/NoSpaceBeforeCommaTest.php +++ b/tests/JoliTypo/Tests/Fixer/NoSpaceBeforeCommaTest.php @@ -23,5 +23,7 @@ public function testSimpleString() $this->assertEquals("Superman, you're my hero", $fixer->fix("Superman,you're my hero")); $this->assertEquals("Superman, you're my hero", $fixer->fix("Superman ,you're my hero")); $this->assertEquals("Superman, you're my hero", $fixer->fix("Superman , you're my hero")); + $this->assertEquals("F, bar", $fixer->fix("F,bar")); + $this->assertEquals("Seule 1,7 million de personnes", $fixer->fix("Seule 1,7 million de personnes")); } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index d215965..0000000 --- a/tests/bootstrap.php +++ /dev/null @@ -1,11 +0,0 @@ -add('JoliTypo\Tests', __DIR__);