diff --git a/generator/src/DocPage.php b/generator/src/DocPage.php index d55204e5..3c040376 100644 --- a/generator/src/DocPage.php +++ b/generator/src/DocPage.php @@ -7,18 +7,12 @@ class DocPage { - /** - * @var string - */ - private $path; - /* * @return string * @parameter string */ - public function __construct(string $_path) + public function __construct(private readonly string $path) { - $this->path = $_path; } // Ignore function if it was removed before PHP 7.1 diff --git a/generator/src/Parameter.php b/generator/src/Parameter.php index 27f86bf4..90d5b7e5 100644 --- a/generator/src/Parameter.php +++ b/generator/src/Parameter.php @@ -7,18 +7,13 @@ class Parameter { - /** - * @var \SimpleXMLElement - */ - private $parameter; /** * @var PhpStanType */ private $type; - public function __construct(\SimpleXMLElement $parameter, ?PhpStanFunction $phpStanFunction, int $position) + public function __construct(private \SimpleXMLElement $parameter, ?PhpStanFunction $phpStanFunction, int $position) { - $this->parameter = $parameter; $phpStanParam = $phpStanFunction ? $phpStanFunction->getParameter($this->getParameterName(), $position) : null; $this->type = $phpStanParam ? $phpStanParam->getType() : new PhpStanType($this->parameter->type->__toString()); //todo: is this if useful? diff --git a/generator/src/Scanner.php b/generator/src/Scanner.php index 67835752..c9fea29f 100644 --- a/generator/src/Scanner.php +++ b/generator/src/Scanner.php @@ -10,11 +10,6 @@ class Scanner { - /** - * @var string - */ - private $path; - /** * @var string[] */ @@ -25,9 +20,8 @@ class Scanner */ private $ignoredModules; - public function __construct(string $path) + public function __construct(private readonly string $path) { - $this->path = $path; } /** diff --git a/generator/src/ScannerResponse.php b/generator/src/ScannerResponse.php index 647db147..775d4c67 100644 --- a/generator/src/ScannerResponse.php +++ b/generator/src/ScannerResponse.php @@ -4,25 +4,19 @@ class ScannerResponse { - /** - * @readonly - * @var Method[] - */ - public array $methods; - - /** - * @readonly - * @var string[] - */ - public array $overloadedFunctions; - /** * @param Method[] $methods * @param string[] $overloadedFunctions */ - public function __construct(array $methods, array $overloadedFunctions) - { - $this->methods = $methods; - $this->overloadedFunctions = $overloadedFunctions; + public function __construct( + /** + * @readonly + */ + public array $methods, + /** + * @readonly + */ + public array $overloadedFunctions + ) { } } diff --git a/generator/src/WritePhpFunction.php b/generator/src/WritePhpFunction.php index f552aae3..cd164869 100644 --- a/generator/src/WritePhpFunction.php +++ b/generator/src/WritePhpFunction.php @@ -4,14 +4,8 @@ class WritePhpFunction { - /** - * @var Method - */ - private $method; - - public function __construct(Method $method) + public function __construct(private Method $method) { - $this->method = $method; } /*