mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-05 08:52:00 +00:00
ci: fix rector issues for code-review job to pass
This commit is contained in:
parent
b51072434b
commit
1a024bdec7
@ -54,7 +54,7 @@ static-analysis:
|
|||||||
code-review:
|
code-review:
|
||||||
stage: quality
|
stage: quality
|
||||||
script:
|
script:
|
||||||
- vendor/bin/rector process --dry-run --ansi --verbose
|
- vendor/bin/rector process --dry-run --ansi
|
||||||
|
|
||||||
bundle_app:
|
bundle_app:
|
||||||
stage: bundle
|
stage: bundle
|
||||||
|
@ -19,8 +19,10 @@ class Pager extends BaseConfig
|
|||||||
* and the desired group as $pagerGroup;
|
* and the desired group as $pagerGroup;
|
||||||
*
|
*
|
||||||
* @var array<string, string>
|
* @var array<string, string>
|
||||||
|
*
|
||||||
|
* @noRector Rector\Php55\Rector\String_\StringClassNameToClassConstantRector
|
||||||
*/
|
*/
|
||||||
public array $templates = [
|
public $templates = [
|
||||||
'default_full' => 'App\Views\pager\default_full',
|
'default_full' => 'App\Views\pager\default_full',
|
||||||
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
|
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
|
||||||
'default_head' => 'CodeIgniter\Pager\Views\default_head',
|
'default_head' => 'CodeIgniter\Pager\Views\default_head',
|
||||||
|
@ -31,6 +31,8 @@ class Services extends BaseService
|
|||||||
/**
|
/**
|
||||||
* The Router class uses a RouteCollection's array of routes, and determines the correct Controller and Method to
|
* The Router class uses a RouteCollection's array of routes, and determines the correct Controller and Method to
|
||||||
* execute.
|
* execute.
|
||||||
|
*
|
||||||
|
* @noRector PHPStan\Reflection\MissingMethodFromReflectionException
|
||||||
*/
|
*/
|
||||||
public static function router(
|
public static function router(
|
||||||
?RouteCollectionInterface $routes = null,
|
?RouteCollectionInterface $routes = null,
|
||||||
@ -50,6 +52,8 @@ class Services extends BaseService
|
|||||||
/**
|
/**
|
||||||
* The Negotiate class provides the content negotiation features for working the request to determine correct
|
* The Negotiate class provides the content negotiation features for working the request to determine correct
|
||||||
* language, encoding, charset, and more.
|
* language, encoding, charset, and more.
|
||||||
|
*
|
||||||
|
* @noRector PHPStan\Reflection\MissingMethodFromReflectionException
|
||||||
*/
|
*/
|
||||||
public static function negotiator(?RequestInterface $request = null, bool $getShared = true): Negotiate
|
public static function negotiator(?RequestInterface $request = null, bool $getShared = true): Negotiate
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ class ContributorController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$this->user = (new UserModel())->getPodcastContributor((int) $params[1], (int) $params[0],)
|
($this->user = (new UserModel())->getPodcastContributor((int) $params[1], (int) $params[0],)) !== null
|
||||||
) {
|
) {
|
||||||
return $this->{$method}();
|
return $this->{$method}();
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class InstallController extends Controller
|
|||||||
if (is_really_writable(ROOTPATH . '.env')) {
|
if (is_really_writable(ROOTPATH . '.env')) {
|
||||||
try {
|
try {
|
||||||
$dotenv->required(['app.baseURL', 'app.adminGateway', 'app.authGateway']);
|
$dotenv->required(['app.baseURL', 'app.adminGateway', 'app.authGateway']);
|
||||||
} catch (ValidationException $e) {
|
} catch (ValidationException) {
|
||||||
// form to input instance configuration
|
// form to input instance configuration
|
||||||
return $this->instanceConfig();
|
return $this->instanceConfig();
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ class InstallController extends Controller
|
|||||||
'database.default.password',
|
'database.default.password',
|
||||||
'database.default.DBPrefix',
|
'database.default.DBPrefix',
|
||||||
]);
|
]);
|
||||||
} catch (ValidationException $validationException) {
|
} catch (ValidationException) {
|
||||||
return $this->databaseConfig();
|
return $this->databaseConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ class InstallController extends Controller
|
|||||||
$keyVal = $key . '="' . $value . '"' . PHP_EOL;
|
$keyVal = $key . '="' . $value . '"' . PHP_EOL;
|
||||||
$envData = array_map(
|
$envData = array_map(
|
||||||
function ($line) use ($key, $keyVal, &$replaced) {
|
function ($line) use ($key, $keyVal, &$replaced) {
|
||||||
if (str_starts_with($line, (string) $key)) {
|
if (str_starts_with($line, $key)) {
|
||||||
$replaced = true;
|
$replaced = true;
|
||||||
return $keyVal;
|
return $keyVal;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,9 @@ class Category extends Entity
|
|||||||
'google_category' => 'string',
|
'google_category' => 'string',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @noRector ReturnTypeDeclarationRector
|
||||||
|
*/
|
||||||
public function getParent(): ?self
|
public function getParent(): ?self
|
||||||
{
|
{
|
||||||
if ($this->parent_id === null) {
|
if ($this->parent_id === null) {
|
||||||
|
@ -426,6 +426,7 @@ if (! function_exists('person_list')) {
|
|||||||
$person->full_name .
|
$person->full_name .
|
||||||
'</strong>' .
|
'</strong>' .
|
||||||
implode(
|
implode(
|
||||||
|
'',
|
||||||
array_map(function ($role) {
|
array_map(function ($role) {
|
||||||
return '<br />' .
|
return '<br />' .
|
||||||
lang(
|
lang(
|
||||||
@ -443,9 +444,7 @@ if (! function_exists('person_list')) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$personList .= '</div>';
|
return $personList . '</div>';
|
||||||
|
|
||||||
return $personList;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ if (! function_exists('split_handle')) {
|
|||||||
*
|
*
|
||||||
* @return array<string, string>|false
|
* @return array<string, string>|false
|
||||||
*/
|
*/
|
||||||
function split_handle(string $handle)
|
function split_handle(string $handle): array | false
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
! preg_match('~^@?(?P<username>[\w\.\-]+)@(?P<domain>[\w\.\-]+)(?P<port>:[\d]+)?$~', $handle, $matches,)
|
! preg_match('~^@?(?P<username>[\w\.\-]+)@(?P<domain>[\w\.\-]+)(?P<port>:[\d]+)?$~', $handle, $matches,)
|
||||||
@ -106,9 +106,9 @@ if (! function_exists('send_activity_to_followers')) {
|
|||||||
$acceptRequest = new ActivityRequest($follower->inbox_url, $activityPayload,);
|
$acceptRequest = new ActivityRequest($follower->inbox_url, $activityPayload,);
|
||||||
$acceptRequest->sign($actor->public_key_id, $actor->private_key,);
|
$acceptRequest->sign($actor->public_key_id, $actor->private_key,);
|
||||||
$acceptRequest->post();
|
$acceptRequest->post();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $exception) {
|
||||||
// log error
|
// log error
|
||||||
log_message('critical', $e);
|
log_message('critical', $exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ namespace App\Models;
|
|||||||
use App\Entities\Image;
|
use App\Entities\Image;
|
||||||
use App\Entities\Person;
|
use App\Entities\Person;
|
||||||
use CodeIgniter\Database\BaseResult;
|
use CodeIgniter\Database\BaseResult;
|
||||||
|
use CodeIgniter\Database\Query;
|
||||||
use CodeIgniter\Model;
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
class PersonModel extends Model
|
class PersonModel extends Model
|
||||||
@ -171,7 +172,6 @@ class PersonModel extends Model
|
|||||||
->getLocale();
|
->getLocale();
|
||||||
$cacheName = "taxonomy_options_{$locale}";
|
$cacheName = "taxonomy_options_{$locale}";
|
||||||
|
|
||||||
/** @var array<string, array> */
|
|
||||||
$personsTaxonomy = lang('PersonsTaxonomy.persons');
|
$personsTaxonomy = lang('PersonsTaxonomy.persons');
|
||||||
|
|
||||||
if (! ($options = cache($cacheName))) {
|
if (! ($options = cache($cacheName))) {
|
||||||
@ -254,7 +254,7 @@ class PersonModel extends Model
|
|||||||
int $personId,
|
int $personId,
|
||||||
string $groupSlug,
|
string $groupSlug,
|
||||||
string $roleSlug
|
string $roleSlug
|
||||||
): int | bool {
|
): bool | Query {
|
||||||
return $this->db->table('episodes_persons')
|
return $this->db->table('episodes_persons')
|
||||||
->insert([
|
->insert([
|
||||||
'podcast_id' => $podcastId,
|
'podcast_id' => $podcastId,
|
||||||
@ -270,7 +270,7 @@ class PersonModel extends Model
|
|||||||
int $personId,
|
int $personId,
|
||||||
string $groupSlug,
|
string $groupSlug,
|
||||||
string $roleSlug
|
string $roleSlug
|
||||||
): int | bool {
|
): bool | Query {
|
||||||
return $this->db->table('podcasts_persons')
|
return $this->db->table('podcasts_persons')
|
||||||
->insert([
|
->insert([
|
||||||
'podcast_id' => $podcastId,
|
'podcast_id' => $podcastId,
|
||||||
@ -329,7 +329,7 @@ class PersonModel extends Model
|
|||||||
*
|
*
|
||||||
* @return BaseResult|bool Number of rows inserted or FALSE on failure
|
* @return BaseResult|bool Number of rows inserted or FALSE on failure
|
||||||
*/
|
*/
|
||||||
public function removePersonFromPodcast(int $podcastId, int $personId): BaseResult | bool
|
public function removePersonFromPodcast(int $podcastId, int $personId): bool | string
|
||||||
{
|
{
|
||||||
return $this->db->table('podcasts_persons')
|
return $this->db->table('podcasts_persons')
|
||||||
->delete([
|
->delete([
|
||||||
@ -384,10 +384,7 @@ class PersonModel extends Model
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function removePersonFromEpisode(int $podcastId, int $episodeId, int $personId): bool | string
|
||||||
* @return BaseResult|bool
|
|
||||||
*/
|
|
||||||
public function removePersonFromEpisode(int $podcastId, int $episodeId, int $personId): BaseResult | bool
|
|
||||||
{
|
{
|
||||||
return $this->db->table('episodes_persons')
|
return $this->db->table('episodes_persons')
|
||||||
->delete([
|
->delete([
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"mikey179/vfsstream": "^v1.6.8",
|
"mikey179/vfsstream": "^v1.6.8",
|
||||||
"phpunit/phpunit": "^9.5.4",
|
"phpunit/phpunit": "^9.5.4",
|
||||||
"rector/rector": "^0.10.22",
|
"rector/rector": "^0.11.5",
|
||||||
"captainhook/captainhook": "^5.10.0",
|
"captainhook/captainhook": "^5.10.0",
|
||||||
"captainhook/plugin-composer": "^5.2",
|
"captainhook/plugin-composer": "^5.2",
|
||||||
"phpstan/phpstan": "^0.12.85",
|
"phpstan/phpstan": "^0.12.85",
|
||||||
|
15
composer.lock
generated
15
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "906f0d5a3cf8e20fa22205278198f8f3",
|
"content-hash": "f66c02dfe61b7fe87d93f4db5a1f9c26",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "brick/math",
|
"name": "brick/math",
|
||||||
@ -3730,16 +3730,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "rector/rector",
|
"name": "rector/rector",
|
||||||
"version": "dev-main",
|
"version": "0.11.5",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/rectorphp/rector.git",
|
"url": "https://github.com/rectorphp/rector.git",
|
||||||
"reference": "feba977d4e85ffc9269b84f8fcaa37b7aecc3e05"
|
"reference": "270eaef34d0f34b49ad0fc3e44cff377b9aa04ce"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/rectorphp/rector/zipball/feba977d4e85ffc9269b84f8fcaa37b7aecc3e05",
|
"url": "https://api.github.com/repos/rectorphp/rector/zipball/270eaef34d0f34b49ad0fc3e44cff377b9aa04ce",
|
||||||
"reference": "feba977d4e85ffc9269b84f8fcaa37b7aecc3e05",
|
"reference": "270eaef34d0f34b49ad0fc3e44cff377b9aa04ce",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -3757,7 +3757,6 @@
|
|||||||
"rector/rector-prefixed": "*",
|
"rector/rector-prefixed": "*",
|
||||||
"rector/rector-symfony": "*"
|
"rector/rector-symfony": "*"
|
||||||
},
|
},
|
||||||
"default-branch": true,
|
|
||||||
"bin": [
|
"bin": [
|
||||||
"bin/rector"
|
"bin/rector"
|
||||||
],
|
],
|
||||||
@ -3779,7 +3778,7 @@
|
|||||||
"description": "Prefixed and PHP 7.1 downgraded version of rector/rector",
|
"description": "Prefixed and PHP 7.1 downgraded version of rector/rector",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/rectorphp/rector/issues",
|
"issues": "https://github.com/rectorphp/rector/issues",
|
||||||
"source": "https://github.com/rectorphp/rector/tree/main"
|
"source": "https://github.com/rectorphp/rector/tree/0.11.5"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -3787,7 +3786,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-05-19T14:34:37+00:00"
|
"time": "2021-05-18T13:45:09+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "rector/rector-phpstan-rules",
|
"name": "rector/rector-phpstan-rules",
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
use Config\Paths;
|
use Config\Paths;
|
||||||
|
|
||||||
// Valid PHP Version?
|
// Valid PHP Version?
|
||||||
$minPHPVersion = '8.0';
|
$minPHPVersionId = 80000; // 8.0
|
||||||
if (version_compare(PHP_VERSION, $minPHPVersion, '<')) {
|
if ($minPHPVersionId > PHP_VERSION_ID) {
|
||||||
die(
|
die(
|
||||||
"Your PHP version must be {$minPHPVersion} or higher to run CodeIgniter. Current version: " .
|
'Your PHP version must be 8.0 or higher to run Castopod Host. Current version: ' .
|
||||||
PHP_VERSION
|
PHP_VERSION
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ namespace Tests\Support;
|
|||||||
|
|
||||||
use CodeIgniter\Test\CIUnitTestCase;
|
use CodeIgniter\Test\CIUnitTestCase;
|
||||||
use CodeIgniter\Test\DatabaseTestTrait;
|
use CodeIgniter\Test\DatabaseTestTrait;
|
||||||
|
use Tests\Support\Database\Seeds\ExampleSeeder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @phpstan-ignore-next-line
|
* @phpstan-ignore-next-line
|
||||||
@ -24,7 +25,7 @@ class DatabaseTestCase extends CIUnitTestCase
|
|||||||
*
|
*
|
||||||
* @var string|string[]
|
* @var string|string[]
|
||||||
*/
|
*/
|
||||||
protected $seed = 'Tests\Support\Database\Seeds\ExampleSeeder';
|
protected $seed = ExampleSeeder::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The path to the seeds directory. Allows overriding the default application directories.
|
* The path to the seeds directory. Allows overriding the default application directories.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user