Skip to content

Commit 22c78a8

Browse files
committed
Refactoring naming
1 parent c6b6b11 commit 22c78a8

Some content is hidden

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

48 files changed

+1339
-1040
lines changed

.docs/en/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class ArticleHydrator extends Hydrators\Hydrator
107107
$groups[] = $this->groupRepository->findById($identifier->getId());
108108

109109
} catch (NotFoundException $ex) {
110-
throw new Exceptions\JsonApiErrorException(
110+
throw new Exceptions\JsonApiError(
111111
422,
112112
'Defined group relation was not found',
113113
'Defined group relation was not foun in our application',
@@ -119,7 +119,7 @@ class ArticleHydrator extends Hydrators\Hydrator
119119
}
120120

121121
if ($groups === []) {
122-
throw new Exceptions\JsonApiErrorException(
122+
throw new Exceptions\JsonApiError(
123123
422,
124124
'Groups relation is missing',
125125
'Provide at least one group relation to create or update article',
@@ -311,7 +311,7 @@ use Neomerx\JsonApi;
311311

312312
use Your\CoolApplication\Entities;
313313

314-
class ArticleSchema extends Schemas\JsonApiSchema
314+
class ArticleSchema extends Schemas\JsonApi
315315
{
316316
/** @var Routing\IRouter */
317317
private Routing\IRouter $router;

.editorconfig

Lines changed: 669 additions & 30 deletions
Large diffs are not rendered by default.

.gitattributes

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# Not archived
2+
/.docs export-ignore
23
/.github export-ignore
34
/tests export-ignore
45
.editorconfig export-ignore
5-
.eslintrc export-ignore
66
.gitattributes export-ignore
77
.gitignore export-ignore
8-
.npmignore export-ignore
9-
babel.config.js export-ignore
10-
editorconfig.xml export-ignore
118
Makefile export-ignore
9+
phpcs.xml export-ignore
1210
phpstan.neon export-ignore
13-
ruleset.xml export-ignore
14-
tslint.json export-ignore

.github/workflows/ci.yaml

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ on:
66
- ".docs/**"
77
push:
88
branches:
9-
- "master"
9+
- "main"
10+
tags:
11+
- v*
1012
schedule:
1113
- cron: "0 8 * * 1" # At 08:00 on Monday
1214

@@ -18,15 +20,15 @@ env:
1820
coverage: "none"
1921

2022
jobs:
21-
php-qa:
22-
name: "Quality assurance for PHP code"
23+
qa:
24+
name: "Code quality assurance"
2325
runs-on: "${{ matrix.operating-system }}"
2426

2527
strategy:
2628
fail-fast: false
2729
matrix:
28-
php-version: [ "8.0", "8.1" ]
29-
operating-system: [ "ubuntu-latest" ]
30+
php-version: ["8.1"]
31+
operating-system: ["ubuntu-latest"]
3032

3133
steps:
3234
- name: "Checkout"
@@ -76,17 +78,17 @@ jobs:
7678
run: "${{ env.composer-install }}"
7779

7880
- name: "Coding Standard"
79-
run: "make php_cs"
81+
run: "make cs"
8082

81-
php-static-analysis:
82-
name: "Static analysis for PHP code"
83+
static-analysis:
84+
name: "Code static analysis"
8385
runs-on: "${{ matrix.operating-system }}"
8486

8587
strategy:
8688
fail-fast: false
8789
matrix:
88-
php-version: [ "8.0", "8.1" ]
89-
operating-system: [ "ubuntu-latest" ]
90+
php-version: ["8.1"]
91+
operating-system: ["ubuntu-latest"]
9092

9193
steps:
9294
- name: "Checkout"
@@ -135,27 +137,27 @@ jobs:
135137
- name: "PHPStan"
136138
run: "make phpstan"
137139

138-
php-tests:
139-
name: "Tests for PHP code"
140+
tests:
141+
name: "Code tests"
140142
runs-on: "${{ matrix.operating-system }}"
141-
needs: [ "php-qa", "php-static-analysis" ]
143+
needs: ["qa", "static-analysis"]
142144

143145
strategy:
144146
fail-fast: false
145147
matrix:
146-
php-version: [ "8.0", "8.1" ]
147-
operating-system: [ "ubuntu-latest" ]
148+
php-version: ["8.1"]
149+
operating-system: ["ubuntu-latest"]
148150

149151
steps:
150152
- name: "Checkout"
151153
uses: "actions/checkout@v2"
152154

153-
- name: "Setup MySQL"
154-
uses: "mirromutth/[email protected]"
155-
with:
156-
mysql version: "5.7"
157-
mysql database: "testdb"
158-
mysql root password: "root"
155+
- name : "Setup MySQL"
156+
uses : "mirromutth/[email protected]"
157+
with :
158+
mysql version : "5.7"
159+
mysql database : "testdb"
160+
mysql root password : "root"
159161

160162
- name: "Setup PHP cache environment"
161163
id: "extcache"
@@ -198,7 +200,7 @@ jobs:
198200
run: "${{ env.composer-install }} ${{ matrix.composer-args }}"
199201

200202
- name: "Tests"
201-
run: "make php_tests"
203+
run: "make tests"
202204

203205
- name: "Upload test output"
204206
if: ${{ failure() }}
@@ -207,15 +209,15 @@ jobs:
207209
name: output
208210
path: tests/**/output
209211

210-
php-tests-code-coverage:
211-
name: "Tests for PHP code with code coverage"
212+
tests-code-coverage:
213+
name: "Code tests with code coverage"
212214
runs-on: "${{ matrix.operating-system }}"
213-
needs: [ "php-tests" ]
215+
needs: ["tests"]
214216

215217
strategy:
216218
matrix:
217-
php-version: [ "8.1" ]
218-
operating-system: [ "ubuntu-latest" ]
219+
php-version: ["8.1"]
220+
operating-system: ["ubuntu-latest"]
219221
fail-fast: false
220222

221223
if: "github.event_name == 'push'"
@@ -224,12 +226,12 @@ jobs:
224226
- name: "Checkout"
225227
uses: "actions/checkout@v2"
226228

227-
- name: "Setup MySQL"
228-
uses: "mirromutth/[email protected]"
229-
with:
230-
mysql version: "5.7"
231-
mysql database: "testdb"
232-
mysql root password: "root"
229+
- name : "Setup MySQL"
230+
uses : "mirromutth/[email protected]"
231+
with :
232+
mysql version : "5.7"
233+
mysql database : "testdb"
234+
mysql root password : "root"
233235

234236
- name: "Setup PHP cache environment"
235237
id: "extcache"
@@ -272,7 +274,7 @@ jobs:
272274
run: "${{ env.composer-install }} ${{ matrix.composer-args }}"
273275

274276
- name: "Tests"
275-
run: "make php_coverage"
277+
run: "make coverage"
276278

277279
- name: "Coveralls.io"
278280
env:

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.idea
22
/vendor
33
/composer.lock
4-
tests/*/output
5-
tests/tmp
4+
/tests/*/output
5+
/tests/tmp
6+
.DS_Store

Makefile

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
.PHONY: php_qa php_lint php_cs php_csf phpstan php_tests php_coverage
1+
.PHONY: qa lint cs csf phpstan tests coverage
22

33
all:
44
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
55

66
vendor: composer.json composer.lock
77
composer install
88

9-
php_qa: php_lint phpstan php_cs
9+
qa: lint phpstan cs
1010

11-
php_lint: vendor
12-
vendor/bin/linter src tests
11+
lint: vendor
12+
vendor/bin/parallel-lint --exclude .git --exclude vendor src tests
1313

14-
php_cs: vendor
15-
vendor/bin/codesniffer src tests
14+
cs: vendor
15+
vendor/bin/phpcs --standard=phpcs.xml src tests
1616

17-
php_csf: vendor
18-
vendor/bin/codefixer src tests
17+
csf: vendor
18+
vendor/bin/phpcbf --standard=phpcs.xml src tests
1919

2020
phpstan: vendor
2121
vendor/bin/phpstan analyse -c phpstan.neon src
2222

23-
php_tests: vendor
23+
tests: vendor
2424
vendor/bin/tester -s -p php --colors 1 -C tests/cases
2525

26-
php_coverage: vendor
26+
coverage: vendor
2727
vendor/bin/tester -s -p php --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
[![Downloads total](https://badgen.net/packagist/dt/FastyBird/json-api?cache=300&style=flast-square)](https://packagist.org/packages/FastyBird/json-api)
1010
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat-square)](https://github.com/phpstan/phpstan)
1111

12+
***
13+
1214
## What is FastyBird {JSON:API} library?
1315

1416
This is a [Nette framework](https://nette.org) extension which is implementing [{JSON:API}](https://jsonapi.org/)

composer.json

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -38,40 +38,41 @@
3838
"minimum-stability" : "stable",
3939

4040
"require" : {
41-
"php": ">=8.0.0|>=8.1.0",
42-
"ext-json": "*",
43-
"consistence-community/consistence": "^2.1",
44-
"cweagans/composer-patches": "^1.7",
45-
"doctrine/annotations": "^1.13",
46-
"doctrine/orm": "^2.6",
47-
"fig/http-message-util": "^1.1",
48-
"ipub/json-api-document": "^0.2",
49-
"neomerx/json-api": "^4.0",
50-
"nette/bootstrap": "^3.1",
51-
"nette/di": "^3.0",
52-
"nette/utils": "^3.2",
53-
"phpdocumentor/reflection-docblock": "^5.3",
54-
"psr/http-factory": "^1.0",
55-
"psr/http-message": "^1.0",
56-
"psr/http-server-middleware": "^1.0",
57-
"psr/log": "^1.1|^3.0",
58-
"ramsey/uuid": "^4.2"
41+
"php" : ">=8.1.0",
42+
"ext-json" : "*",
43+
"consistence-community/consistence" : "^2.1",
44+
"cweagans/composer-patches" : "^1.7",
45+
"doctrine/annotations" : "^1.13",
46+
"doctrine/orm" : "^2.6",
47+
"fig/http-message-util" : "^1.1",
48+
"ipub/json-api-document" : "^0.2",
49+
"neomerx/json-api" : "^4.0",
50+
"nette/bootstrap" : "^3.1",
51+
"nette/di" : "^3.0",
52+
"nette/utils" : "^3.2",
53+
"phpdocumentor/reflection-docblock" : "^5.3",
54+
"psr/http-factory" : "^1.0",
55+
"psr/http-message" : "^1.0",
56+
"psr/http-server-middleware" : "^1.0",
57+
"psr/log" : "^1.1|^3.0",
58+
"ramsey/uuid" : "^4.2"
5959
},
6060

6161
"require-dev" : {
62-
"contributte/translation": "^0.9",
63-
"fastybird/web-server": "^0.8",
64-
"mockery/mockery": "^1.4",
65-
"ninjify/nunjuck": "^0.3",
66-
"ninjify/qa": "^0.13",
67-
"pds/skeleton": "^1.0",
68-
"phpstan/extension-installer": "^1.1",
69-
"phpstan/phpstan": "^1.3",
70-
"phpstan/phpstan-deprecation-rules": "^1.0",
71-
"phpstan/phpstan-doctrine": "^1.0",
72-
"phpstan/phpstan-nette": "^1.0",
73-
"phpstan/phpstan-strict-rules": "^1.1",
74-
"tracy/tracy": "^2.9"
62+
"contributte/translation" : "^0.9",
63+
"fastybird/web-server" : "^0.8",
64+
"mockery/mockery" : "^1.4",
65+
"ninjify/nunjuck" : "^0.3",
66+
"orisai/coding-standard" : "^3.2",
67+
"pds/skeleton" : "^1.0",
68+
"php-parallel-lint/php-parallel-lint" : "^1.3",
69+
"phpstan/extension-installer" : "^1.1",
70+
"phpstan/phpstan" : "^1.3",
71+
"phpstan/phpstan-deprecation-rules" : "^1.0",
72+
"phpstan/phpstan-doctrine" : "^1.0",
73+
"phpstan/phpstan-nette" : "^1.0",
74+
"phpstan/phpstan-strict-rules" : "^1.1",
75+
"tracy/tracy" : "^2.9"
7576
},
7677

7778
"suggest" : {
@@ -93,10 +94,10 @@
9394

9495
"config" : {
9596
"sort-packages" : true,
96-
"allow-plugins": {
97-
"dealerdirect/phpcodesniffer-composer-installer": true,
98-
"cweagans/composer-patches": true,
99-
"phpstan/extension-installer": true
97+
"allow-plugins" : {
98+
"dealerdirect/phpcodesniffer-composer-installer" : true,
99+
"cweagans/composer-patches" : true,
100+
"phpstan/extension-installer" : true
100101
}
101102
},
102103

phpcs.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd">
2+
<!-- Show only relevant part of path -->
3+
<arg name="basepath" value="./"/>
4+
5+
<!-- Import coding-standard -->
6+
<rule ref="./vendor/orisai/coding-standard/src/ruleset-8.1.xml">
7+
<exclude name="SlevomatCodingStandard.Commenting.ForbiddenAnnotations.AnnotationForbidden"/>
8+
9+
<exclude name="SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectLinesCountBetweenDifferentAnnotationsTypes"/>
10+
<exclude name="SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectAnnotationsGroup"/>
11+
</rule>
12+
13+
<!-- Configure PSR-4 rule -->
14+
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
15+
<properties>
16+
<property name="rootNamespaces" type="array">
17+
<element key="src" value="FastyBird\JsonApi"/>
18+
<element key="tests/cases/unit" value="Tests\Cases\Unit"/>
19+
<element key="tests/tools" value="Tests\Tools"/>
20+
</property>
21+
</properties>
22+
</rule>
23+
24+
<!--Exclude folders -->
25+
<exclude-pattern>/tests/tmp</exclude-pattern>
26+
<exclude-pattern>/tests/stubs/*</exclude-pattern>
27+
</ruleset>

phpstan.neon

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
parameters:
22
level: max
33
stubFiles:
4-
- tests/PHPStan/stubs/Neomerx/JsonApi/Contracts/Factories/FactoryInterface.php
5-
- tests/PHPStan/stubs/Neomerx/JsonApi/Contracts/Schema/ContextInterface.php
6-
- tests/PHPStan/stubs/Neomerx/JsonApi/Contracts/Schema/LinkInterface.php
7-
- tests/PHPStan/stubs/Neomerx/JsonApi/Contracts/Schema/SchemaContainerInterface.php
8-
- tests/PHPStan/stubs/Neomerx/JsonApi/Contracts/Schema/SchemaInterface.php
9-
- tests/PHPStan/stubs/Neomerx/JsonApi/Factories/Factory.php
4+
- tests/stubs/Neomerx/JsonApi/Contracts/Factories/FactoryInterface.stub
5+
- tests/stubs/Neomerx/JsonApi/Contracts/Schema/ContextInterface.stub
6+
- tests/stubs/Neomerx/JsonApi/Contracts/Schema/LinkInterface.stub
7+
- tests/stubs/Neomerx/JsonApi/Contracts/Schema/SchemaContainerInterface.stub
8+
- tests/stubs/Neomerx/JsonApi/Contracts/Schema/SchemaInterface.stub
9+
- tests/stubs/Neomerx/JsonApi/Factories/Factory.stub
1010
checkGenericClassInNonGenericObjectType: false

0 commit comments

Comments
 (0)