Remove more redundant phpdoc properties

This commit is contained in:
Timothy Warren 2022-03-03 14:20:10 -05:00
parent e70b0fdb40
commit 9b945ca0a5
9 changed files with 125 additions and 41 deletions

2
.gitignore vendored
View File

@ -151,3 +151,5 @@ public/mal_mappings.json
.is-dev .is-dev
tmp tmp
tools/vendor/
tools/phinx/vendor/

View File

@ -38,7 +38,7 @@
"aura/html": "^2.5.0", "aura/html": "^2.5.0",
"aura/router": "^3.1.0", "aura/router": "^3.1.0",
"aura/session": "^2.1.0", "aura/session": "^2.1.0",
"aviat/banker": "^3.0.0 || ^4.0.0", "aviat/banker": "^3.0.0",
"aviat/query": "^3.0.0", "aviat/query": "^3.0.0",
"danielstjules/stringy": "^3.1.0", "danielstjules/stringy": "^3.1.0",
"ext-dom": "*", "ext-dom": "*",
@ -53,7 +53,6 @@
"php": ">= 8.0.0", "php": ">= 8.0.0",
"psr/http-message": "^1.0.1", "psr/http-message": "^1.0.1",
"psr/log": "*", "psr/log": "*",
"robmorgan/phinx": "^0.12.4",
"symfony/polyfill-mbstring": "^1.0.0", "symfony/polyfill-mbstring": "^1.0.0",
"symfony/polyfill-util": "^1.0.0", "symfony/polyfill-util": "^1.0.0",
"tracy/tracy": "^2.8.0", "tracy/tracy": "^2.8.0",

View File

@ -46,27 +46,22 @@ final class SyncLists extends BaseCommand {
/** /**
* Model for making requests to Anilist API * Model for making requests to Anilist API
* @var Anilist\Model
*/ */
private Anilist\Model $anilistModel; private Anilist\Model $anilistModel;
/** /**
* Model for making requests to Kitsu API * Model for making requests to Kitsu API
* @var API\Kitsu\Model
*/ */
private API\Kitsu\Model $kitsuModel; private API\Kitsu\Model $kitsuModel;
/** /**
* Does the Kitsu API have valid authentication? * Does the Kitsu API have valid authentication?
* @var bool
*/ */
private bool $isKitsuAuthenticated = FALSE; private bool $isKitsuAuthenticated = FALSE;
/** /**
* Sync Kitsu <=> Anilist * Sync Kitsu <=> Anilist
* *
* @param array $args
* @param array $options
* @throws ContainerException * @throws ContainerException
* @throws NotFoundException * @throws NotFoundException
* @throws Throwable * @throws Throwable

View File

@ -81,19 +81,9 @@ class Config extends AbstractType {
public ?string $whose_list; public ?string $whose_list;
// ------------------------------------------------------------------------ public array $menus = [];
// Application config
// ------------------------------------------------------------------------
/** public array $routes = [];
* @var array
*/
public array $menus;
/**
* @var array
*/
public array $routes;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Generated config values // Generated config values

View File

@ -24,35 +24,26 @@ use Psr\Log\LoggerInterface;
*/ */
class Container implements ContainerInterface { class Container implements ContainerInterface {
/**
* Array of container Generator functions
*
* @var Callable[]
*/
protected array $container = [];
/** /**
* Array of object instances * Array of object instances
*
* @var array
*/ */
protected array $instances = []; protected array $instances = [];
/** /**
* Map of logger instances * Map of logger instances
*
* @var array
*/ */
protected array $loggers = []; protected array $loggers = [];
/** /**
* Constructor * Constructor
* *
* @param array $values (optional) * @param (callable)[] $container (optional)
*/ */
public function __construct(array $values = []) public function __construct(/**
* Array of container Generator functions
*/
protected array $container = [])
{ {
$this->container = $values;
$this->loggers = []; $this->loggers = [];
} }

View File

@ -26,27 +26,21 @@ use Psr\Http\Message\ResponseInterface;
/** /**
* Base view class for Http output * Base view class for Http output
*/ */
class HttpView implements HttpViewInterface{ class HttpView implements HttpViewInterface, \Stringable{
/** /**
* HTTP response Object * HTTP response Object
*
* @var ResponseInterface
*/ */
public ResponseInterface $response; public ResponseInterface $response;
/** /**
* If the view has sent output via * If the view has sent output via
* __toString or send method * __toString or send method
*
* @var boolean
*/ */
protected bool $hasRendered = FALSE; protected bool $hasRendered = FALSE;
/** /**
* Response mime type * Response mime type
*
* @var string
*/ */
protected string $contentType = ''; protected string $contentType = '';

6
tools/composer.json Normal file
View File

@ -0,0 +1,6 @@
{
"require": {
"friendsofphp/php-cs-fixer": "^3.6",
"rector/rector": "^0.12.16"
}
}

View File

@ -0,0 +1,5 @@
{
"require": {
"robmorgan/phinx": "^0.12.4"
}
}

102
tools/rector.php Normal file
View File

@ -0,0 +1,102 @@
<?php declare(strict_types=1);
use Rector\CodeQuality\Rector\BooleanNot\SimplifyDeMorganBinaryRector;
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector;
use Rector\CodeQuality\Rector\For_\ForToForeachRector;
use Rector\CodeQuality\Rector\If_\ConsecutiveNullCompareReturnsToNullCoalesceQueueRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
use Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector;
use Rector\CodeQuality\Rector\Ternary\SimplifyDuplicatedTernaryRector;
use Rector\CodeQuality\Rector\Ternary\SimplifyTautologyTernaryRector;
use Rector\CodeQuality\Rector\Ternary\SwitchNegatedTernaryRector;
use Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector;
use Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector;
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
use Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector;
use Rector\CodingStyle\Rector\FuncCall\CallUserFuncArrayToVariadicRector;
use Rector\CodingStyle\Rector\FuncCall\CallUserFuncToMethodCallRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
use Rector\Core\Configuration\Option;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector;
use Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector;
use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector;
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
use Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Restoration\Rector\Property\MakeTypedPropertyNullableIfCheckedRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayParamDocTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector;
use Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector;
use Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
if ( ! function_exists('walk_array'))
{
function walk_array(callable $method, array $items): void
{
foreach ($items as $item) {
$method($item);
}
}
}
return static function (ContainerConfigurator $config): void {
$parameters = $config->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, false);
$parameters->set(Option::IMPORT_SHORT_CLASSES, false);
$parameters->set(Option::SKIP, [
ReadOnlyPropertyRector::class,
]);
walk_array([$config, 'import'], [
LevelSetList::UP_TO_PHP_80,
]);
$services = $config->services();
walk_array([$services, 'set'], [
AddArrayDefaultToArrayPropertyRector::class,
AddArrayParamDocTypeRector::class,
AddArrayReturnDocTypeRector::class,
AddClosureReturnTypeRector::class,
AddMethodCallBasedStrictParamTypeRector::class,
CallUserFuncArrayToVariadicRector::class,
CallUserFuncToMethodCallRector::class,
ChangeIfElseValueAssignToEarlyReturnRector::class,
ChangeNestedForeachIfsToEarlyContinueRector::class,
CompleteDynamicPropertiesRector::class,
ConsecutiveNullCompareReturnsToNullCoalesceQueueRector::class,
CountArrayToEmptyArrayComparisonRector::class,
ForRepeatedCountToOwnVariableRector::class,
ForToForeachRector::class,
// MakeTypedPropertyNullableIfCheckedRector::class,
NewlineAfterStatementRector::class,
NewlineBeforeNewAssignSetRector::class,
ParamTypeByMethodCallTypeRector::class,
ParamTypeByParentCallTypeRector::class,
RemoveAlwaysElseRector::class,
RemoveDuplicatedCaseInSwitchRector::class,
RemoveFinalFromConstRector::class,
RemoveUnusedForeachKeyRector::class,
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
RemoveUselessVarTagRector::class,
// SimplifyDeMorganBinaryRector::class,
SimplifyDuplicatedTernaryRector::class,
SimplifyIfElseToTernaryRector::class,
SimplifyIfReturnBoolRector::class,
SimplifyTautologyTernaryRector::class,
SwitchNegatedTernaryRector::class,
TypedPropertyFromAssignsRector::class,
WrapEncapsedVariableInCurlyBracesRector::class,
]);
};