Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit 5f9d381

Browse files
authored
update transformer to make it compatible with a newer fractal version (#176)
2 parents a6d8786 + b29ebde commit 5f9d381

18 files changed

+37
-37
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"source": "https://github.com/cebe/yii2-openapi"
1919
},
2020
"require": {
21-
"php": ">=7.2.0",
21+
"php": "^7.4 || ^8.0",
2222
"cebe/php-openapi": "^1.5.0",
2323
"yiisoft/yii2": "~2.0.48",
2424
"yiisoft/yii2-gii": "~2.0.0 | ~2.1.0 | ~2.2.0| ~2.3.0",

src/generator/default/transformer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
class <?=$transformer->name?> extends TransformerAbstract
2424
{
2525
<?php if (!empty($transformer->availableRelations)):?>
26-
protected $availableIncludes = ['<?=implode("', '", $transformer->availableRelations)?>'];
26+
protected array $availableIncludes = ['<?=implode("', '", $transformer->availableRelations)?>'];
2727
<?php else:?>
28-
protected $availableIncludes = [];
28+
protected array $availableIncludes = [];
2929
<?php endif;?>
3030
<?php if (!empty($transformer->defaultRelations)):?>
31-
protected $defaultIncludes = ['<?=implode("', '", $transformer->defaultRelations)?>'];
31+
protected array $defaultIncludes = ['<?=implode("', '", $transformer->defaultRelations)?>'];
3232
<?php else:?>
33-
protected $defaultIncludes = [];
33+
protected array $defaultIncludes = [];
3434
<?php endif;?>
3535

3636
public function transform(<?=$transformer->dbModel->getClassName()?> $model)

tests/specs/blog_jsonapi/transformers/base/CategoryTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
class CategoryTransformer extends TransformerAbstract
99
{
10-
protected $availableIncludes = ['posts'];
11-
protected $defaultIncludes = [];
10+
protected array $availableIncludes = ['posts'];
11+
protected array $defaultIncludes = [];
1212

1313
public function transform(Category $model)
1414
{

tests/specs/blog_jsonapi/transformers/base/CommentTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
class CommentTransformer extends TransformerAbstract
1010
{
11-
protected $availableIncludes = ['post', 'user'];
12-
protected $defaultIncludes = [];
11+
protected array $availableIncludes = ['post', 'user'];
12+
protected array $defaultIncludes = [];
1313

1414
public function transform(Comment $model)
1515
{

tests/specs/blog_jsonapi/transformers/base/PostTagTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
class PostTagTransformer extends TransformerAbstract
1010
{
11-
protected $availableIncludes = ['post', 'tag'];
12-
protected $defaultIncludes = [];
11+
protected array $availableIncludes = ['post', 'tag'];
12+
protected array $defaultIncludes = [];
1313

1414
public function transform(PostTag $model)
1515
{

tests/specs/blog_jsonapi/transformers/base/PostTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
class PostTransformer extends TransformerAbstract
1212
{
13-
protected $availableIncludes = ['category', 'author', 'comments', 'postTags'];
14-
protected $defaultIncludes = [];
13+
protected array $availableIncludes = ['category', 'author', 'comments', 'postTags'];
14+
protected array $defaultIncludes = [];
1515

1616
public function transform(Post $model)
1717
{

tests/specs/blog_jsonapi/transformers/base/TagTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
class TagTransformer extends TransformerAbstract
99
{
10-
protected $availableIncludes = ['postTags'];
11-
protected $defaultIncludes = [];
10+
protected array $availableIncludes = ['postTags'];
11+
protected array $defaultIncludes = [];
1212

1313
public function transform(Tag $model)
1414
{

tests/specs/blog_jsonapi/transformers/base/UserTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class UserTransformer extends TransformerAbstract
88
{
9-
protected $availableIncludes = [];
10-
protected $defaultIncludes = [];
9+
protected array $availableIncludes = [];
10+
protected array $defaultIncludes = [];
1111

1212
public function transform(User $model)
1313
{

tests/specs/many2many/transformers/PhotoTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class PhotoTransformer extends TransformerAbstract
88
{
9-
protected $availableIncludes = ['postsAttaches', 'postsGallery', 'photosPosts', 'targets', 'articles', 'posts'];
10-
protected $defaultIncludes = [];
9+
protected array $availableIncludes = ['postsAttaches', 'postsGallery', 'photosPosts', 'targets', 'articles', 'posts'];
10+
protected array $defaultIncludes = [];
1111

1212
public function transform(Photo $model)
1313
{

tests/specs/many2many/transformers/Photos2PostsTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class Photos2PostsTransformer extends TransformerAbstract
88
{
9-
protected $availableIncludes = ['photo', 'post'];
10-
protected $defaultIncludes = [];
9+
protected array $availableIncludes = ['photo', 'post'];
10+
protected array $defaultIncludes = [];
1111

1212
public function transform(Photos2Posts $model)
1313
{

tests/specs/many2many/transformers/PostTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class PostTransformer extends TransformerAbstract
88
{
9-
protected $availableIncludes = ['postsAttaches', 'postsGallery', 'postsPhotos', 'tags', 'attaches', 'images', 'photos'];
10-
protected $defaultIncludes = [];
9+
protected array $availableIncludes = ['postsAttaches', 'postsGallery', 'postsPhotos', 'tags', 'attaches', 'images', 'photos'];
10+
protected array $defaultIncludes = [];
1111

1212
public function transform(Post $model)
1313
{

tests/specs/many2many/transformers/PostsAttachesTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class PostsAttachesTransformer extends TransformerAbstract
88
{
9-
protected $availableIncludes = ['attach', 'target'];
10-
protected $defaultIncludes = [];
9+
protected array $availableIncludes = ['attach', 'target'];
10+
protected array $defaultIncludes = [];
1111

1212
public function transform(PostsAttaches $model)
1313
{

tests/specs/many2many/transformers/PostsGalleryTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class PostsGalleryTransformer extends TransformerAbstract
88
{
9-
protected $availableIncludes = ['image', 'article'];
10-
protected $defaultIncludes = [];
9+
protected array $availableIncludes = ['image', 'article'];
10+
protected array $defaultIncludes = [];
1111

1212
public function transform(PostsGallery $model)
1313
{

tests/specs/many2many/transformers/TagTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class TagTransformer extends TransformerAbstract
88
{
9-
protected $availableIncludes = ['posts'];
10-
protected $defaultIncludes = [];
9+
protected array $availableIncludes = ['posts'];
10+
protected array $defaultIncludes = [];
1111

1212
public function transform(Tag $model)
1313
{

tests/specs/petstore_jsonapi/transformers/DoctorTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class DoctorTransformer extends TransformerAbstract
88
{
9-
protected $availableIncludes = [];
10-
protected $defaultIncludes = [];
9+
protected array $availableIncludes = [];
10+
protected array $defaultIncludes = [];
1111

1212
public function transform(Doctor $model)
1313
{

tests/specs/petstore_jsonapi/transformers/PetStatisticTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class PetStatisticTransformer extends TransformerAbstract
88
{
9-
protected $availableIncludes = ['parentPet', 'favoritePets', 'topDoctors'];
10-
protected $defaultIncludes = [];
9+
protected array $availableIncludes = ['parentPet', 'favoritePets', 'topDoctors'];
10+
protected array $defaultIncludes = [];
1111

1212
public function transform(PetStatistic $model)
1313
{

tests/specs/petstore_jsonapi/transformers/PetTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class PetTransformer extends TransformerAbstract
88
{
9-
protected $availableIncludes = ['duplicates', 'doctor'];
10-
protected $defaultIncludes = [];
9+
protected array $availableIncludes = ['duplicates', 'doctor'];
10+
protected array $defaultIncludes = [];
1111

1212
public function transform(Pet $model)
1313
{

tests/specs/ref_noobject/transformers/PersonWatchTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
class PersonWatchTransformer extends TransformerAbstract
88
{
9-
protected $availableIncludes = [];
10-
protected $defaultIncludes = [];
9+
protected array $availableIncludes = [];
10+
protected array $defaultIncludes = [];
1111

1212
public function transform(PersonWatch $model)
1313
{

0 commit comments

Comments
 (0)