diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1df917..6abc0f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,24 +10,6 @@ jobs: fail-fast: false matrix: include: - - operating-system: 'ubuntu-latest' - php-version: '7.3' - job-description: 'Ubuntu; PHP 7.3; latest-deps' - - - operating-system: 'ubuntu-latest' - php-version: '7.3' - composer-flags: '--prefer-lowest' - job-description: 'Ubuntu; PHP 7.3; lowest-deps' - - - operating-system: 'ubuntu-latest' - php-version: '7.4' - job-description: 'Ubuntu; PHP 7.4; latest-deps' - - - operating-system: 'ubuntu-latest' - php-version: '7.4' - composer-flags: '--prefer-lowest' - job-description: 'Ubuntu; PHP 7.4; lowest-deps' - - operating-system: 'ubuntu-latest' php-version: '8.0' job-description: 'Ubuntu; PHP 8.0; latest-deps' diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 0b23676..c5b8192 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -7,7 +7,7 @@ return (new PhpCsFixer\Config()) ->setRules([ '@Symfony' => true, - '@PHP73Migration' => true, + '@PHP80Migration' => true, 'combine_consecutive_issets' => true, 'combine_consecutive_unsets' => true, diff --git a/composer.json b/composer.json index f0f98eb..abd61da 100644 --- a/composer.json +++ b/composer.json @@ -10,12 +10,12 @@ } ], "require": { - "php": ">=7.3", - "symfony/config": "^4.4||^5.0||^6.0", - "symfony/yaml": "^4.4||^5.0||^6.0" + "php": ">=8.0.2", + "symfony/config": "^5.4||^6.0", + "symfony/yaml": "^5.4||^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^9.5.16", "friendsofphp/php-cs-fixer": "^3.0" }, "autoload": { diff --git a/src/Config.php b/src/Config.php index 1c5461e..971b1ce 100644 --- a/src/Config.php +++ b/src/Config.php @@ -7,7 +7,7 @@ class Config { - private $parameters; + private array $parameters; private function __construct(array $data) { @@ -17,10 +17,7 @@ private function __construct(array $data) ); } - /** - * @return static - */ - public static function createFromYaml(string $configPath): self + public static function createFromYaml(string $configPath): static { return new static(Yaml::parseFile($configPath)); } diff --git a/src/Exception/ParserException.php b/src/Exception/ParserException.php index cff530e..2dea7bc 100644 --- a/src/Exception/ParserException.php +++ b/src/Exception/ParserException.php @@ -4,8 +4,8 @@ class ParserException extends \Exception { - private $errorLogLine; - private $pattern; + private ?string $errorLogLine = null; + private ?string $pattern = null; public function getErrorLogLine(): ?string { diff --git a/src/Iterator.php b/src/Iterator.php index a71e24c..f886250 100644 --- a/src/Iterator.php +++ b/src/Iterator.php @@ -6,38 +6,22 @@ class Iterator implements \Iterator { - /** - * @var Parser - */ - private $parser; + private Parser $parser; - /** - * @var string - */ - private $logFile; + private string $logFile; /** * @var resource */ private $fileHandler; - /** - * @var string|null - */ - private $currentLine; + private ?string $currentLine = null; - /** - * @var bool - */ - private $skipEmptyLines; - /** - * @var int - */ - private $seek; - /** - * @var string - */ - private $name; + private bool $skipEmptyLines; + + private ?int $seek = null; + + private string $name = ''; public function __construct(string $logFile, Parser $parser, bool $skipEmptyLines = true) { @@ -46,9 +30,6 @@ public function __construct(string $logFile, Parser $parser, bool $skipEmptyLine $this->skipEmptyLines = $skipEmptyLines; } - /** - * Destructor. - */ public function __destruct() { @\fclose($this->fileHandler); diff --git a/src/Logio.php b/src/Logio.php index 8c19ef8..cd8c39d 100644 --- a/src/Logio.php +++ b/src/Logio.php @@ -7,7 +7,7 @@ class Logio /** * @var Parser[] */ - private $parsers = []; + private array $parsers = []; public function __construct(Config $config) { diff --git a/src/Parser.php b/src/Parser.php index 46ba730..2fda794 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -6,8 +6,8 @@ class Parser { - protected $name; - protected $parameters; + protected string $name; + protected array $parameters; public function __construct(string $name, array $parameters) { diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index 6fde190..82f6673 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -8,7 +8,7 @@ class ConfigTest extends TestCase { - private $fixturesDir = __DIR__.'/fixtures'; + private string $fixturesDir = __DIR__.'/fixtures'; public function testConfigSuccess(): void { diff --git a/tests/LogioTest.php b/tests/LogioTest.php index f0814d9..08c671b 100644 --- a/tests/LogioTest.php +++ b/tests/LogioTest.php @@ -10,11 +10,8 @@ class LogioTest extends TestCase { - private $fixturesDir = __DIR__.'/fixtures'; - /** - * @var Config - */ - private $config; + private string $fixturesDir = __DIR__.'/fixtures'; + private Config $config; protected function setUp(): void { diff --git a/tests/ParserTest.php b/tests/ParserTest.php index 1c46220..6425d72 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -8,11 +8,8 @@ class ParserTest extends TestCase { - private $fixturesDir = __DIR__.'/fixtures'; - /** - * @var Config - */ - private $config; + private string $fixturesDir = __DIR__.'/fixtures'; + private Config $config; protected function setUp(): void {