Skip to content

Commit

Permalink
Merge pull request #430 from helsingborg-stad/feat/allow-component-ty…
Browse files Browse the repository at this point in the history
…pe-null

feat: allow componenttype null
  • Loading branch information
NiclasNorin committed May 10, 2024
2 parents ab2a71f + dd19c9e commit cb2cd08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/php/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ public function handleTypingsErrors($viewData, $argsTypes, $componentSlug) {
foreach ($viewData as $key => $value) {
if (is_object($argsTypes) && isset($argsTypes->{$key})) {
$types = explode('|', $argsTypes->{$key});

if (!in_array(gettype($value), $types)) {
$valueType = gettype($value);
if (!in_array($valueType, $types) && !$valueType === 'NULL') {
$this->triggerError('The parameter <b>"' . $key . '"</b> in the <b>' . $componentSlug . '</b> component should be of type <b>"' . $argsTypes->{$key} . '"</b> but was recieved as type <b>"' . gettype($value) . '"</b>.');
}
} elseif(!in_array($key, ['__laravel_slots', 'slot', 'id', 'classList', 'context', 'attributeList'])) {
Expand Down

0 comments on commit cb2cd08

Please sign in to comment.