Skip to content

Commit

Permalink
Make phpstan happy
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Sep 11, 2024
1 parent ca7e8d7 commit 105346c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/php/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,18 @@ public function buildSchema()

$known_itemtypes = [];
preg_match('/\^\((.+)\)\$/', $schema->properties->itemtype->pattern, $known_itemtypes);
$known_itemtypes = explode('|', $known_itemtypes[1]);
foreach ($this->extra_itemtypes as $extra_itemtype) {
if (!in_array($extra_itemtype, $known_itemtypes)) {
$known_itemtypes[] = addslashes($extra_itemtype);
if (isset($known_itemtypes[1])) {
$known_itemtypes = explode('|', $known_itemtypes[1]);
foreach ($this->extra_itemtypes as $extra_itemtype) {
if (!in_array($extra_itemtype, $known_itemtypes)) {
$known_itemtypes[] = addslashes($extra_itemtype);
}
}
$schema->properties->itemtype->pattern = sprintf(
'^(%s)$',
implode('|', $known_itemtypes)
);
}
$schema->properties->itemtype->pattern = sprintf(
'^(%s)$',
implode('|', $known_itemtypes)
);

$properties = $schema->properties->content->properties;

Expand Down

0 comments on commit 105346c

Please sign in to comment.