Skip to content

Commit

Permalink
generator php 8
Browse files Browse the repository at this point in the history
  • Loading branch information
vsouz4 committed Dec 13, 2023
1 parent 75e15df commit 94fd4a7
Show file tree
Hide file tree
Showing 132 changed files with 3,140 additions and 1,688 deletions.
42 changes: 16 additions & 26 deletions .php_cs.php → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@
$rules = [
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'no_multiline_whitespace_before_semicolons' => true,
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
'no_blank_lines_after_class_opening' => true,
'no_short_echo_tag' => true,
'echo_tag_syntax' => ['format' => 'long'],
'no_unused_imports' => true,
'blank_line_after_opening_tag' => true,
'not_operator_with_successor_space' => true,
'no_useless_else' => true,
'ordered_imports' => [
'sortAlgorithm' => 'alpha',
],
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'class_attributes_separation' => [
'elements' => ['const', 'method', 'property'],
'elements' => [
'const' => 'one',
'method' => 'one',
'property' => 'one',
],
],
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'return', 'try'],
],
'no_alternative_syntax' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_align' => [
'align' => 'vertical',
],
'phpdoc_align' => ['align' => 'vertical'],
'phpdoc_indent' => true,
'phpdoc_no_package' => true,
'phpdoc_order' => true,
Expand All @@ -45,35 +45,25 @@
],
'single_quote' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'trim_array_spaces' => true,
'no_leading_import_slash' => true,
'declare_strict_types' => true,
'single_line_after_imports' => true,
'header_comment' => [
'header' => $header,
],
'header_comment' => ['header' => $header],
'not_operator_with_space' => false,
'no_spaces_inside_parenthesis' => true,
'unary_operator_spaces' => true,
'return_type_declaration' => [
'space_before' => 'none',
],
'native_function_invocation' => [
'include' => ['@all'],
],
'braces' => [
'allow_single_line_closure' => true,
],
'binary_operator_spaces' => [
'default' => 'align_single_space_minimal',
],
'return_type_declaration' => ['space_before' => 'none'],
'native_function_invocation' => ['include' => ['@all']],
'braces' => ['allow_single_line_closure' => true],
'binary_operator_spaces' => ['default' => 'align_single_space_minimal'],
'no_superfluous_phpdoc_tags' => true,
'no_empty_phpdoc' => true,
'no_extra_blank_lines' => true,
];

return Config::create()
return (new Config())
->setRiskyAllowed(true)
->setRules($rules)
->setIndent(' ')
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [10.4.0] - 2023.12.13
### Added
- Added generated code support for php 8.0

## [10.3.0] - 2023.12.08
### Added
- Added support for multiple responses
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.4-cli-alpine3.13 as dependencies
FROM php:8.2-cli-alpine as dependencies

WORKDIR /dependencies

Expand All @@ -18,7 +18,7 @@ COPY composer.lock /dependencies
RUN composer install \
&& git config --global --add safe.directory /app

FROM php:7.4-cli-alpine3.13
FROM php:8.2-cli-alpine

ARG API_CLIENT_GENERATOR_VERSION
ENV API_CLIENT_GENERATOR_VERSION=$API_CLIENT_GENERATOR_VERSION
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ API client generator is a console application capable of auto-generating a [PSR1
## Why using it?
- With generated client you are always sure that your OpenAPI specification is up-to-date.
- Work with objects instead of raw data, it is OOP friendly.
- Saves your time. You don't need to write data mappers youself to populate those objects with the data from the response.
- Saves your time. You don't need to write data mappers yourself to populate those objects with the data from the response.
- All the basic type validations in the request and the response done automatically.
- Despite the fact the code is generated it's clear and readable, simple to debug and to reason about.
- Highly configurable and extensible.
Expand All @@ -27,7 +27,7 @@ API client generator is a console application capable of auto-generating a [PSR1
* application/json
* application/x-www-form-urlencoded
* application/xml
- Supports new PHP versions synthax features.
- Supports new PHP versions syntax features.
- It is base client independent, you are free to choose any [existing PSR-18 compliant client](https://packagist.org/providers/psr/http-client-implementation). Just choose the one which you already use, so generated client would not cause any conflicts with your dependencies. Although not recommended, you can also use or build your own PSR-18 implementation, as the generated client depends on PSR interfaces only.
- Applies code style rules to generated code, you can specify your own.
- Generates README and composer.json files with possibility to use your own template.
Expand Down Expand Up @@ -74,9 +74,9 @@ The following environment variables are available:
| `PACKAGE` | yes | | | group/some-api-client |
| `OPENAPI ` | yes | | | /api/openapi.yaml |
| `OUTPUT_DIR` | yes | | | /client |
| `CODE_STYLE` | no | {path-to-repository}/.php_cs.php | | /client/myCodeStyle.php |
| `CODE_STYLE` | no | {path-to-repository}/.php-cs-fixer.php | | /client/myCodeStyle.php |
| `SOURCE_DIR` | no | src | | src |
| `CLIENT_PHP_VERSION` | no | 7.4 | 7.0, 7.1, 7.2, 7.3, 7.4 | 7.4 |
| `CLIENT_PHP_VERSION` | no | 7.4 | 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 | 7.4 |
| `COMPOSER_JSON_TEMPLATE_DIR` | no | {path-to-repository}/template/composer.json.twig | | /path/composer.json.twig |
| `README_MD_TEMPLATE_DIR` | no | {path-to-repository}/template/README.md.twig | | /path/README.md.twig |
| `HTTP_MESSAGE` | no | guzzle | guzzle, nyholm | nyholm |
Expand Down
8 changes: 4 additions & 4 deletions bin/api-client-generator
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env php
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

use DoclerLabs\ApiClientGenerator\Application;

require_once __DIR__ . '/../vendor/autoload.php';

$application = new Application();

return $application->run();
return (new Application())->run();
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"api-client-generator"
],
"require": {
"php": ">=7.4",
"php": ">=8.2",
"ext-dom": "*",
"ext-json": "*",
"ext-xml": "*",
"cebe/php-openapi": "^1.4",
"docler-labs/api-client-exception": "^1.0.1 || ^2.0",
"friendsofphp/php-cs-fixer": "^2.16",
"friendsofphp/php-cs-fixer": "^3.0",
"guzzlehttp/psr7": "^1.6",
"icecave/parity": "^3.0",
"nikic/php-parser": "^4.10",
Expand Down
Loading

0 comments on commit 94fd4a7

Please sign in to comment.