mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-03 16:02:02 +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:
|
||||
stage: quality
|
||||
script:
|
||||
- vendor/bin/rector process --dry-run --ansi --verbose
|
||||
- vendor/bin/rector process --dry-run --ansi
|
||||
|
||||
bundle_app:
|
||||
stage: bundle
|
||||
|
@ -19,8 +19,10 @@ class Pager extends BaseConfig
|
||||
* and the desired group as $pagerGroup;
|
||||
*
|
||||
* @var array<string, string>
|
||||
*
|
||||
* @noRector Rector\Php55\Rector\String_\StringClassNameToClassConstantRector
|
||||
*/
|
||||
public array $templates = [
|
||||
public $templates = [
|
||||
'default_full' => 'App\Views\pager\default_full',
|
||||
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
|
||||
'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
|
||||
* execute.
|
||||
*
|
||||
* @noRector PHPStan\Reflection\MissingMethodFromReflectionException
|
||||
*/
|
||||
public static function router(
|
||||
?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
|
||||
* language, encoding, charset, and more.
|
||||
*
|
||||
* @noRector PHPStan\Reflection\MissingMethodFromReflectionException
|
||||
*/
|
||||
public static function negotiator(?RequestInterface $request = null, bool $getShared = true): Negotiate
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ class ContributorController extends BaseController
|
||||
}
|
||||
|
||||
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}();
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class InstallController extends Controller
|
||||
if (is_really_writable(ROOTPATH . '.env')) {
|
||||
try {
|
||||
$dotenv->required(['app.baseURL', 'app.adminGateway', 'app.authGateway']);
|
||||
} catch (ValidationException $e) {
|
||||
} catch (ValidationException) {
|
||||
// form to input instance configuration
|
||||
return $this->instanceConfig();
|
||||
}
|
||||
@ -81,7 +81,7 @@ class InstallController extends Controller
|
||||
'database.default.password',
|
||||
'database.default.DBPrefix',
|
||||
]);
|
||||
} catch (ValidationException $validationException) {
|
||||
} catch (ValidationException) {
|
||||
return $this->databaseConfig();
|
||||
}
|
||||
|
||||
@ -343,7 +343,7 @@ class InstallController extends Controller
|
||||
$keyVal = $key . '="' . $value . '"' . PHP_EOL;
|
||||
$envData = array_map(
|
||||
function ($line) use ($key, $keyVal, &$replaced) {
|
||||
if (str_starts_with($line, (string) $key)) {
|
||||
if (str_starts_with($line, $key)) {
|
||||
$replaced = true;
|
||||
return $keyVal;
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ class Category extends Entity
|
||||
'google_category' => 'string',
|
||||
];
|
||||
|
||||
/**
|
||||
* @noRector ReturnTypeDeclarationRector
|
||||
*/
|
||||
public function getParent(): ?self
|
||||
{
|
||||
if ($this->parent_id === null) {
|
||||
|
@ -426,6 +426,7 @@ if (! function_exists('person_list')) {
|
||||
$person->full_name .
|
||||
'</strong>' .
|
||||
implode(
|
||||
'',
|
||||
array_map(function ($role) {
|
||||
return '<br />' .
|
||||
lang(
|
||||
@ -443,9 +444,7 @@ if (! function_exists('person_list')) {
|
||||
);
|
||||
}
|
||||
|
||||
$personList .= '</div>';
|
||||
|
||||
return $personList;
|
||||
return $personList . '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ if (! function_exists('split_handle')) {
|
||||
*
|
||||
* @return array<string, string>|false
|
||||
*/
|
||||
function split_handle(string $handle)
|
||||
function split_handle(string $handle): array | false
|
||||
{
|
||||
if (
|
||||
! 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->sign($actor->public_key_id, $actor->private_key,);
|
||||
$acceptRequest->post();
|
||||
} catch (Exception $e) {
|
||||
} catch (Exception $exception) {
|
||||
// log error
|
||||
log_message('critical', $e);
|
||||
log_message('critical', $exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ namespace App\Models;
|
||||
use App\Entities\Image;
|
||||
use App\Entities\Person;
|
||||
use CodeIgniter\Database\BaseResult;
|
||||
use CodeIgniter\Database\Query;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class PersonModel extends Model
|
||||
@ -171,7 +172,6 @@ class PersonModel extends Model
|
||||
->getLocale();
|
||||
$cacheName = "taxonomy_options_{$locale}";
|
||||
|
||||
/** @var array<string, array> */
|
||||
$personsTaxonomy = lang('PersonsTaxonomy.persons');
|
||||
|
||||
if (! ($options = cache($cacheName))) {
|
||||
@ -254,7 +254,7 @@ class PersonModel extends Model
|
||||
int $personId,
|
||||
string $groupSlug,
|
||||
string $roleSlug
|
||||
): int | bool {
|
||||
): bool | Query {
|
||||
return $this->db->table('episodes_persons')
|
||||
->insert([
|
||||
'podcast_id' => $podcastId,
|
||||
@ -270,7 +270,7 @@ class PersonModel extends Model
|
||||
int $personId,
|
||||
string $groupSlug,
|
||||
string $roleSlug
|
||||
): int | bool {
|
||||
): bool | Query {
|
||||
return $this->db->table('podcasts_persons')
|
||||
->insert([
|
||||
'podcast_id' => $podcastId,
|
||||
@ -329,7 +329,7 @@ class PersonModel extends Model
|
||||
*
|
||||
* @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')
|
||||
->delete([
|
||||
@ -384,10 +384,7 @@ class PersonModel extends Model
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseResult|bool
|
||||
*/
|
||||
public function removePersonFromEpisode(int $podcastId, int $episodeId, int $personId): BaseResult | bool
|
||||
public function removePersonFromEpisode(int $podcastId, int $episodeId, int $personId): bool | string
|
||||
{
|
||||
return $this->db->table('episodes_persons')
|
||||
->delete([
|
||||
|
@ -25,7 +25,7 @@
|
||||
"require-dev": {
|
||||
"mikey179/vfsstream": "^v1.6.8",
|
||||
"phpunit/phpunit": "^9.5.4",
|
||||
"rector/rector": "^0.10.22",
|
||||
"rector/rector": "^0.11.5",
|
||||
"captainhook/captainhook": "^5.10.0",
|
||||
"captainhook/plugin-composer": "^5.2",
|
||||
"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",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "906f0d5a3cf8e20fa22205278198f8f3",
|
||||
"content-hash": "f66c02dfe61b7fe87d93f4db5a1f9c26",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@ -3730,16 +3730,16 @@
|
||||
},
|
||||
{
|
||||
"name": "rector/rector",
|
||||
"version": "dev-main",
|
||||
"version": "0.11.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rectorphp/rector.git",
|
||||
"reference": "feba977d4e85ffc9269b84f8fcaa37b7aecc3e05"
|
||||
"reference": "270eaef34d0f34b49ad0fc3e44cff377b9aa04ce"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/rectorphp/rector/zipball/feba977d4e85ffc9269b84f8fcaa37b7aecc3e05",
|
||||
"reference": "feba977d4e85ffc9269b84f8fcaa37b7aecc3e05",
|
||||
"url": "https://api.github.com/repos/rectorphp/rector/zipball/270eaef34d0f34b49ad0fc3e44cff377b9aa04ce",
|
||||
"reference": "270eaef34d0f34b49ad0fc3e44cff377b9aa04ce",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -3757,7 +3757,6 @@
|
||||
"rector/rector-prefixed": "*",
|
||||
"rector/rector-symfony": "*"
|
||||
},
|
||||
"default-branch": true,
|
||||
"bin": [
|
||||
"bin/rector"
|
||||
],
|
||||
@ -3779,7 +3778,7 @@
|
||||
"description": "Prefixed and PHP 7.1 downgraded version of rector/rector",
|
||||
"support": {
|
||||
"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": [
|
||||
{
|
||||
@ -3787,7 +3786,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2021-05-19T14:34:37+00:00"
|
||||
"time": "2021-05-18T13:45:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "rector/rector-phpstan-rules",
|
||||
|
@ -3,10 +3,10 @@
|
||||
use Config\Paths;
|
||||
|
||||
// Valid PHP Version?
|
||||
$minPHPVersion = '8.0';
|
||||
if (version_compare(PHP_VERSION, $minPHPVersion, '<')) {
|
||||
$minPHPVersionId = 80000; // 8.0
|
||||
if ($minPHPVersionId > PHP_VERSION_ID) {
|
||||
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
|
||||
);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ namespace Tests\Support;
|
||||
|
||||
use CodeIgniter\Test\CIUnitTestCase;
|
||||
use CodeIgniter\Test\DatabaseTestTrait;
|
||||
use Tests\Support\Database\Seeds\ExampleSeeder;
|
||||
|
||||
/**
|
||||
* @phpstan-ignore-next-line
|
||||
@ -24,7 +25,7 @@ class DatabaseTestCase extends CIUnitTestCase
|
||||
*
|
||||
* @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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user