Skip to content

Commit

Permalink
Various code cleanups and coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
benr77 committed Aug 13, 2022
1 parent b0cb373 commit ccde576
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 32 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ Money Bundle
A Symfony bundle to integrate [Money PHP](https://github.com/moneyphp/money)
and provide various Twig and Doctrine helpers.

## Installation

Simply install with Composer in the usual way.

```bash
composer require headsnet/money-bundle
```

Then add to your `bundles.php` file.

```php
Headsnet\MoneyBundle\HeadsnetMoneyBundle::class => ['all' => true]
```

## Doctrine

The bundle provides a custom Doctrine Type for the `Currency` element of the Money object, and then a Doctrine
Expand Down Expand Up @@ -62,3 +76,20 @@ $amount = Money::EUR(200);
$serializer->serialize($amount, 'json'); // ==> '{"amount":"200","currency":"EUR"}'

```

## Contributing

Contributions are welcome. Please submit pull requests with one fix/feature per
pull request.

Composer scripts are configured for your convenience:

```
> composer cs # Run coding standards checks
> composer cs-fix # Fix coding standards violations
```

### Licence

This code is released under the MIT licence. Please see the LICENSE file for more information.

9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
"doctrine/doctrine-bundle": "^1.0|^2.0",
"symfony/form": "^4.0|^5.0",
"symfony/serializer": "^4.0|^5.0",
"symfony/twig-bundle": "^4.0|^5.0"
"symfony/twig-bundle": "^4.0|^5.0",
"phpunit/phpunit": "^8.0 || ^9.0",
"symplify/easy-coding-standard": "^11",
"phpstan/phpstan": "^1.8"
},
"suggest": {
"doctrine/doctrine-bundle": "Add a Money DBAL mapping type",
Expand All @@ -29,5 +32,9 @@
"psr-4": {
"Headsnet\\MoneyBundle\\": "src/"
}
},
"scripts": {
"cs": "vendor/bin/ecs check --ansi --config=ecs.php",
"cs-fix": "vendor/bin/ecs check --ansi --config=ecs.php --fix"
}
}
35 changes: 8 additions & 27 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,27 @@
/*
* This file is part of the Symfony HeadsnetMoneyBundle.
*
* (c) Headstrong Internet Services Ltd 2021
* (c) Headstrong Internet Services Ltd 2022
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/** @noinspection ALL */
declare(strict_types=1);

use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use PhpCsFixer\Fixer\ArrayNotation\TrailingCommaInMultilineArrayFixer;
use PhpCsFixer\Fixer\Basic\BracesFixer;
use PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer;
use PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer;
use PhpCsFixer\Fixer\FunctionNotation\SingleLineThrowFixer;
use PhpCsFixer\Fixer\Operator\ConcatSpaceFixer;
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocSummaryFixer;
use PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer;
use SlevomatCodingStandard\Sniffs\Whitespaces\DuplicateSpacesSniff;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return static function (ContainerConfigurator $containerConfigurator): void
{
$services = $containerConfigurator->services();
/**
*
*/
return static function (ECSConfig $ecsConfig): void {

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
$ecsConfig->paths([
__DIR__ . '/src'
]);

$parameters->set(Option::SKIP, [
__DIR__ . '/tests/_support/_generated/*',
]);

$parameters->set(Option::SETS, [
$ecsConfig->sets([
SetList::PSR_12
]);
};
5 changes: 1 addition & 4 deletions src/DependencyInjection/HeadsnetMoneyExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* This file is part of the Symfony HeadsnetMoneyBundle.
*
* (c) Headstrong Internet Services Ltd 2021
* (c) Headstrong Internet Services Ltd 2022
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -15,9 +15,6 @@
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* Bundle extension.
*/
class HeadsnetMoneyExtension extends Extension
{
/**
Expand Down

0 comments on commit ccde576

Please sign in to comment.