Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
include:
- php-version: "8.0"
- php-version: "8.2"
dependencies: "lowest"

steps:
Expand Down Expand Up @@ -47,10 +47,10 @@ jobs:
fail-fast: false
matrix:
include:
- php-version: "8.1"
dependencies: "highest"
- php-version: "8.2"
dependencies: "highest"
- php-version: "8.3"
dependencies: "highest"

steps:
- name: Git Checkout
Expand Down
2 changes: 1 addition & 1 deletion bin/composer
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

docker-compose run -u "$(id -u)" -v /tmp:/tmp -e COMPOSER_CACHE_DIR=/tmp/composer --no-deps --rm --entrypoint=/usr/bin/composer php "$@"
exec docker compose run --rm --user "$(id -u):$(id -g)" --no-deps php composer "$@"
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
php:
image: pimcore/pimcore:php8.2.8-v2.0
image: pimcore/pimcore:php8.3-debug-latest
volumes:
- ./:/var/www/html/
environment:
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true
},
"audit": {
"block-insecure": false
}
},
"autoload": {
Expand All @@ -33,7 +36,7 @@
}
},
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
"php": "~8.2.0 || ~8.3.0",
"pimcore/pimcore": "^10.0 || ^11.0"
},
"require-dev": {
Expand Down
6 changes: 3 additions & 3 deletions src/Formatter/AttributeFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public function format(Attribute $attribute): string
{
$additionalInfo = '';
if ($attribute->getAdditionalInfo()) {
$additionalInfo = sprintf(' (%s)', $attribute->getAdditionalInfo());
$additionalInfo = \sprintf(' (%s)', $attribute->getAdditionalInfo());
}

if ($attribute->getDefaultValue()) {
$additionalInfo .= sprintf(' = %s', $attribute->getDefaultValue());
$additionalInfo .= \sprintf(' = %s', $attribute->getDefaultValue());
}

return sprintf(
return \sprintf(
<<<TABLEROW
<tr><td%s>%s %s</td><td>%s%s</td></tr>
TABLEROW,
Expand Down
6 changes: 3 additions & 3 deletions src/Formatter/ClassFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function __construct(

public function format(ObjectClass $objectClass): string
{
$labelDeclaration = sprintf(
$labelDeclaration = \sprintf(
<<<HTML
<table border="0" cellborder="1" cellspacing="0" cellpadding="4">
<tr><td>&lt;DataObject&gt;<br/><b>%s (ID: %s)</b></td></tr>%s
Expand All @@ -27,7 +27,7 @@ public function format(ObjectClass $objectClass): string
$this->formatAttributes($objectClass),
);

return sprintf(
return \sprintf(
<<<BOX
%s [
shape=plain
Expand Down Expand Up @@ -59,7 +59,7 @@ private function formatAttributes(ObjectClass $objectClass): string
}
$attributesAsString = self::INDENTATION . implode(PHP_EOL . str_repeat(self::INDENTATION, 5), $result) . PHP_EOL . str_repeat(self::INDENTATION, 4);

return sprintf($template, $attributesAsString);
return \sprintf($template, $attributesAsString);
}

return '';
Expand Down
12 changes: 6 additions & 6 deletions src/Formatter/RelationsFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public function format(array $relations): string
{
$result = [];
foreach ($relations as $relation) {
$name = sprintf('%s -> %s', $relation->getSourceType(), $relation->getTargetType());
$name = \sprintf('%s -> %s', $relation->getSourceType(), $relation->getTargetType());

$dir = sprintf('dir=%s', $relation->isBidirectional() ? 'none' : 'both');
$dir = \sprintf('dir=%s', $relation->isBidirectional() ? 'none' : 'both');

$arrow = '';
$label = '';
Expand All @@ -26,10 +26,10 @@ public function format(array $relations): string
$label = 'label="<<extends>>"';
} elseif ($relation->isAggregation()) {
$arrow = 'arrowtail=odiamond';
$label = sprintf('label="%s %s"', $relation->getSourceRolename(), $this->determineCardinality($relation));
$label = \sprintf('label="%s %s"', $relation->getSourceRolename(), $this->determineCardinality($relation));
}

$result[] = sprintf('%s [%s %s %s];', $name, $dir, $arrow, $label);
$result[] = \sprintf('%s [%s %s %s];', $name, $dir, $arrow, $label);
}

return implode(PHP_EOL, $result);
Expand All @@ -41,9 +41,9 @@ private function determineCardinality(Relation $relation): string
$minimum = $relation->getMinimum() ?: '0';
$maximum = $relation->getMaximum() ?: 'n';
if ($minimum === $maximum) {
return sprintf('(%s)', $minimum);
return \sprintf('(%s)', $minimum);
}

return sprintf($result, $minimum, $maximum);
return \sprintf($result, $minimum, $maximum);
}
}
3 changes: 0 additions & 3 deletions src/Model/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ public function setName(string $name): Attribute
return $this;
}

/**
* @return ?string
*/
public function getAdditionalInfo(): ?string
{
return $this->additionalInfo;
Expand Down
4 changes: 2 additions & 2 deletions src/Service/ClassDefinition2UMLService.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private function addRelation(mixed $fieldDefinition, Relation $relation, ClassDe
->setSourceRolename($fieldDefinition->getTitle())
->setMinimum($fieldDefinition->getMandatory() ? 1 : 0);

$relationsKey = sprintf('%s.%s - %s', $relation->getSourceType(), $fieldDefinition->getName(), $relation->getTargetType());
$relationsKey = \sprintf('%s.%s - %s', $relation->getSourceType(), $fieldDefinition->getName(), $relation->getTargetType());

// if relation already exists it must be bidirectional
if (\array_key_exists($relationsKey, $this->relations)) {
Expand All @@ -130,7 +130,7 @@ private function addReverseRelation(ClassDefinition\Data\ReverseObjectRelation $
->setSourceRolename($fieldDefinition->getOwnerFieldName())
->setTargetType($classDefinition->getName() ?? self::UNKNOWN);

$relationsKey = sprintf('%s.%s - %s', $relation->getSourceType(), $fieldDefinition->getOwnerFieldName(), $relation->getTargetType());
$relationsKey = \sprintf('%s.%s - %s', $relation->getSourceType(), $fieldDefinition->getOwnerFieldName(), $relation->getTargetType());

// if relation exists already merge it otherwise
if (\array_key_exists($relationsKey, $this->relations)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Service/PrinterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function print(array $classes, array $relations)
}
OUTPUT;

return sprintf($output, $this->printClasses($classes), $this->printRelations($relations));
return \sprintf($output, $this->printClasses($classes), $this->printRelations($relations));
}

/**
Expand Down
Loading