Fixed PHPstan issues

This commit is contained in:
Jan Böhmer 2023-10-03 16:41:03 +02:00
parent 3df47ed748
commit 2f958dafae
2 changed files with 5 additions and 3 deletions

View file

@ -98,6 +98,8 @@ class AddDocumentedAPIPropertiesJSONSchemaFactory implements SchemaFactoryInterf
$version = $schema->getVersion();
$swagger = Schema::VERSION_SWAGGER === $version;
$propertySchema = [];
if (false === $propertyMetadata->writeable) {
$propertySchema['readOnly'] = true;
}
@ -115,14 +117,14 @@ class AddDocumentedAPIPropertiesJSONSchemaFactory implements SchemaFactoryInterf
$propertySchema['deprecated'] = true;
}
if (!isset($propertySchema['default']) && !empty($default = $propertyMetadata->default)) {
if (!empty($default = $propertyMetadata->default)) {
if ($default instanceof \BackedEnum) {
$default = $default->value;
}
$propertySchema['default'] = $default;
}
if (!isset($propertySchema['example']) && !empty($example = $propertyMetadata->example)) {
if (!empty($example = $propertyMetadata->example)) {
$propertySchema['example'] = $example;
}

View file

@ -191,7 +191,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
* Return a formatted string version of the values of the string.
* Based on the set values it can return something like this: 34 V (12 V ... 50 V) [Text].
*/
#[Groups('parameter:read', 'full')]
#[Groups(['parameter:read', 'full'])]
#[SerializedName('formatted')]
public function getFormattedValue(): string
{