Skip to content

Commit d4ae522

Browse files
committed
Add mapper stub
1 parent 262d1a1 commit d4ae522

53 files changed

Lines changed: 1666 additions & 27 deletions

Some content is hidden

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

.php-cs-fixer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
66

77
const PHPCS_DIRECTORIES = [
8+
__DIR__ . '/libs/mapper/src',
89
__DIR__ . '/libs/parser/src',
910
__DIR__ . '/libs/phpdoc/src',
1011
__DIR__ . '/libs/printer/src',
12+
__DIR__ . '/libs/property-accessor/src',
1113
__DIR__ . '/libs/reader/src',
1214
__DIR__ . '/libs/types/src',
1315
];

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ listed below is also published as a standalone, read-only repository via
1919

2020
## Packages
2121

22-
| Package | Description | Tests |
23-
|---------------------------------------------------------------------------|--------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
24-
| [`type-lang/types`](https://packagist.org/packages/type-lang/types) | AST node classes (`TypeLang\Type\*`) — the shared vocabulary of the ecosystem. | [![Tests](https://img.shields.io/github/actions/workflow/status/php-type-language/types/tests.yml?label=Tests&style=flat-square&logo=unpkg)](https://github.com/php-type-language/types/actions/workflows/tests.yml) |
25-
| [`type-lang/parser`](https://packagist.org/packages/type-lang/parser) | Parses TypeLang syntax into an AST, validating the grammar. | [![Tests](https://img.shields.io/github/actions/workflow/status/php-type-language/parser/tests.yml?label=Tests&style=flat-square&logo=unpkg)](https://github.com/php-type-language/parser/actions/workflows/tests.yml) |
26-
| [`type-lang/printer`](https://packagist.org/packages/type-lang/printer) | Renders AST nodes back into their string representation. | [![Tests](https://img.shields.io/github/actions/workflow/status/php-type-language/printer/tests.yml?label=Tests&style=flat-square&logo=unpkg)](https://github.com/php-type-language/printer/actions/workflows/tests.yml) |
27-
| [`type-lang/reader`](https://packagist.org/packages/type-lang/reader) | Builds AST nodes from types exposed by PHP Reflection objects. | [![Tests](https://img.shields.io/github/actions/workflow/status/php-type-language/reader/tests.yml?label=Tests&style=flat-square&logo=unpkg)](https://github.com/php-type-language/reader/actions/workflows/tests.yml) |
28-
| [`type-lang/phpdoc`](https://packagist.org/packages/type-lang/phpdoc) | Parses `/** ... */` DocBlock comments into a graph of description and tags. | [![Tests](https://img.shields.io/github/actions/workflow/status/php-type-language/phpdoc/tests.yml?label=Tests&style=flat-square&logo=unpkg)](https://github.com/php-type-language/phpdoc/actions/workflows/tests.yml) |
22+
| Package | Description | Tests |
23+
|---------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
24+
| [`type-lang/mapper`](https://packagist.org/packages/type-lang/mapper) | Maps variable types to other types. | [![Tests](https://img.shields.io/github/actions/workflow/status/php-type-language/mapper/tests.yml?label=Tests&style=flat-square&logo=unpkg)](https://github.com/php-type-language/mapper/actions/workflows/tests.yml) |
25+
| [`type-lang/parser`](https://packagist.org/packages/type-lang/parser) | Parses TypeLang syntax into an AST, validating the grammar. | [![Tests](https://img.shields.io/github/actions/workflow/status/php-type-language/parser/tests.yml?label=Tests&style=flat-square&logo=unpkg)](https://github.com/php-type-language/parser/actions/workflows/tests.yml) |
26+
| [`type-lang/phpdoc`](https://packagist.org/packages/type-lang/phpdoc) | Parses `/** ... */` DocBlock comments into a graph of description and tags. | [![Tests](https://img.shields.io/github/actions/workflow/status/php-type-language/phpdoc/tests.yml?label=Tests&style=flat-square&logo=unpkg)](https://github.com/php-type-language/phpdoc/actions/workflows/tests.yml) |
27+
| [`type-lang/printer`](https://packagist.org/packages/type-lang/printer) | Renders AST nodes back into their string representation. | [![Tests](https://img.shields.io/github/actions/workflow/status/php-type-language/printer/tests.yml?label=Tests&style=flat-square&logo=unpkg)](https://github.com/php-type-language/printer/actions/workflows/tests.yml) |
28+
| [`type-lang/reader`](https://packagist.org/packages/type-lang/reader) | Builds AST nodes from types exposed by PHP Reflection objects. | [![Tests](https://img.shields.io/github/actions/workflow/status/php-type-language/reader/tests.yml?label=Tests&style=flat-square&logo=unpkg)](https://github.com/php-type-language/reader/actions/workflows/tests.yml) |
29+
| [`type-lang/types`](https://packagist.org/packages/type-lang/types) | AST node classes (`TypeLang\Type\*`) — the shared vocabulary of the ecosystem. | [![Tests](https://img.shields.io/github/actions/workflow/status/php-type-language/types/tests.yml?label=Tests&style=flat-square&logo=unpkg)](https://github.com/php-type-language/types/actions/workflows/tests.yml) |
2930

3031
## Development
3132

composer.json

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,34 @@
88
],
99
"require": {
1010
"php": "^8.4",
11+
"type-lang/mapper": "^2.0",
1112
"type-lang/parser": "^2.0",
1213
"type-lang/phpdoc": "^2.0",
1314
"type-lang/printer": "^2.0",
1415
"type-lang/reader": "^2.0",
1516
"type-lang/types": "^2.0"
1617
},
1718
"require-dev": {
18-
"friendsofphp/php-cs-fixer": "^3.95.13",
19+
"doctrine/instantiator": "^2.0",
20+
"friendsofphp/php-cs-fixer": "^3.95",
1921
"jetbrains/phpstorm-attributes": "^1.2",
20-
"phpbench/phpbench": "^1.7.0",
21-
"phpdocumentor/reflection-docblock": "^6.0.3",
22-
"phplrt/compiler": "^3.7.5",
23-
"phpstan/phpdoc-parser": "^2.3.3",
24-
"phpstan/phpstan": "^2.2.5",
25-
"phpstan/phpstan-deprecation-rules": "^2.0.4",
26-
"phpstan/phpstan-strict-rules": "^2.0.11",
27-
"phpunit/phpunit": "^13.2.4",
28-
"symfony/var-dumper": "^7.4|^8.0"
22+
"justinrainbow/json-schema": "^6.10",
23+
"nette/neon": "^3.4",
24+
"phpbench/phpbench": "^1.7",
25+
"phpdocumentor/reflection-docblock": "^6.0",
26+
"phplrt/compiler": "^3.7",
27+
"phpstan/phpdoc-parser": "^2.3",
28+
"phpstan/phpstan": "^2.2",
29+
"phpstan/phpstan-deprecation-rules": "^2.0",
30+
"phpstan/phpstan-strict-rules": "^2.0",
31+
"phpunit/phpunit": "^13.2",
32+
"symfony/var-dumper": "^7.4|^8.0",
33+
"symfony/yaml": "^8.1"
2934
},
3035
"autoload-dev": {
3136
"psr-4": {
37+
"TypeLang\\Mapper\\Tests\\": "libs/mapper/tests",
38+
"TypeLang\\PropertyAccessor\\Tests\\": "libs/mapper/libs/property-accessor/tests",
3239
"TypeLang\\Parser\\Tests\\": "libs/parser/tests",
3340
"TypeLang\\Printer\\Tests\\": "libs/printer/tests",
3441
"TypeLang\\PhpDoc\\Tests\\": "libs/phpdoc/tests",

libs/mapper/.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml,neon}]
15+
indent_size = 2

libs/mapper/.gitattributes

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
* text=auto eol=lf
2+
*.pp eol=lf linguist-language=EBNF
3+
*.pp2 eol=lf linguist-language=EBNF
4+
5+
# GIT
6+
.editorconfig export-ignore
7+
.gitattributes export-ignore
8+
.gitignore export-ignore
9+
10+
# Tools
11+
.php-cs-fixer.php export-ignore
12+
phpstan.neon export-ignore
13+
14+
# Tests + CI
15+
phpunit.xml export-ignore
16+
17+
/.github export-ignore
18+
/tests export-ignore
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
tests:
9+
name: Tests (${{matrix.php}}, ${{ matrix.os }}, ${{ matrix.stability }})
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php: [ '8.4', '8.5' ]
15+
os: [ ubuntu-latest, macos-latest, windows-latest ]
16+
stability: [ lowest, stable ]
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v7
20+
- name: Set Git To Use LF
21+
run: |
22+
git config --global core.autocrlf false
23+
git config --global core.eol lf
24+
- name: Setup PHP ${{ matrix.php }}
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
ini-values: "memory_limit=-1"
29+
- name: Install Dependencies
30+
uses: nick-invision/retry@v4
31+
with:
32+
timeout_minutes: 5
33+
max_attempts: 3
34+
command: composer update --prefer-${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
35+
# Action
36+
- name: Execute Tests
37+
run: composer test

libs/mapper/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# IDE
2+
/.idea/
3+
4+
# Composer
5+
/composer.lock
6+
/vendor/
7+
8+
# Testing
9+
test.php

libs/mapper/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Nesmeyanov Kirill
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

libs/mapper/composer.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "type-lang/mapper",
3+
"type": "library",
4+
"description": "Library for mapping variable types to other types",
5+
"keywords": ["types", "serializer", "mapper", "hydrator", "transformer", "normalizer", "denormalizer", "marshal", "unmarshal"],
6+
"license": "MIT",
7+
"support": {
8+
"source": "https://github.com/php-type-language/mapper",
9+
"issues": "https://github.com/php-type-language/mapper/issues"
10+
},
11+
"require": {
12+
"php": "^8.4",
13+
"type-lang/parser": "^2.0"
14+
},
15+
"autoload": {
16+
"psr-4": {
17+
"TypeLang\\Mapper\\": "src",
18+
"TypeLang\\PropertyAccessor\\": "libs/property-accessor/src"
19+
}
20+
},
21+
"require-dev": {
22+
"doctrine/instantiator": "^2.0",
23+
"jetbrains/phpstorm-attributes": "^1.2",
24+
"justinrainbow/json-schema": "^6.0",
25+
"nette/neon": "^3.4",
26+
"phpstan/phpstan": "^2.2",
27+
"phpunit/phpunit": "^13.2",
28+
"symfony/yaml": "^7.4|^8.0"
29+
},
30+
"autoload-dev": {
31+
"psr-4": {
32+
"TypeLang\\Mapper\\Tests\\": "tests",
33+
"TypeLang\\PropertyAccessor\\Tests\\": "libs/property-accessor/tests"
34+
}
35+
},
36+
"suggest": {
37+
"ext-json": "Required for JSON mapping configuration files",
38+
"doctrine/instantiator": "(^2.0) A faster way to create class instances",
39+
"nette/neon": "(^3.0) Required for NEON mapping configuration files",
40+
"symfony/yaml": "(^7.4|^8.0) Required for YAML mapping configuration files",
41+
"type-lang/phpdoc": "(^2.0) Required for PhpDoc mapping configuration",
42+
"justinrainbow/json-schema": "(^6.0) Required for file-based configuration validation"
43+
},
44+
"extra": {
45+
"branch-alias": {
46+
"dev-master": "2.x-dev",
47+
"dev-main": "2.x-dev"
48+
}
49+
},
50+
"config": {
51+
"sort-packages": true,
52+
"platform-check": true,
53+
"bin-compat": "full",
54+
"optimize-autoloader": true,
55+
"preferred-install": {
56+
"*": "dist"
57+
}
58+
},
59+
"scripts-aliases": {
60+
"test:unit": ["test", "phpunit", "unit"]
61+
},
62+
"scripts": {
63+
"test:unit": "phpunit --testdox"
64+
},
65+
"minimum-stability": "dev",
66+
"prefer-stable": true
67+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "local/property-accessor",
3+
"type": "library",
4+
"description": "Library for property availability and read/write operations",
5+
"keywords": ["property", "index", "access", "extraction", "injection", "reflection"],
6+
"license": "MIT",
7+
"require": {
8+
"php": "^8.4"
9+
},
10+
"autoload": {
11+
"psr-4": {
12+
"TypeLang\\PropertyAccessor\\": "src"
13+
}
14+
},
15+
"require-dev": {
16+
"phpstan/phpstan": "^2.2",
17+
"phpunit/phpunit": "^13.2"
18+
},
19+
"autoload-dev": {
20+
"psr-4": {
21+
"TypeLang\\PropertyAccessor\\Tests\\": "tests"
22+
}
23+
},
24+
"extra": {
25+
"branch-alias": {
26+
"dev-master": "2.x-dev",
27+
"dev-main": "2.x-dev"
28+
}
29+
},
30+
"config": {
31+
"sort-packages": true,
32+
"platform-check": true,
33+
"bin-compat": "full",
34+
"optimize-autoloader": true,
35+
"preferred-install": {
36+
"*": "dist"
37+
}
38+
},
39+
"scripts-aliases": {
40+
"test:unit": ["test", "phpunit", "unit"]
41+
},
42+
"scripts": {
43+
"test:unit": "phpunit --testdox"
44+
},
45+
"minimum-stability": "dev",
46+
"prefer-stable": true
47+
}

0 commit comments

Comments
 (0)