Skip to content

Commit e8679c7

Browse files
authored
Merge pull request #43 from picamator/development
Release 5.2.0
2 parents a63f7b1 + 206959b commit e8679c7

File tree

114 files changed

+1681
-702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1681
-702
lines changed

.gitattributes

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
* eol=lf
22
* text=auto
3+
4+
# diff
35
*.php diff=php
6+
*.md diff=markdown
7+
*.sh diff=bash
8+
9+
# binary
410
*.jpg binary
511
*.png binary
612

13+
# export ignore
714
/.idea export-ignore
815
/.github export-ignore
9-
/.junie export-ignore
1016
/.xdebug export-ignore
1117
/config/ export-ignore
1218
/docker/ export-ignore
@@ -18,6 +24,7 @@
1824
/.env.dist export-ignore
1925
/.gitattributes export-ignore
2026
/.gitignore export-ignore
27+
/AGENTS.md export-ignore
2128
/captainhook.json export-ignore
2229
/CODE_OF_CONDUCT.md export-ignore
2330
/CONTRIBUTING.md export-ignore
@@ -27,6 +34,7 @@
2734
/phpunit.xml export-ignore
2835
/SECURITY.md export-ignore
2936

37+
# ignore form language statistics and hide in diffs
3038
/src/Generated/** linguist-generated=true
3139
/examples/Generated/** linguist-generated=true
3240
/tests/**/Generated/** linguist-generated=true

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
actions: read
2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@v5
25+
uses: actions/checkout@v6
2626

2727
- name: Install PHP
2828
uses: shivammathur/setup-php@v2
@@ -33,7 +33,7 @@ jobs:
3333

3434
- name: Cache vendor directory
3535
id: cache-vendor
36-
uses: actions/cache@v4
36+
uses: actions/cache@v5
3737
with:
3838
path: ./vendor
3939
key: ${{ runner.os }}-composer-${{ env.PHP_VERSION }}-${{ hashFiles('**/composer.lock') }}
@@ -57,7 +57,7 @@ jobs:
5757
actions: read
5858
steps:
5959
- name: Checkout
60-
uses: actions/checkout@v5
60+
uses: actions/checkout@v6
6161

6262
- name: Install PHP
6363
uses: shivammathur/setup-php@v2
@@ -68,7 +68,7 @@ jobs:
6868

6969
- name: Cache vendor directory
7070
id: cache-vendor
71-
uses: actions/cache@v4
71+
uses: actions/cache@v5
7272
with:
7373
path: ./vendor
7474
key: ${{ runner.os }}-composer-${{ env.PHP_VERSION }}-${{ hashFiles('**/composer.lock') }}
@@ -92,7 +92,7 @@ jobs:
9292
actions: read
9393
steps:
9494
- name: Checkout
95-
uses: actions/checkout@v5
95+
uses: actions/checkout@v6
9696

9797
- name: Install PHP
9898
uses: shivammathur/setup-php@v2
@@ -103,7 +103,7 @@ jobs:
103103

104104
- name: Cache vendor directory
105105
id: cache-vendor
106-
uses: actions/cache@v4
106+
uses: actions/cache@v5
107107
with:
108108
path: ./vendor
109109
key: ${{ runner.os }}-composer-${{ env.PHP_VERSION }}-${{ hashFiles('**/composer.lock') }}
@@ -131,7 +131,7 @@ jobs:
131131
fail-fast: false
132132
steps:
133133
- name: Checkout
134-
uses: actions/checkout@v5
134+
uses: actions/checkout@v6
135135

136136
- name: Install PHP
137137
uses: shivammathur/setup-php@v2
@@ -142,7 +142,7 @@ jobs:
142142

143143
- name: Cache vendor directory
144144
id: cache-vendor
145-
uses: actions/cache@v4
145+
uses: actions/cache@v5
146146
with:
147147
path: ./vendor
148148
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}

.junie/guidelines.md

Lines changed: 0 additions & 84 deletions
This file was deleted.

AGENTS.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
Purpose
2+
-------
3+
4+
This file is the project index for "agents":
5+
6+
- the modules that generate or use PHP transfer objects
7+
- the IDE plugins that helps to develop the project
8+
- the IDE plugins that helps to integrate PHP transfer object into application
9+
10+
It is intentionally short and only contains agent-specific facts and a concise inventory.
11+
Full how-to and contribution guides are in the canonical destinations:
12+
13+
- README.md
14+
- CONTRIBUTING.md
15+
- CODE_OF_CONDUCT.md
16+
- SECURITY.md
17+
- [WIKI](https://github.com/picamator/transfer-object/wiki)
18+
19+
Installation
20+
------------
21+
22+
```console
23+
$ composer require picamator/transfer-object
24+
```
25+
26+
Directory Structure
27+
-------------------
28+
29+
### Endpoints
30+
31+
- `bin`: project's endpoints, include transfer object's console commands
32+
33+
### Config
34+
35+
- `config`: transfer object and definition configurations used for definition and transfer generators
36+
- `var/config`: configuration for the project's transfer bulk generator
37+
- `schema`: JSON schemas for definition and transfer configurations
38+
39+
### Examples
40+
41+
- `examples`: samples how to use `DefinitionGeneratorFacade` and `TransferGeneratorFacade`
42+
43+
### Source
44+
45+
- `src`: code source
46+
- `src/Command`: Symfony console commands to generate definition and transfer object files
47+
- `src/DefinitionGenerator`: definition generator module
48+
- `src/Dependency`: wrapper over 3-part dependencies
49+
- `src/Generated`: directory where generated transfer objects are saved
50+
* should not contain any custom-written code
51+
* each transfer object generator run will overwrite all the files in the directory
52+
* can be used across modules
53+
- `src/Generated/_tmp`: temporary directory includes newly generated transfer objects before they are finally moved to the `src/Generated`
54+
* in case of an unexpected error, it is possible that directory is not deleted
55+
- `src/Shared`: contains code shared across modules
56+
* can be used across modules
57+
- `src/Transfer`: transfer object module
58+
* can be used across modules
59+
- `src/TransferGenerator`: transfer generator module
60+
61+
### Technical
62+
63+
- `.github`: GitHub CI actions, template and README.md images
64+
- `.xdebug`: Xdebug configuration for [Native Path Mapping](https://xdebug.org/funding/001-native-path-mapping)
65+
- `docker`: [dockerized development environment](https://github.com/picamator/transfer-object/wiki/Development-Environment) configuration with shell helper commands
66+
67+
### Tests
68+
69+
- `tests`: unit and integration PHPUnit tests
70+
- `tests/extension`: PHPUnit extension
71+
- `tests/integration`: integration tests
72+
- `tests/unit`: unit tests
73+
74+
Code Style
75+
----------
76+
77+
- code style should follow [PSR12](https://www.php-fig.org/psr/psr-12/)
78+
- each exception should implement `Picamator\TransferObject\Shared\Exception\TransferExceptionInterface`
79+
- exception messages should follow the same text style and structure across modules
80+
81+
### Classes
82+
83+
- classes should have a strict mode
84+
- classes should be `readonly` when possible
85+
- classes should use Constructor Property Promotion
86+
- class properties should have `private` visibility unless one is a transfer object, or it is necessary for inheritance
87+
- class method's and property's names should be similar across modules
88+
* **expander** classes should have `public` methods prefixed by `expand`
89+
* **parser** classes should have `public` methods prefixed by `parse`
90+
* **builder** classes should have `public` methods prefixed by `create`
91+
* **reader** classes should have `public` methods prefixed by `get`
92+
* **render** classes should have `public` methods prefixed by `render`
93+
* **validator** classes should have `public` methods prefixed by `validate`
94+
* methods returning `bool` should be prefixed by `is`
95+
96+
Module Structure
97+
----------------
98+
99+
#### Facade
100+
101+
- each module should have a facade class with an interface
102+
- the facade class and interface name should include the module name with `Facade` suffix
103+
- the facade is used for communication between modules
104+
- the facade used factories
105+
- the facade should not include any business logic
106+
- the facade `public` methods should have specification doc-block
107+
108+
### Factory
109+
110+
- module might contain sub-modules
111+
- each submodule should have at least one factory class
112+
- factory class name should include submodule name with `Factory` suffix
113+
- factory class should be used for class wiring
114+
- factory class should use:
115+
* `Picamator\TransferObject\Shared\CachedFactoryTrait`
116+
* `Picamator\TransferObject\Shared\SharedFactoryTrait`
117+
- factory methods should be `public` only when method is used in `Facade` classes, all others should be `protected`
118+
119+
Unit and Integration Tests
120+
--------------------------
121+
122+
- tests should follow a similar structure to the existing ones
123+
- separate test implementation by comment sections: "Arrange", "Act", "Assert" (optionally with "Expect")
124+
- use `setUp` method to initialize the tested object's stubs and mocks
125+
- use `PHPUnit` attributes
126+
- use [PHP generator](https://www.php.net/manual/en/class.generator.php) for the data providers

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ For detailed information, please check [DefinitionGeneratorFacadeTest](/tests/in
136136
Documentation
137137
-------------
138138

139-
For more details, please visit [project's wiki](https://github.com/picamator/transfer-object/wiki).
139+
For more details, please visit [Project's Wiki](https://github.com/picamator/transfer-object/wiki).
140140

141141
Publications
142142
------------
@@ -161,10 +161,16 @@ If you have suggestions for improvements or new features, feel free to:
161161

162162
Here is a [Contribution Guide](CONTRIBUTING.md).
163163

164-
165164
This project is released with a [Code of Conduct](CODE_OF_CONDUCT.md).
166165
By participating in this project and its community, you agree to abide by those terms.
167166

167+
Security Commitment
168+
-------------------
169+
170+
The project applies [OpenSSF Best Practices](https://www.bestpractices.dev/en/projects/11465/passing).
171+
172+
For reporting security vulnerabilities, please follow [Security Policy](https://github.com/picamator/transfer-object/security/policy).
173+
168174
License
169175
-------
170176

0 commit comments

Comments
 (0)