Skip to content

Commit

Permalink
Updated dependencies + PHP8
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Janda authored and f3l1x committed Jan 6, 2022
1 parent 4207985 commit 81cf9f1
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 143 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ For details on how to use this package, check out our [documentation](.docs).

| State | Version | Branch | Nette | PHP |
|--------|----------|----------|--------|---------|
| dev | `^4.0.0` | `master` | `3.0+` | `>=7.2` |
| stable | `^3.0.0` | `master` | `3.0+` | `>=7.1` |
| dev | `^5.0.0` | `master` | `3.0+` | `>=8.0` |
| stable | `^4.0.0` | `master` | `3.0+` | `>=8.0` |

## Development

Expand Down
13 changes: 9 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
}
},
"require": {
"php": ">= 7.2.0",
"erusev/parsedown": "^1.6",
"php": ">= 8.0",
"erusev/parsedown": "^1.7",
"symfony/console": "^5.0|^6.0",
"matthiasmullie/minify": "^1.3",
"nette/utils": "^3.0"
},
"require-dev": {
"nette/tester": "^2.3",
"nette/tester": "^2.4",
"mockery/mockery": "^1.0",
"contributte/code-rules": "^1.1"
},
Expand All @@ -54,7 +54,12 @@
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
"dev-master": "5.0.x-dev"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
11 changes: 1 addition & 10 deletions src/Console/Utils/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@
final class Logger
{

/**
* @var OutputInterface
*/
private $output;


public function __construct(OutputInterface $output)
{
$this->output = $output;
}
public function __construct(private OutputInterface $output) {}


public function logProcessingFile(string $path): void
Expand Down
11 changes: 1 addition & 10 deletions src/Console/Utils/ParamsValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,7 @@
final class ParamsValidator
{

/**
* @var string
*/
private $binDir;


public function __construct(string $binDir)
{
$this->binDir = $binDir;
}
public function __construct(private string $binDir) {}


/**
Expand Down
9 changes: 1 addition & 8 deletions src/Generator/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,9 @@ final class Assets
*/
private $layoutFavicon;

/**
* @var AuthCredentials
*/
private $authCredentials;


public function __construct(
AuthCredentials $authCredentials,
private AuthCredentials $authCredentials,
?string $addCss
) {
$this->layoutFile = __DIR__ . '/../../assets/layout.php';
Expand All @@ -62,8 +57,6 @@ public function __construct(
__DIR__ . '/../../assets/layout.js',
];
$this->layoutFavicon = __DIR__ . '/../../assets/favicon.ico';

$this->authCredentials = $authCredentials;
}


Expand Down
25 changes: 3 additions & 22 deletions src/Generator/DocuGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,19 @@
final class DocuGenerator
{

/**
* @var string
*/
private $inputDirectory;

/**
* @var string
*/
private $outputDirectory;

/**
* @var AuthCredentials
*/
private $authCredentials;

/**
* @var Parser
*/
private $parser;


public function __construct(
string $inputDirectory,
string $outputDirectory,
private string $inputDirectory,
private string $outputDirectory,
?string $addCss,
AuthCredentials $authCredentials,
private AuthCredentials $authCredentials,
Logger $logger
) {
$this->inputDirectory = $inputDirectory;
$this->outputDirectory = $outputDirectory;
$this->authCredentials = $authCredentials;

$this->parser = new Parser(
true,
$authCredentials,
Expand Down
17 changes: 1 addition & 16 deletions src/Http/AuthCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,7 @@
final class AuthCredentials
{

/**
* @var string|null
*/
private $user;

/**
* @var string|null
*/
private $pass;


public function __construct(?string $user, ?string $pass)
{
$this->user = $user;
$this->pass = $pass;
}
public function __construct(private ?string $user, private ?string $pass) {}


public function getUser(): ?string
Expand Down
10 changes: 1 addition & 9 deletions src/Markdown/DocuScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
final class DocuScope
{

/**
* @var string
*/
private $outputDirectory;

/**
* @var string[]
*/
Expand All @@ -25,10 +20,7 @@ final class DocuScope
private $blockVariables = [];


public function __construct(string $outputDirectory)
{
$this->outputDirectory = $outputDirectory;
}
public function __construct(private string $outputDirectory) {}


public function getOutputDirectory(): string
Expand Down
10 changes: 1 addition & 9 deletions src/Markdown/Macro/AbstractMacroVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,8 @@ abstract class AbstractMacroVariable

protected const MAX_EXECUTE_DEPTH = 3;

/**
* @var DocuScope
*/
protected $docuScope;


public function __construct(DocuScope $docuScope)
{
$this->docuScope = $docuScope;
}
public function __construct(protected DocuScope $docuScope) {}


/**
Expand Down
10 changes: 1 addition & 9 deletions src/Markdown/Macro/Index/AbstractIndexSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,8 @@ abstract class AbstractIndexSection implements IIndexSection
*/
protected static $pattern = '/.+/';

/**
* @var string
*/
private $contentString;


final private function __construct(string $contentString)
{
$this->contentString = $contentString;
}
final private function __construct(private string $contentString) {}


/**
Expand Down
8 changes: 1 addition & 7 deletions src/Markdown/Macro/MacroInlineFileLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,14 @@ final class MacroInlineFileLink implements IMacro

private const LINK_PATTERN = '/\[((?:[^][]++|(?R))*+)\]\(([^\)]*)\)/um';

/**
* @var DocuScope
*/
private $docuScope;

/**
* @var callable
*/
private $fileHashAlgo;


public function __construct(DocuScope $docuScope, ?callable $fileHashAlgo = null)
public function __construct(private DocuScope $docuScope, ?callable $fileHashAlgo = null)
{
$this->docuScope = $docuScope;
$this->fileHashAlgo = $fileHashAlgo ?? [FileHash::class, 'md5File'];
}

Expand Down
9 changes: 1 addition & 8 deletions src/Markdown/Macro/MacroSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,12 @@ final class MacroSection implements IMacro
*/
private $parser;

/**
* @var AuthCredentials
*/
private $authCredentials;


public function __construct(
Logger $logger,
AuthCredentials $authCredentials,
private AuthCredentials $authCredentials,
DocuScope $docuScope
) {
$this->authCredentials = $authCredentials;

$this->parser = new Parser(false, $authCredentials, $logger, $docuScope, null);
}

Expand Down
33 changes: 4 additions & 29 deletions src/Markdown/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,6 @@
final class Parser
{

/**
* @var bool
*/
private $isLayout;

/**
* @var AuthCredentials
*/
private $authCredentials;

/**
* @var Logger
*/
private $logger;

/**
* @var DocuScope
*/
private $docuScope;

/**
* @var CustomParsedown
*/
Expand All @@ -60,17 +40,12 @@ final class Parser


public function __construct(
bool $isLayout,
AuthCredentials $authCredentials,
Logger $logger,
DocuScope $docuScope,
private bool $isLayout,
private AuthCredentials $authCredentials,
private Logger $logger,
private DocuScope $docuScope,
?string $addCss
) {
$this->isLayout = $isLayout;
$this->authCredentials = $authCredentials;
$this->logger = $logger;
$this->docuScope = $docuScope;

$this->parsedown = new CustomParsedown;
$this->assets = new Assets($authCredentials, $addCss);

Expand Down

0 comments on commit 81cf9f1

Please sign in to comment.