Skip to content

Commit

Permalink
Compulsory properties for Compartment, and phpstan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sfreytag committed Oct 10, 2024
1 parent 490d618 commit 5310458
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Dto/ListingDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ListingDto
* Currently DRAFT listings are not fully supported so only create listings
* in an OPEN state.
*
* @var ListingState
* @var ListingStateEnum
*/
public $state = ListingStateEnum::OPEN;

Expand All @@ -54,15 +54,15 @@ class ListingDto
* The price type. Set it to NONE until the user has a chance to go to
* CloudForest to enter their preferred pricing.
*
* @var PriceType
* @var PriceTypeEnum
*/
public $priceType = PriceTypeEnum::NONE;

/**
* When the listing is available. Set it to NOW until the user has a chance
* to go to CloudForest to enter their preferred availability.
*
* @var ListingWhen
* @var ListingWhenEnum
*/
public $when = ListingWhenEnum::NOW;

Expand Down
12 changes: 9 additions & 3 deletions src/Schema/CompartmentSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CompartmentSchema
* The type of the compartment. This allows the logic unit 'compartment' to
* also represent other physical units like parcels and zones, if necessary.
*
* @var CompartmentType
* @var CompartmentTypeEnum
*/
public $type = CompartmentTypeEnum::COMPARTMENT;

Expand All @@ -45,7 +45,7 @@ class CompartmentSchema
*
* @var string
*/
public $number = '1';
public $number;

/**
* Any notes about the compartment, or null if none.
Expand Down Expand Up @@ -77,10 +77,16 @@ class CompartmentSchema

/**
* Constructor. Supply the required properties (those without defaults).
* @param string $number
* @return void
*/
public function __construct()
public function __construct(string $number)
{
if (mb_strlen($number) < 1) {
throw new \Exception('Compartment number cannot be less than 1 characters');
}

$this->number = $number;
$this->boundary = new GeojsonSchema(GeojsonGeometryTypeEnum::POLYGON);
$this->centroid = new GeojsonSchema(GeojsonGeometryTypeEnum::POINT);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Schema/GeojsonGeometrySchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GeojsonGeometrySchema
/**
* The geometry type. We only send Points and Polygons to CloudForest.
*
* @var GeojsonGeometryType
* @var GeojsonGeometryTypeEnum
*/
public $type;

Expand All @@ -29,7 +29,7 @@ class GeojsonGeometrySchema

/**
* Constructor. Supply the required properties (those without defaults).
* @param GeojsonGeometryType $type
* @param GeojsonGeometryTypeEnum $type
* @return void
*/
public function __construct(GeojsonGeometryTypeEnum $type)
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/GeojsonSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GeojsonSchema
* The Geojson type. We only send Features types to CloudForest, not
* FeatureCollection types, so this is hardcoded to 'Feature'.
*
* @var GeojsonType
* @var GeojsonTypeEnum
*/
public $type = GeojsonTypeEnum::FEATURE;

Expand Down

0 comments on commit 5310458

Please sign in to comment.