Commit 14dd44d0 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix: declare typed properties in PHPDoc for php<7.4

- fixes error when running castopod on php<7.4

fixes #23
parent 7fb1de2c
FROM php:latest
FROM php:7.2-fpm
COPY --from=composer /usr/bin/composer /usr/bin/composer
......
FROM php:latest
FROM php:7.2-fpm
COPY . /castopod
WORKDIR /castopod
......
......@@ -287,7 +287,7 @@ $routes->group(
$routes->get('forgot', 'AuthController::forgotPassword', [
'as' => 'forgot',
]);
$routes->post('forgot', 'Auth::attemptForgot');
$routes->post('forgot', 'AuthController::attemptForgot');
$routes->get('reset-password', 'AuthController::resetPassword', [
'as' => 'reset-password',
]);
......
......@@ -14,8 +14,15 @@ use App\Models\UserModel;
class Contributor extends BaseController
{
protected \App\Entities\Podcast $podcast;
protected ?\App\Entities\User $user;
/**
* @var \App\Entities\Podcast
*/
protected $podcast;
/**
* @var \App\Entities\User|null
*/
protected $user;
public function _remap($method, ...$params)
{
......
......@@ -13,8 +13,15 @@ use App\Models\PodcastModel;
class Episode extends BaseController
{
protected \App\Entities\Podcast $podcast;
protected ?\App\Entities\Episode $episode;
/**
* @var \App\Entities\Podcast
*/
protected $podcast;
/**
* @var \App\Entities\Episode|null
*/
protected $episode;
public function _remap($method, ...$params)
{
......
......@@ -15,7 +15,10 @@ use Config\Services;
class Podcast extends BaseController
{
protected ?\App\Entities\Podcast $podcast;
/**
* @var \App\Entities\Podcast|null
*/
protected $podcast;
public function _remap($method, ...$params)
{
......
......@@ -14,7 +14,10 @@ use Config\Services;
class User extends BaseController
{
protected ?\App\Entities\User $user;
/**
* @var \App\Entities\User|null
*/
protected $user;
public function _remap($method, ...$params)
{
......
......@@ -13,8 +13,15 @@ use App\Models\PodcastModel;
class Episode extends BaseController
{
protected \App\Entities\Podcast $podcast;
protected ?\App\Entities\Episode $episode;
/**
* @var \App\Entities\Podcast
*/
protected $podcast;
/**
* @var \App\Entities\Episode|null
*/
protected $episode;
public function _remap($method, ...$params)
{
......
......@@ -12,7 +12,10 @@ use App\Models\PodcastModel;
class Podcast extends BaseController
{
protected ?\App\Entities\Podcast $podcast;
/**
* @var \App\Entities\Podcast|null
*/
protected $podcast;
public function _remap($method, ...$params)
{
......
......@@ -13,6 +13,9 @@ use CodeIgniter\Entity;
class Category extends Entity
{
/**
* @var \App\Entity\Category|null
*/
protected $parent;
protected $casts = [
......
......@@ -14,17 +14,60 @@ use League\CommonMark\CommonMarkConverter;
class Episode extends Entity
{
protected \App\Entities\Podcast $podcast;
protected string $GUID;
protected string $link;
protected \CodeIgniter\Files\File $image;
protected string $image_media_path;
protected string $image_url;
protected \CodeIgniter\Files\File $enclosure;
protected string $enclosure_media_path;
protected string $enclosure_url;
protected array $enclosure_metadata;
protected string $description_html;
/**
* @var \App\Entities\Podcast
*/
protected $podcast;
/**
* @var string
*/
protected $GUID;
/**
* @var string
*/
protected $link;
/**
* @var \CodeIgniter\Files\File
*/
protected $image;
/**
* @var string
*/
protected $image_media_path;
/**
* @var string
*/
protected $image_url;
/**
* @var \CodeIgniter\Files\File
*/
protected $enclosure;
/**
* @var string
*/
protected $enclosure_media_path;
/**
* @var string
*/
protected $enclosure_url;
/**
* @var array
*/
protected $enclosure_metadata;
/**
* @var string
*/
protected $description_html;
protected $casts = [
'slug' => 'string',
......
......@@ -15,14 +15,45 @@ use League\CommonMark\CommonMarkConverter;
class Podcast extends Entity
{
protected string $link;
protected \CodeIgniter\Files\File $image;
protected string $image_media_path;
protected string $image_url;
/**
* @var string
*/
protected $link;
/**
* @var \CodeIgniter\Files\File
*/
protected $image;
/**
* @var string
*/
protected $image_media_path;
/**
* @var string
*/
protected $image_url;
/**
* @var \App\Entities\Episode[]
*/
protected $episodes;
protected \App\Entities\User $owner;
/**
* @var
*/
protected $owner;
/**
* @var \App\Entities\User[]
*/
protected $contributors;
protected string $description_html;
/**
* @var string
*/
protected $description_html;
protected $casts = [
'id' => 'integer',
......
......@@ -13,10 +13,10 @@ class User extends \Myth\Auth\Entities\User
protected $podcasts = [];
/**
* The podcast user is contributing to
* @var \App\Entities\Podcast
* The podcast the user is contributing to
* @var \App\Entities\Podcast|null
*/
protected $podcast;
protected $podcast = null;
/**
* Array of field names and the type of value to cast them as
......@@ -49,6 +49,11 @@ class User extends \Myth\Auth\Entities\User
return $this->podcasts;
}
/**
* Returns a podcast the user is contributing to
*
* @return \App\Entities\Podcast
*/
public function getPodcast()
{
if (empty($this->podcast_id)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment