Skip to content

Commit ccde576

Browse files
committed
Various code cleanups and coding standards
1 parent b0cb373 commit ccde576

File tree

4 files changed

+48
-32
lines changed

4 files changed

+48
-32
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ Money Bundle
44
A Symfony bundle to integrate [Money PHP](https://github.com/moneyphp/money)
55
and provide various Twig and Doctrine helpers.
66

7+
## Installation
8+
9+
Simply install with Composer in the usual way.
10+
11+
```bash
12+
composer require headsnet/money-bundle
13+
```
14+
15+
Then add to your `bundles.php` file.
16+
17+
```php
18+
Headsnet\MoneyBundle\HeadsnetMoneyBundle::class => ['all' => true]
19+
```
20+
721
## Doctrine
822

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

6478
```
79+
80+
## Contributing
81+
82+
Contributions are welcome. Please submit pull requests with one fix/feature per
83+
pull request.
84+
85+
Composer scripts are configured for your convenience:
86+
87+
```
88+
> composer cs # Run coding standards checks
89+
> composer cs-fix # Fix coding standards violations
90+
```
91+
92+
### Licence
93+
94+
This code is released under the MIT licence. Please see the LICENSE file for more information.
95+

composer.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
"doctrine/doctrine-bundle": "^1.0|^2.0",
1818
"symfony/form": "^4.0|^5.0",
1919
"symfony/serializer": "^4.0|^5.0",
20-
"symfony/twig-bundle": "^4.0|^5.0"
20+
"symfony/twig-bundle": "^4.0|^5.0",
21+
"phpunit/phpunit": "^8.0 || ^9.0",
22+
"symplify/easy-coding-standard": "^11",
23+
"phpstan/phpstan": "^1.8"
2124
},
2225
"suggest": {
2326
"doctrine/doctrine-bundle": "Add a Money DBAL mapping type",
@@ -29,5 +32,9 @@
2932
"psr-4": {
3033
"Headsnet\\MoneyBundle\\": "src/"
3134
}
35+
},
36+
"scripts": {
37+
"cs": "vendor/bin/ecs check --ansi --config=ecs.php",
38+
"cs-fix": "vendor/bin/ecs check --ansi --config=ecs.php --fix"
3239
}
3340
}

ecs.php

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,27 @@
22
/*
33
* This file is part of the Symfony HeadsnetMoneyBundle.
44
*
5-
* (c) Headstrong Internet Services Ltd 2021
5+
* (c) Headstrong Internet Services Ltd 2022
66
*
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
1010

11-
/** @noinspection ALL */
1211
declare(strict_types=1);
1312

14-
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
15-
use PhpCsFixer\Fixer\ArrayNotation\TrailingCommaInMultilineArrayFixer;
16-
use PhpCsFixer\Fixer\Basic\BracesFixer;
17-
use PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer;
18-
use PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer;
19-
use PhpCsFixer\Fixer\FunctionNotation\SingleLineThrowFixer;
20-
use PhpCsFixer\Fixer\Operator\ConcatSpaceFixer;
21-
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer;
22-
use PhpCsFixer\Fixer\Phpdoc\PhpdocSummaryFixer;
23-
use PhpCsFixer\Fixer\PhpTag\BlankLineAfterOpeningTagFixer;
24-
use SlevomatCodingStandard\Sniffs\Whitespaces\DuplicateSpacesSniff;
25-
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
26-
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer;
27-
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer;
28-
use Symplify\EasyCodingStandard\ValueObject\Option;
13+
use Symplify\EasyCodingStandard\Config\ECSConfig;
2914
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
3015

31-
return static function (ContainerConfigurator $containerConfigurator): void
32-
{
33-
$services = $containerConfigurator->services();
16+
/**
17+
*
18+
*/
19+
return static function (ECSConfig $ecsConfig): void {
3420

35-
$parameters = $containerConfigurator->parameters();
36-
$parameters->set(Option::PATHS, [
21+
$ecsConfig->paths([
3722
__DIR__ . '/src'
3823
]);
3924

40-
$parameters->set(Option::SKIP, [
41-
__DIR__ . '/tests/_support/_generated/*',
42-
]);
43-
44-
$parameters->set(Option::SETS, [
25+
$ecsConfig->sets([
4526
SetList::PSR_12
4627
]);
4728
};

src/DependencyInjection/HeadsnetMoneyExtension.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* This file is part of the Symfony HeadsnetMoneyBundle.
44
*
5-
* (c) Headstrong Internet Services Ltd 2021
5+
* (c) Headstrong Internet Services Ltd 2022
66
*
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
@@ -15,9 +15,6 @@
1515
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
1616
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
1717

18-
/**
19-
* Bundle extension.
20-
*/
2118
class HeadsnetMoneyExtension extends Extension
2219
{
2320
/**

0 commit comments

Comments
 (0)