Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\CodingStyle\Rector\FuncCall\FunctionFirstClassCallableRector;
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Config\RectorConfig;
Expand All @@ -24,7 +21,4 @@
])
->withSkip([
ClassPropertyAssignToConstructorPromotionRector::class,
ReadOnlyPropertyRector::class,
FunctionFirstClassCallableRector::class,
ArrayToFirstClassCallableRector::class,
]);
2 changes: 1 addition & 1 deletion src/App/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class App
{
private static ?AppContext $context = null;

private AppInterface $adapter;
private readonly AppInterface $adapter;

public function __construct(AppInterface $adapter)
{
Expand Down
6 changes: 3 additions & 3 deletions src/App/AppContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
*/
class AppContext
{
private string $baseDir;
private readonly string $baseDir;

private DiContainer $container;
private readonly DiContainer $container;

private string $type;
private readonly string $type;

private bool $stopped = false;

Expand Down
4 changes: 2 additions & 2 deletions src/App/Pipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ final class Pipeline
/**
* @var array<StageInterface<TContext>>
*/
private array $stages;
private readonly array $stages;

/**
* @var StageInterface<TContext>|null
*/
private ?StageInterface $closingStage;
private readonly ?StageInterface $closingStage;

/**
* @param array<StageInterface<TContext>> $stages
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/Adapters/PharAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
class PharAdapter implements ArchiveInterface
{
private FileSystem $fs;
private readonly FileSystem $fs;

private ?string $archiveName = null;

Expand Down
2 changes: 1 addition & 1 deletion src/Archive/Adapters/ZipAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
class ZipAdapter implements ArchiveInterface
{
private FileSystem $fs;
private readonly FileSystem $fs;

private ?string $archiveName = null;

Expand Down
2 changes: 1 addition & 1 deletion src/Archive/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
class Archive
{
private ArchiveInterface $adapter;
private readonly ArchiveInterface $adapter;

public function __construct(ArchiveInterface $adapter)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Asset/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ class Asset
*/
public const JS = 2;

private int $type;
private readonly int $type;

private string $path;
private readonly string $path;

private ?string $name;
private readonly ?string $name;

/**
* @var array<string>|null
*/
private ?array $attributes;
private readonly ?array $attributes;

private int $position;
private readonly int $position;

/**
* Asset templates
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
class Auth
{
private AuthenticatableInterface $adapter;
private readonly AuthenticatableInterface $adapter;

public function __construct(AuthenticatableInterface $adapter)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/
class Cache
{
private CacheInterface $adapter;
private readonly CacheInterface $adapter;

/**
* Cache constructor
Expand Down
2 changes: 1 addition & 1 deletion src/Captcha/Captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
class Captcha
{
private CaptchaInterface $adapter;
private readonly CaptchaInterface $adapter;

public function __construct(CaptchaInterface $adapter)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Cron/CronLock.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
*/
class CronLock
{
private string $lockDirectory;
private readonly string $lockDirectory;

private string $taskName;
private readonly string $taskName;

private string $lockFile;
private readonly string $lockFile;

/** @var resource|null */
private $lockHandle;

private bool $ownsLock = false;

private int $maxLockAge;
private readonly int $maxLockAge;

private const DEFAULT_MAX_LOCK_AGE = 86400;

Expand Down
2 changes: 1 addition & 1 deletion src/Cron/CronTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CronTask implements CronTaskInterface
/**
* Task name
*/
private string $name;
private readonly string $name;

/**
* Task callback
Expand Down
2 changes: 1 addition & 1 deletion src/Cron/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Schedule
/**
* Task name
*/
private string $name;
private readonly string $name;

/**
* Cron expression
Expand Down
4 changes: 2 additions & 2 deletions src/Csrf/Csrf.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ class Csrf
*/
public const TOKEN_KEY = 'csrf-token';

private Session $storage;
private readonly Session $storage;

private Hasher $hasher;
private readonly Hasher $hasher;

/**
* @throws ConfigException
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Schemas/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Column
*/
public const ATTR_ZEROFILL = 'UNSIGNED ZEROFILL';

private string $name;
private readonly string $name;

private ?string $newName = null;

Expand Down
4 changes: 2 additions & 2 deletions src/Debugger/Debugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ class Debugger
/**
* Store
*/
private DebuggerStore $store;
private readonly DebuggerStore $store;

/**
* DebugBar instance
*/
private DebugBar $debugBar;
private readonly DebugBar $debugBar;

/**
* Assets url
Expand Down
2 changes: 1 addition & 1 deletion src/Di/DiContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/
class DiContainer
{
private DiRegistry $registry;
private readonly DiRegistry $registry;

/**
* @var array<string, object>
Expand Down
2 changes: 1 addition & 1 deletion src/Encryption/Adapters/SymmetricEncryptionAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SymmetricEncryptionAdapter implements EncryptionInterface
*/
public const CIPHER_METHOD = 'aes-256-cbc';

private string $appKey;
private readonly string $appKey;

/**
* @throws BaseException|ReflectionException
Expand Down
2 changes: 1 addition & 1 deletion src/Encryption/Cryptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
class Cryptor
{
private EncryptionInterface $adapter;
private readonly EncryptionInterface $adapter;

public function __construct(EncryptionInterface $adapter)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Traits/Request/Body.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function get(string $key, ?string $default = null, bool $raw = false)
}

return is_array($value)
? array_map('strip_tags', $value)
? array_map(strip_tags(...), $value)
: strip_tags($value);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Jwt/JwtToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class JwtToken extends JWT
/**
* JWT secret key
*/
private string $key;
private readonly string $key;

/**
* Encryption algorithm
Expand Down
2 changes: 1 addition & 1 deletion src/Lang/Lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Lang
{
private ?string $currentLang = null;

private LangAdapterInterface $adapter;
private readonly LangAdapterInterface $adapter;

public function __construct(string $lang, LangAdapterInterface $adapter)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Logger/Adapters/MessageAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MessageAdapter implements ReportableInterface
/**
* The number of last messages kept; 0 keeps every message
*/
private int $limit;
private readonly int $limit;

public function __construct(int $limit = 1000)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Logger/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
class Logger implements LoggerInterface
{
private ReportableInterface $adapter;
private readonly ReportableInterface $adapter;

public function __construct(ReportableInterface $adapter)
{
Expand Down
14 changes: 7 additions & 7 deletions src/Mailer/MailTrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
*/
class MailTrap
{
private FileSystem $fs;
private readonly FileSystem $fs;

private MessageParser $parser;
private readonly MessageParser $parser;

/**
* @var MessagePart|MessagePartInterface
*/
private $message;

private string $emailsDirectory;
private readonly string $emailsDirectory;

/**
* @throws BaseException
Expand Down Expand Up @@ -126,7 +126,7 @@ public function getParsedDate(): ?string
public function getParsedToAddresses(): array
{
$addresses = explode(',', $this->message->getHeaderValue('to'));
return array_map('trim', $addresses);
return array_map(trim(...), $addresses);
}

/**
Expand All @@ -144,7 +144,7 @@ public function getParsedFromAddress(): ?string
public function getParsedCcAddresses(): array
{
$addresses = explode(',', $this->message->getHeaderValue('cc'));
return array_map('trim', $addresses);
return array_map(trim(...), $addresses);
}

/**
Expand All @@ -154,7 +154,7 @@ public function getParsedCcAddresses(): array
public function getParsedBccAddresses(): array
{
$addresses = explode(',', $this->message->getHeaderValue('bcc'));
return array_map('trim', $addresses);
return array_map(trim(...), $addresses);
}

/**
Expand All @@ -164,7 +164,7 @@ public function getParsedBccAddresses(): array
public function getParsedReplyToAddresses(): array
{
$addresses = explode(',', $this->message->getHeaderValue('reply-to'));
return array_map('trim', $addresses);
return array_map(trim(...), $addresses);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Mailer/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/
class Mailer
{
private MailerInterface $adapter;
private readonly MailerInterface $adapter;

public function __construct(MailerInterface $adapter)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Middleware/MiddlewareManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ class MiddlewareManager
/**
* Current module
*/
private ?string $module;
private readonly ?string $module;

private Route $route;
private readonly Route $route;

private bool $hasRateLimit;
private readonly bool $hasRateLimit;

public function __construct(MatchedRoute $matchedRoute)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Migration/MigrationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ class MigrationManager
*/
private array $migrations = [];

private TableFactory $tableFactory;
private readonly TableFactory $tableFactory;

private string $migrationFolder;
private readonly string $migrationFolder;

private FileSystem $fs;
private readonly FileSystem $fs;

private Database $db;
private readonly Database $db;

/**
* @throws BaseException|ConfigException|DiException|FileSystemException|ReflectionException
Expand Down
2 changes: 1 addition & 1 deletion src/Module/ModuleLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ModuleLoader
/** @var array<string, Closure> */
private array $moduleRouteClosures = [];

private FileSystem $fs;
private readonly FileSystem $fs;

/**
* @throws ModuleException|ConfigException|DiException|BaseException|ReflectionException
Expand Down
Loading
Loading