Skip to content
This repository was archived by the owner on Jul 28, 2023. It is now read-only.

Commit 0c111c8

Browse files
committed
feat: some code improvements
- Added phpDoc comments as possible - Updated code style checks - Added PHPStan linter - Make `UuidValue` non abstract class
1 parent cfa7be1 commit 0c111c8

35 files changed

Lines changed: 482 additions & 233 deletions

.github/ISSUE_TEMPLATE.md

100644100755
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ Not obligatory, but suggest an idea for implementing addition or change.
2020

2121
Include as many relevant details about the environment you experienced the bug in and how to reproduce it.
2222

23-
* Version used (e.g. PHP 5.6, HHVM 3):
24-
* Operating system and version (e.g. Ubuntu 16.04, Windows 7):
25-
* Link to your project:
26-
* ...
27-
* ...
23+
- Version used (e.g. PHP 5.6, HHVM 3):
24+
- Operating system and version (e.g. Ubuntu 16.04, Windows 7):
25+
- Link to your project:
26+
- ...
27+
- ...

.gitignore

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# Project folders and files to ignore
2-
build
3-
phpcs.xml
4-
phpunit.xml
5-
vendor
6-
71
# Numerous always-ignore extensions
82
*.diff
93
*.err
@@ -18,11 +12,6 @@ vendor
1812
*.lock
1913
!**/yarn.lock
2014

21-
# Dotenv
22-
.env
23-
.env.*
24-
!.env.example
25-
2615
# OS or Editor folders
2716
.DS_Store
2817
._*
@@ -37,10 +26,26 @@ nbproject
3726
*.sublime-project
3827
*.sublime-workspace
3928
.idea
29+
.phpstorm.meta.php
4030
*.komodoproject
4131
.komodotools
4232
.atom
4333
.vscode
4434
.directory
4535
*.sql
4636
*.tar*
37+
38+
# Dotenv
39+
.env
40+
.env.*
41+
!.env.example
42+
43+
# Project folders and files to ignore
44+
build
45+
phpunit.xml
46+
vendor
47+
phpstan.neon
48+
docker-compose.override.yml
49+
index.html
50+
auth.json
51+
.phpunit.result.cache

.gitlab-ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
stages:
2+
- test
3+
4+
.in-docker:
5+
tags:
6+
- docker
7+
image: alpine
8+
9+
.php-job:
10+
extends: .in-docker
11+
image: spaceonfire/nginx-php-fpm:latest-7.3
12+
13+
.composer-job:
14+
extends: .php-job
15+
before_script:
16+
- composer config -g github-oauth.github.com $GITHUB_OAUTH_TOKEN
17+
- composer install
18+
cache:
19+
paths:
20+
- vendor
21+
- $COMPOSER_CACHE_DIR
22+
variables:
23+
COMPOSER_CACHE_DIR: $CI_PROJECT_DIR/._composer-cache
24+
25+
##
26+
## "Test" stage jobs
27+
##
28+
29+
codestyle:
30+
extends: .composer-job
31+
stage: test
32+
script:
33+
- composer codestyle -- --no-progress-bar --no-interaction
34+
35+
phpstan:
36+
extends: .composer-job
37+
stage: test
38+
script:
39+
- composer dump-autoload --classmap-authoritative
40+
- composer lint -- --no-interaction --no-progress
41+
42+
phpunit:
43+
extends: .composer-job
44+
stage: test
45+
script:
46+
- composer test

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
2222
- Nothing
2323
-->
2424

25+
## [1.1.0] - 2020-04-21
26+
### Added
27+
- Added phpDoc comments as possible
28+
- Updated code style checks
29+
- Added PHPStan linter
30+
- Make `UuidValue` non abstract class
31+
2532
## [1.0.2] - 2020-04-13
2633
### Fixed
2734
- Support `ramsey/uuid@^4.0`

CODE_OF_CONDUCT.md

100644100755
Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,19 @@ orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
26+
- Trolling, insulting/derogatory comments, and personal or political attacks
27+
- Public or private harassment
28+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
29+
- Other conduct which could reasonably be considered inappropriate in a professional setting
3330

3431
## Our Responsibilities
3532

CONTRIBUTING.md

100644100755
Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,26 @@
22

33
Contributions are **welcome** and will be fully **credited**.
44

5-
We accept contributions via Pull Requests on [Github](https://github.com/spaceonfire/value-object).
6-
5+
We accept contributions via Pull Requests on [Github](https://github.com/spaceonfire/criteria).
76

87
## Pull Requests
98

10-
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - Check the code style with ``$ composer check-style`` and fix it with ``$ composer fix-style``.
11-
9+
- **[PSR-12 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md)** -
10+
Check the code style with `$ composer codestyle` and fix it with `$ composer codestyle -- --fix`.
1211
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
13-
1412
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
15-
1613
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
17-
1814
- **Create feature branches** - Don't ask us to pull from your master branch.
19-
2015
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
21-
22-
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
23-
16+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful.
17+
If you had to make multiple intermediate commits while developing,
18+
please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages)
19+
before submitting.
2420

2521
## Running Tests
2622

27-
``` bash
23+
```bash
2824
$ composer test
2925
```
3026

31-
3227
**Happy coding**!

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ tests/
2121
vendor/
2222
```
2323

24-
2524
## Install
2625

2726
Via Composer

composer.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
"webmozart/assert": "^1.6"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": ">=7.0",
28-
"squizlabs/php_codesniffer": "^3.0",
27+
"laminas/laminas-hydrator": "^2.4|^3.0",
28+
"phpstan/phpstan": "^0.12",
29+
"phpstan/phpstan-webmozart-assert": "^0.12",
30+
"phpunit/phpunit": "^8.0",
2931
"ramsey/uuid": "^3.9|^4.0",
30-
"zendframework/zend-hydrator": "^2.4|^3.0",
31-
"laminas/laminas-hydrator": "^2.4|^3.0"
32+
"symplify/easy-coding-standard-prefixed": "^7.2"
3233
},
3334
"suggest": {
3435
"ramsey/uuid": "To use UuidValue",
@@ -47,12 +48,12 @@
4748
},
4849
"scripts": {
4950
"test": "phpunit",
50-
"check-style": "phpcs",
51-
"fix-style": "phpcbf"
51+
"codestyle": "ecs check --ansi",
52+
"lint": "phpstan analyze --memory-limit=512M --ansi"
5253
},
5354
"extra": {
5455
"branch-alias": {
55-
"dev-master": "1.0-dev"
56+
"dev-master": "1.1-dev"
5657
}
5758
},
5859
"config": {

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '3'
2+
3+
services:
4+
app:
5+
image: spaceonfire/nginx-php-fpm:latest-7.2
6+
environment:
7+
- SOF_PRESET=default
8+
- APPLICATION_ENV=test
9+
- ENABLE_XDEBUG=1
10+
- XDEBUG_IDEKEY=datasource
11+
- PAGER=more
12+
- PUID=1000
13+
volumes:
14+
- ./:/var/www/html:Z

ecs.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
parameters:
2+
sets:
3+
- clean-code
4+
- strict
5+
- php70
6+
- php71
7+
- psr12
8+
cache_directory: ._ecs_cache
9+
paths:
10+
- src/
11+
- tests/
12+
skip:
13+
Unused variable $_.: ~
14+
Unused parameter $value.:
15+
- src/BaseValueObject.php
16+
Unused parameter $args.:
17+
- src/EnumValue.php
18+
PhpCsFixer\Fixer\Strict\StrictComparisonFixer:
19+
- src/EnumValue.php
20+
SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff.UnusedParameter:
21+
- src/Integrations/HydratorStrategy/*
22+
23+
services:
24+
Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer: ~
25+
26+
# Types
27+
# SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSniff: ~
28+
# SlevomatCodingStandard\Sniffs\TypeHints\PropertyTypeHintSniff: ~
29+
# SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff: ~
30+
31+
# Dead code
32+
SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff: ~
33+
SlevomatCodingStandard\Sniffs\Functions\UnusedInheritedVariablePassedToClosureSniff: ~
34+
SlevomatCodingStandard\Sniffs\Functions\UnusedParameterSniff: ~
35+
SlevomatCodingStandard\Sniffs\Variables\UnusedVariableSniff: ~

0 commit comments

Comments
 (0)