Skip to content

Commit bbbb44b

Browse files
authored
Merge pull request #1 from CAFernandes/tests
Tests
2 parents d8c7758 + 2e01bf9 commit bbbb44b

Some content is hidden

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

61 files changed

+5004
-1344
lines changed

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# EditorConfig para Express-PHP
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
[*.php]
11+
indent_style = space
12+
indent_size = 4
13+
max_line_length = 120
14+
15+
[*.{json,yml,yaml}]
16+
indent_style = space
17+
indent_size = 2
18+
19+
[*.md]
20+
trim_trailing_whitespace = false
21+
max_line_length = off

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@ Thumbs.db
3232
# Database
3333
*.sqlite
3434
*.sqlite3
35+
36+
37+
# Composer
38+
composer.lock
39+
vendor/

.php-cs-fixer.dist.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<?php
32

43
$finder = PhpCsFixer\Finder::create()
@@ -12,6 +11,7 @@
1211
->ignoreVCS(true);
1312

1413
return (new PhpCsFixer\Config())
14+
->setUnsupportedPhpVersionAllowed(true)
1515
->setRules([
1616
'@PSR12' => true,
1717
'@PhpCsFixer' => true,
@@ -93,7 +93,7 @@
9393
'short_scalar_cast' => true,
9494
'simplified_null_return' => true,
9595
'single_blank_line_at_eof' => true,
96-
'single_blank_line_before_namespace' => true,
96+
// 'single_blank_line_before_namespace' => true,
9797
'single_class_element_per_statement' => true,
9898
'single_line_after_imports' => true,
9999
'single_line_comment_style' => ['comment_types' => ['hash']],

composer.json

Lines changed: 78 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,81 @@
11
{
2-
"name": "cafernandes/express-php-cycle-orm-extension",
3-
"description": "Integração completa do Cycle ORM com o microframework Express-PHP",
4-
"keywords": ["express-php", "cycle-orm", "database", "orm", "microframework"],
5-
"type": "library",
6-
"license": "MIT",
7-
"authors": [
8-
{
9-
"name": "Caio Alberto Fernandes",
10-
"homepage": "https://github.com/CAFernandes"
11-
}
12-
],
13-
"require": {
14-
"php": "^8.1",
15-
"cafernandes/express-php": "^2.1",
16-
"cycle/orm": "^2.7",
17-
"cycle/annotated": "^3.4",
18-
"cycle/migrations": "^3.2",
19-
"cycle/schema-builder": "^2.7",
20-
"spiral/tokenizer": "^3.4"
21-
},
22-
"require-dev": {
23-
"phpunit/phpunit": "^10.0",
24-
"phpstan/phpstan": "^1.10",
25-
"squizlabs/php_codesniffer": "^3.7",
26-
"friendsofphp/php-cs-fixer": "^3.0",
27-
"psalm/plugin-phpunit": "^0.18"
28-
},
29-
"autoload": {
30-
"psr-4": {
31-
"CAFernandes\\ExpressPHP\\CycleORM\\": "src/"
32-
}
2+
"name": "express-php/cycle-orm-extension",
3+
"description": "Cycle ORM integration for Express-PHP microframework",
4+
"keywords": [
5+
"express-php",
6+
"cycle-orm",
7+
"database",
8+
"orm",
9+
"microframework"
10+
],
11+
"type": "library",
12+
"license": "MIT",
13+
"authors": [
14+
{
15+
"name": "Caio Alberto Fernandes",
16+
"homepage": "https://github.com/CAFernandes"
17+
}
18+
],
19+
"require": {
20+
"php": "^8.1",
21+
"cafernandes/express-php": "^2.1.1",
22+
"cycle/orm": "^2.0",
23+
"cycle/annotated": "^4.3",
24+
"cycle/migrations": "3.x-dev",
25+
"cycle/schema-builder": "^2.0",
26+
"spiral/tokenizer": "^2.7"
27+
},
28+
"require-dev": {
29+
"phpunit/phpunit": "^10.0",
30+
"phpstan/phpstan": "^1.0",
31+
"squizlabs/php_codesniffer": "^3.13",
32+
"friendsofphp/php-cs-fixer": "^3.76"
33+
},
34+
"autoload": {
35+
"psr-4": {
36+
"CAFernandes\\ExpressPHP\\CycleORM\\": "src/"
3337
},
34-
"autoload-dev": {
35-
"psr-4": {
36-
"CAFernandes\\ExpressPHP\\CycleORM\\Tests\\": "tests/"
37-
}
38-
},
39-
"bin": [
40-
"bin/express-cycle"
38+
"files": [
39+
"src/Helpers/env.php",
40+
"src/Helpers/config.php"
41+
]
42+
},
43+
"autoload-dev": {
44+
"psr-4": {
45+
"CAFernandes\\ExpressPHP\\CycleORM\\Tests\\": "tests/"
46+
}
47+
},
48+
"extra": {
49+
"express-php": {
50+
"providers": [
51+
"CAFernandes\\ExpressPHP\\CycleORM\\CycleServiceProvider"
52+
]
53+
}
54+
},
55+
"scripts": {
56+
"test": "phpunit",
57+
"test-coverage": "phpunit --coverage-html coverage",
58+
"phpstan": "phpstan analyse src --level=9",
59+
"cs:check": "phpcs --standard=phpcs.xml --report=full",
60+
"cs:check:summary": "phpcs --standard=phpcs.xml --report=summary",
61+
"cs:check:diff": "phpcs --standard=phpcs.xml --report=diff",
62+
"cs:fix": "phpcbf --standard=phpcs.xml",
63+
"cs:fix:dry": "phpcbf --standard=phpcs.xml --dry-run",
64+
"psr12:validate": [
65+
"@cs:check:summary",
66+
"echo 'PSR-12 validation completed!'"
4167
],
42-
"extra": {
43-
"express-php": {
44-
"providers": [
45-
"CAFernandes\\ExpressPHP\\CycleORM\\CycleServiceProvider"
46-
]
47-
},
48-
"branch-alias": {
49-
"dev-main": "1.0-dev"
50-
}
51-
},
52-
"scripts": {
53-
"post-install-cmd": [
54-
"@php scripts/post-install.php"
55-
],
56-
"post-update-cmd": [
57-
"@php scripts/post-install.php"
58-
],
59-
"test": "phpunit",
60-
"test-coverage": "phpunit --coverage-html=coverage-html --coverage-clover=coverage.xml",
61-
"analyse": "phpstan analyse",
62-
"lint": "php-cs-fixer fix --dry-run --diff",
63-
"fix": "php-cs-fixer fix",
64-
"setup": [
65-
"@composer install",
66-
"@php install.php"
67-
],
68-
"validate": [
69-
"@lint",
70-
"@analyse",
71-
"@test"
72-
],
73-
"ci": [
74-
"@lint",
75-
"@analyse",
76-
"@test"
77-
]
78-
},
79-
"scripts-descriptions": {
80-
"test": "Run PHPUnit tests",
81-
"test-coverage": "Run tests with coverage report",
82-
"analyse": "Run PHPStan static analysis",
83-
"lint": "Check code style with PHP CS Fixer",
84-
"fix": "Fix code style issues",
85-
"setup": "Setup development environment",
86-
"validate": "Validate code quality",
87-
"ci": "Run complete CI pipeline"
88-
},
89-
"config": {
90-
"optimize-autoloader": true,
91-
"preferred-install": "dist",
92-
"sort-packages": true,
93-
"allow-plugins": {
94-
"composer/package-versions-deprecated": true
95-
}
96-
},
97-
"minimum-stability": "stable",
98-
"prefer-stable": true
99-
}
68+
"psr12:fix": [
69+
"@cs:fix",
70+
"@cs:check:summary",
71+
"echo 'PSR-12 auto-fix completed!'"
72+
],
73+
"quality:psr12": [
74+
"@psr12:validate",
75+
"@phpstan",
76+
"echo 'Quality check with PSR-12 completed!'"
77+
]
78+
},
79+
"minimum-stability": "dev",
80+
"prefer-stable": true
81+
}

composer.scripts.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"scripts": {
3+
"cs:check": "phpcs --standard=phpcs.xml --report=full",
4+
"cs:check:summary": "phpcs --standard=phpcs.xml --report=summary",
5+
"cs:check:diff": "phpcs --standard=phpcs.xml --report=diff",
6+
"cs:fix": "phpcbf --standard=phpcs.xml",
7+
"cs:fix:dry": "phpcbf --standard=phpcs.xml --dry-run",
8+
"psr12:validate": [
9+
"@cs:check:summary",
10+
"echo 'PSR-12 validation completed!'"
11+
],
12+
"psr12:fix": [
13+
"@cs:fix",
14+
"@cs:check:summary",
15+
"echo 'PSR-12 auto-fix completed!'"
16+
],
17+
"quality:psr12": [
18+
"@psr12:validate",
19+
"@phpstan",
20+
"echo 'Quality check with PSR-12 completed!'"
21+
]
22+
}
23+
}

docs/CODING_STANDARDS.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# 📋 Padrões de Código - Express PHP Framework
2+
3+
## PSR-12 Extended Coding Style
4+
5+
Este documento define os padrões de código para o Express PHP Framework,
6+
baseados em PSR-12 com extensões específicas do projeto.
7+
8+
### Formatação de Métodos
9+
10+
```php
11+
// ✅ Métodos com poucos parâmetros
12+
public function get(string $path, callable $handler): Route
13+
14+
// ✅ Métodos com muitos parâmetros
15+
public function middleware(
16+
string $path,
17+
MiddlewareInterface $middleware,
18+
array $options = [],
19+
int $priority = 10
20+
): self
21+
```
22+
23+
### DocBlocks Padronizados
24+
25+
```php
26+
/**
27+
* Descrição breve do método em uma linha.
28+
*
29+
* Descrição detalhada opcional que pode ser mais longa
30+
* e explicar comportamentos complexos do método.
31+
*
32+
* @param string $param Descrição do parâmetro
33+
* @param array $options Opções de configuração
34+
* @return ResponseInterface A resposta processada
35+
*
36+
* @throws InvalidArgumentException Se o parâmetro for inválido
37+
* @throws RuntimeException Se ocorrer erro de execução
38+
*
39+
* @since 2.1.0
40+
*/
41+
```
42+
43+
### Arrays e Estruturas de Dados
44+
45+
```php
46+
// ✅ Arrays associativos
47+
$config = [
48+
'key1' => 'value1',
49+
'key2' => [
50+
'nested' => 'value'
51+
]
52+
];
53+
54+
// ✅ Arrays simples multilinha
55+
$items = [
56+
'item1',
57+
'item2',
58+
'item3'
59+
];
60+
```

0 commit comments

Comments
 (0)