Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php-versions: ['8.0', '8.1', '8.2' ]
php-versions: ['8.1', '8.2', '8.3']

runs-on: ${{ matrix.operating-system }}

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ The format is based on Keep a Changelog and this project adheres to Semantic Ver
- `shared/config/lang.php` uses the 3.1 Lang format: `default` adapter (`file`, `deepl` or `google_translate`), `default_locale` and a section per remote adapter.
- `save_remote_image()` uses the fluent `httpRequest()` helper.
- CI runs `composer rector:check` after PHPStan.
- The DTOs and services use `readonly` properties, and null values are cast to strings where they reach string functions (`trim()`, `strtotime()`, `preg_replace()`), as the Rector PHP 8.1 level set proposes.
- **Breaking:** the minimum PHP version is 8.1 (`composer.json`, README, PHPStan `phpVersion` and the Rector level set), and CI runs on PHP 8.1, 8.2 and 8.3, following the framework (quantum-php/framework#595).

### Removed
- The `Hook`, `Loader` and `libraries/` leftovers: the `hooks/` and `libraries/` folders, `shared/config/hooks.php` and the hooks and loader entries in the dependencies config.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<h2>Installation</h2>

<p><strong>Requirements:</strong> PHP 8.0 or newer.</p>
<p><strong>Requirements:</strong> PHP 8.1 or newer.</p>

<h3> 1. Create new project </h3>

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"type": "project",
"require": {
"php": "^8.0",
"php": "^8.1",
"quantum/framework": "dev-master",
"fakerphp/faker": "^1.15",
"bluemmb/faker-picsum-photos-provider": "^2.0",
Expand Down
2 changes: 1 addition & 1 deletion helpers/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function url_with_lang(string $lang): string
}

if (preg_match('/' . preg_quote(current_lang(), '/') . '/', route_uri())) {
return base_url() . preg_replace('/' . preg_quote(current_lang(), '/') . '/', $lang, route_uri(), 1);
return base_url() . preg_replace('/' . preg_quote(current_lang(), '/') . '/', (string) $lang, route_uri(), 1);
}

$url = base_url(true);
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
phpVersion: 80000
phpVersion: 80100
level: 5
paths:
- shared
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
ClassPropertyAssignToConstructorPromotionRector::class,
])
->withSets([
LevelSetList::UP_TO_PHP_80,
LevelSetList::UP_TO_PHP_81,
SetList::TYPE_DECLARATION,
])
->withRules([
Expand Down
2 changes: 1 addition & 1 deletion shared/Commands/CommentCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function exec(): void
$commentDto = new CommentDTO(
$this->getArgument('post_uuid'),
$this->getArgument('user_uuid'),
trim($this->getArgument('content'))
trim((string) $this->getArgument('content'))
);

service(CommentService::class)->addComment($commentDto);
Expand Down
2 changes: 1 addition & 1 deletion shared/Commands/DemoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private function createModule(string $moduleName, string $template, bool $withAs
]);
} catch (ProcessFailedException $e) {
throw new RuntimeException(
trim($e->getProcess()->getOutput()) ?: $e->getMessage()
trim((string) $e->getProcess()->getOutput()) ?: $e->getMessage()
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions shared/DTOs/CommentDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ class CommentDTO
/**
* @var string
*/
private string $postUuid;
private readonly string $postUuid;

/**
* @var string
*/
private string $userUuid;
private readonly string $userUuid;

/**
* @var string
*/
private string $content;
private readonly string $content;

/**
* @param string $postUuid
Expand Down
10 changes: 5 additions & 5 deletions shared/DTOs/PostDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ class PostDTO
/**
* @var string
*/
private string $title;
private readonly string $title;

/**
* @var string
*/
private string $content;
private readonly string $content;

/**
* @var string|null
*/
private ?string $userUuid;
private readonly ?string $userUuid;

/**
* @var string|null
*/
private ?string $image;
private readonly ?string $image;

/**
* @var string|null
*/
private ?string $uuid;
private readonly ?string $uuid;

/**
* @param string $title
Expand Down
14 changes: 7 additions & 7 deletions shared/DTOs/UserDTO.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,37 @@ class UserDTO
/**
* @var string
*/
private string $email;
private readonly string $email;

/**
* @var string
*/
private string $password;
private readonly string $password;

/**
* @var string
*/
private string $firstname;
private readonly string $firstname;

/**
* @var string
*/
private string $lastname;
private readonly string $lastname;

/**
* @var string
*/
private string $role;
private readonly string $role;

/**
* @var string|null
*/
private ?string $uuid;
private readonly ?string $uuid;

/**
* @var string
*/
private string $image;
private readonly string $image;

/**
* @param string $email
Expand Down
2 changes: 1 addition & 1 deletion shared/Services/AuthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AuthService extends Service implements AuthServiceInterface
/**
* @var User
*/
private User $model;
private readonly User $model;

/**
* @throws BaseException
Expand Down
2 changes: 1 addition & 1 deletion shared/Services/CommentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CommentService extends Service
* @var Comment
*/
private $model;
private CommentTransformer $transformer;
private readonly CommentTransformer $transformer;

/**
* @param CommentTransformer $transformer
Expand Down
2 changes: 1 addition & 1 deletion shared/Services/PostService.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class PostService extends Service
/**
* @var PostTransformer
*/
private PostTransformer $transformer;
private readonly PostTransformer $transformer;

/**
* @param PostTransformer $transformer
Expand Down
2 changes: 1 addition & 1 deletion shared/Transformers/CommentTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function transform($item): array
'image' => $item->image,
],
'content' => $item->content,
'date' => date('Y-m-d H:i', strtotime($item->created_at)),
'date' => date('Y-m-d H:i', strtotime((string) $item->created_at)),
];
}
}
2 changes: 1 addition & 1 deletion shared/Transformers/PostTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function transform($item): array
'title' => $item->title,
'content' => markdown_to_html($item->content, true),
'image' => $this->buildImagePath($item),
'date' => date('Y/m/d H:i', strtotime($item->updated_at)),
'date' => date('Y/m/d H:i', strtotime((string) $item->updated_at)),
'author' => $item->firstname . ' ' . $item->lastname,
];
}
Expand Down
Loading