fix: declare typed properties in PHPDoc for php<7.4

- fixes error when running castopod on php<7.4

fixes #23
This commit is contained in:
Yassine Doghri 2020-08-05 17:26:04 +00:00
parent 7fb1de2cf3
commit 14dd44d03d
13 changed files with 144 additions and 32 deletions

View File

@ -1,4 +1,4 @@
FROM php:latest
FROM php:7.2-fpm
COPY --from=composer /usr/bin/composer /usr/bin/composer

View File

@ -1,4 +1,4 @@
FROM php:latest
FROM php:7.2-fpm
COPY . /castopod
WORKDIR /castopod

View File

@ -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',
]);

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -13,6 +13,9 @@ use CodeIgniter\Entity;
class Category extends Entity
{
/**
* @var \App\Entity\Category|null
*/
protected $parent;
protected $casts = [

View File

@ -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',

View File

@ -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',

View File

@ -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)) {