Skip to content

Commit

Permalink
code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bupy7 committed Jan 7, 2023
1 parent 9c729f8 commit e515750
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/composer.lock
/docker-compose.yml
/.phpunit.result.cache
/.php-cs-fixer.cache
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,22 @@ $ XDEBUG_MODE=coverage ./vendor/bin/phpunit

HTML coverage path: `build/coverage/index.html`

Code style
---

To fix code style, run:

```
~/.composer/vendor/bin/php-cs-fixer fix --config=./phpcs.php --verbose
```

You have to install [PHP CS Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) at first, if you
don't use build-in Docker image:

```
composer global require friendsofphp/php-cs-fixer "^3.13.0"
```

License
---

Expand Down
23 changes: 23 additions & 0 deletions phpcs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

/**
* Configuration of code style fixer and checker for this library.
* This configuration compatible with friendsofphp/php-cs-fixer "^3.13.0".
*/

use PhpCsFixer\Finder;
use PhpCsFixer\Config;

$finder = Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests');

$config = new Config();
$config->setRules([
'@PSR12' => true,
]);
$config->setFinder($finder);

return $config;
1 change: 0 additions & 1 deletion src/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
*/
interface ExceptionInterface
{

}
1 change: 0 additions & 1 deletion src/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
*/
class RuntimeException extends BaseRuntimeException implements ExceptionInterface
{

}
4 changes: 2 additions & 2 deletions src/XmlConstructor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/**
* Creating an XML document from an array.
*
*
* Usage:
*
* $xml = new XmlConstructor();
Expand Down Expand Up @@ -132,7 +132,7 @@ public function __construct(array $config = [])
* ],
* ],
* ]);
*
*
* @param array $in XML document structure as PHP array.
* @return static
* @throws RuntimeException
Expand Down
1 change: 0 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
*/
class TestCase extends BaseTestCase
{

}
4 changes: 2 additions & 2 deletions tests/XmlConstructTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class XmlConstructTest extends TestCase
],
],
];

public function testDefaultDocument1()
{
$out1 = <<<XML
Expand Down Expand Up @@ -146,7 +146,7 @@ public function testWithStartDocument()
$out2 = $xml->fromArray($this->in1)->toOutput();
$this->assertEquals($out1, $out2);
}

public function testCustomIndentString1()
{
$out1 = <<<XML
Expand Down
3 changes: 2 additions & 1 deletion workenv/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ ARG GITHUB_OAUTH_TOKEN=false
RUN if [ ${GITHUB_OAUTH_TOKEN} != false ]; then \
composer config -g github-oauth.github.com ${GITHUB_OAUTH_TOKEN} \
;fi

RUN export COMPOSER_DISABLE_XDEBUG_WARN=1

RUN composer global require friendsofphp/php-cs-fixer "^3.13.0"

CMD ["php", "-a"]

0 comments on commit e515750

Please sign in to comment.