Skip to content

Commit d9c414e

Browse files
oprypkhantcpackage-sync[bot]
authored andcommitted
chore: Sync changes from the template
1 parent b786ee8 commit d9c414e

File tree

9 files changed

+184
-160
lines changed

9 files changed

+184
-160
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release
22

33
on:
44
workflow_run:
5-
workflows: ["Tests"]
5+
workflows: ['Tests']
66
types:
77
- completed
88
branches:
@@ -18,17 +18,17 @@ jobs:
1818
runs-on: ubuntu-latest
1919
if: ${{ github.event.workflow_run.conclusion == 'success' }}
2020
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v3
23-
with:
24-
fetch-depth: 0
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
2525

26-
- name: Create a release
27-
uses: cycjimmy/semantic-release-action@v3
28-
with:
29-
extra_plugins: |
30-
@semantic-release/changelog
31-
@semantic-release/git
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
26+
- name: Create a release
27+
uses: cycjimmy/semantic-release-action@v3
28+
with:
29+
extra_plugins: |
30+
@semantic-release/changelog
31+
@semantic-release/git
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/template-sync.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Template sync
22

33
on:
4-
push:
5-
branches: ['sync']
64
workflow_dispatch:
75
schedule:
86
- cron: '*/5 * * * *'

.github/workflows/tests.yml

Lines changed: 94 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -9,99 +9,112 @@ jobs:
99
strategy:
1010
fail-fast: true
1111
matrix:
12-
php: [ 8.1, 8.2 ]
12+
php: [8.2]
1313

1414
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v3
17-
18-
- name: Setup PHP
19-
uses: shivammathur/setup-php@v2
20-
with:
21-
php-version: ${{ matrix.php }}
22-
tools: composer:v2
23-
coverage: none
24-
25-
- name: Validate composer.json and composer.lock
26-
run: composer validate
27-
28-
- name: Cache Composer packages
29-
id: composer-cache
30-
uses: actions/cache@v3
31-
with:
32-
path: vendor
33-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
34-
restore-keys: |
35-
${{ runner.os }}-php-
36-
37-
- name: Install dependencies
38-
run: composer install --prefer-dist --no-progress
39-
40-
- name: Execute phpunit
41-
run: composer test -- --colors=always
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: ${{ matrix.php }}
22+
tools: composer:v2
23+
coverage: none
24+
25+
- name: Validate composer.json and composer.lock
26+
run: composer validate
27+
28+
- name: Cache Composer packages
29+
id: composer-cache
30+
uses: actions/cache@v3
31+
with:
32+
path: vendor
33+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-php-
36+
37+
- name: Install dependencies
38+
run: composer install --prefer-dist --no-progress
39+
40+
- name: Execute phpunit
41+
run: composer test -- --colors=always
4242

4343
php-cs-fixer:
4444
name: php-cs-fixer
4545
runs-on: ubuntu-latest
4646
steps:
47-
- name: Checkout code
48-
uses: actions/checkout@v3
49-
50-
- name: Setup PHP
51-
uses: shivammathur/setup-php@v2
52-
with:
53-
php-version: 8.1
54-
extensions: dom, curl, libxml, mbstring, zip
55-
tools: composer:v2
56-
coverage: none
57-
58-
- name: Cache Composer packages
59-
id: composer-cache
60-
uses: actions/cache@v3
61-
with:
62-
path: vendor
63-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
64-
restore-keys: |
65-
${{ runner.os }}-php-
66-
67-
- name: Install dependencies
68-
run: composer install --prefer-dist --no-progress
69-
70-
- name: Execute php-cs-fixer
71-
run: composer cs-fix -- --dry-run --diff --using-cache=no
47+
- name: Checkout code
48+
uses: actions/checkout@v3
49+
50+
- name: Setup PHP
51+
uses: shivammathur/setup-php@v2
52+
with:
53+
php-version: 8.2
54+
extensions: dom, curl, libxml, mbstring, zip
55+
tools: composer:v2
56+
coverage: none
57+
58+
- name: Cache Composer packages
59+
id: composer-cache
60+
uses: actions/cache@v3
61+
with:
62+
path: vendor
63+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
64+
restore-keys: |
65+
${{ runner.os }}-php-
66+
67+
- name: Install dependencies
68+
run: composer install --prefer-dist --no-progress
69+
70+
- name: Execute php-cs-fixer
71+
run: composer cs-fix -- --dry-run --diff --using-cache=no
72+
73+
prettier:
74+
name: Prettier
75+
runs-on: ubuntu-latest
76+
77+
steps:
78+
- name: Checkout code
79+
uses: actions/checkout@v3
80+
81+
- name: Run prettier
82+
uses: actionsx/prettier@v2
83+
with:
84+
args: --check .
7285

7386
phpstan:
7487
name: PHPStan on PHP v${{ matrix.php }}
7588
runs-on: ubuntu-latest
7689
strategy:
7790
fail-fast: true
7891
matrix:
79-
php: [ 8.1, 8.2 ]
92+
php: [8.2]
8093
steps:
81-
- name: Checkout code
82-
uses: actions/checkout@v3
83-
84-
- name: Setup PHP
85-
uses: shivammathur/setup-php@v2
86-
with:
87-
php-version: ${{ matrix.php }}
88-
tools: composer:v2
89-
coverage: none
90-
91-
- name: Validate composer.json and composer.lock
92-
run: composer validate
93-
94-
- name: Cache Composer packages
95-
id: composer-cache
96-
uses: actions/cache@v3
97-
with:
98-
path: vendor
99-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
100-
restore-keys: |
101-
${{ runner.os }}-php-
102-
103-
- name: Install dependencies
104-
run: composer install --prefer-dist --no-progress
105-
106-
- name: Execute phpstan
107-
run: composer phpstan
94+
- name: Checkout code
95+
uses: actions/checkout@v3
96+
97+
- name: Setup PHP
98+
uses: shivammathur/setup-php@v2
99+
with:
100+
php-version: ${{ matrix.php }}
101+
tools: composer:v2
102+
coverage: none
103+
104+
- name: Validate composer.json and composer.lock
105+
run: composer validate
106+
107+
- name: Cache Composer packages
108+
id: composer-cache
109+
uses: actions/cache@v3
110+
with:
111+
path: vendor
112+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
113+
restore-keys: |
114+
${{ runner.os }}-php-
115+
116+
- name: Install dependencies
117+
run: composer install --prefer-dist --no-progress
118+
119+
- name: Execute phpstan
120+
run: composer phpstan

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
!.idea/fileTemplates
44

55
# Dependencies
6-
/vendor/
6+
/vendor
77
/composer.lock
88

99
# Build/coverage
@@ -16,7 +16,7 @@
1616
**/.phpunit.result.cache
1717

1818
# Temporary
19-
tmp/
19+
/tmp
2020

2121
# Misc
2222
.DS_Store

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGELOG.md
2+
3+
/.idea
4+
/build
5+
/coverage
6+
/tmp
7+
/vendor

.prettierrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
singleQuote: true

CONTRIBUTING.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Commands
22

33
Here are some of the commands that you'll need:
4-
- install dependencies: `docker run -it --rm -v $PWD:/app -w /app chialab/php-dev:8.2 composer install`
5-
- run tests with phpunit: `docker run -it --rm -v $PWD:/app -w /app chialab/php-dev:8.2 composer test`
6-
- reformat using php-cs-fixer: `docker run -it --rm -v $PWD:/app -w /app chialab/php-dev:8.2 composer cs-fix`
7-
- analyse with phpstan: `docker run -it --rm -v $PWD:/app -w /app chialab/php-dev:8.2 composer phpstan`
4+
5+
- install dependencies: `docker run -it --rm -v $PWD:/app -w /app chialab/php-dev:8.2 composer install`
6+
- run tests with phpunit: `docker run -it --rm -v $PWD:/app -w /app chialab/php-dev:8.2 composer test`
7+
- reformat using php-cs-fixer: `docker run -it --rm -v $PWD:/app -w /app chialab/php-dev:8.2 composer cs-fix`
8+
- reformat the rest with prettier: `docker run -it --rm -v $PWD:/app -w /app tmknom/prettier --write .`
9+
- analyse with phpstan: `docker run -it --rm -v $PWD:/app -w /app chialab/php-dev:8.2 composer phpstan`

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,40 @@ Laravel data transfer objects.
44

55
## Requirements
66

7-
* PHP version >=7.4.1
8-
* Docker (optional)
7+
- PHP version >=7.4.1
8+
- Docker (optional)
99

1010
## Installation
1111

1212
Require this package with composer.
13+
1314
```
1415
composer require tenantcloud/php-data-transfer-objects
1516
```
1617

1718
## Examples
18-
// Create empty data object.
19-
$data = ExampleDTO::create();
20-
21-
// Serialize for array or json
22-
$data->toArray();
23-
$data->toJson();
2419

25-
// Create from existing data
26-
$data = ExampleDTO::from(['foo']);
27-
28-
// Check is property filled
29-
$data->hasFoo();
20+
// Create empty data object.
21+
$data = ExampleDTO::create();
22+
23+
// Serialize for array or json
24+
$data->toArray();
25+
$data->toJson();
26+
27+
// Create from existing data
28+
$data = ExampleDTO::from(['foo']);
3029

31-
// Get foo property
32-
$data->getFoo();
30+
// Check is property filled
31+
$data->hasFoo();
3332

34-
// Set property
35-
$data->setFoo($foo);
33+
// Get foo property
34+
$data->getFoo();
35+
36+
// Set property
37+
$data->setFoo($foo);
3638

3739
### Commands
40+
3841
Install dependencies:
3942
`docker run -it --rm -v $PWD:/app -w /app composer install`
4043

0 commit comments

Comments
 (0)