diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 139627b..f7afeec 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -4,3 +4,4 @@ parameters: - src typeAliases: JsonType: 'string|int|bool|float|null|array|array' + treatPhpDocTypesAsCertain: false diff --git a/src/Schema/StandardRepresentativeTree.php b/src/Schema/StandardRepresentativeTree.php index f462563..0296bb1 100644 --- a/src/Schema/StandardRepresentativeTree.php +++ b/src/Schema/StandardRepresentativeTree.php @@ -26,7 +26,7 @@ class StandardRepresentativeTree /** - * trees per hectare + * Volume per hectare * @var float */ public $volumePerHa; diff --git a/src/Schema/StandardTree.php b/src/Schema/StandardTree.php index b7b72d4..36acab9 100644 --- a/src/Schema/StandardTree.php +++ b/src/Schema/StandardTree.php @@ -8,20 +8,25 @@ class StandardTree { /** * species ID - * todo create common list + * @todo create common list + * @todo How about the 3-letter codes? Then we do not need to rely on IDs + * into a common list. * @var int */ public $speciesId; /** - * height of this tree - * if this is a representative tree, thisshould correspond to the mean height + * Height of this tree in metres. + * + * If this is a representative tree, this is the mean height of the representative tree. * @var float */ public $height; + /** - * dbh of this tree - * if this is a representative tree, thisshould correspond to the mean dbh + * dbh of this tree in metres. + * + * If this is a representative tree, this is the mean dbh of the representative tree. * @var float */ public $dbh; @@ -36,10 +41,10 @@ class StandardTree * volume calculation method: eg blue book look up * @var string */ - public $volumeCalculationethod; + public $volumeCalculationMethod; /** - * @see Create the Tree Species. + * Create the Standard Tree. * @param int $speciesId The species ID. * @return void */ diff --git a/src/Schema/StandardTreeDistributionStats.php b/src/Schema/StandardTreeDistributionStats.php index 248b016..3f3d6de 100644 --- a/src/Schema/StandardTreeDistributionStats.php +++ b/src/Schema/StandardTreeDistributionStats.php @@ -7,37 +7,53 @@ class StandardTreeDistributionStats { /** - * height range - * @var float + * The height range of the StandardTree expressed as a 2-tuple of floats + * in the order [min,max] + * + * @var array{float,float} */ public $heightRange; /** - * dbh range - * @var float + * The dbh range of the StandardTree expressed as a 2-tuple of floats + * in the order [min,max] + * + * @var array{float,float} */ public $dbhRange; /** - * height variance + * The height variance. This is the variance of the mean defined in + * the linked StandardTree. * @var float */ public $heightVariance; /** - * dbh variance + * The dbh variance. This is the variance of the mean defined in + * the linked StandardTree. * @var float */ public $dbhVariance; /** - * @see Create the Tree distribution statistics. - * @param float $heightRange The Tree distribution height range. + * Create the Tree distribution statistics. + * + * @param array{float,float} $heightRange The Tree distribution height range. + * @param array{float,float} $dbhRange The Tree distribution dbh range. * @return void */ - public function __construct(float $heightRange) + public function __construct(array $heightRange, array $dbhRange) { + if (count($heightRange) != 2) { + throw new \Exception("heightRange must be an array of two floats"); + } $this->heightRange = $heightRange; + + if (count($dbhRange) != 2) { + throw new \Exception("heightRange must be an array of two floats"); + } + $this->dbhRange = $dbhRange; } }