i think the problem may be that you didn't escape the () by the media= part - also xou could have used ' instead of " that way the () would not have been interpreted as php structure but rather as text data.
i don't know why but for me it is a lot more readable to when i write it like this:
<?php foreach ($type as $pictData['types']) { echo "<source media='(min-width: ".$size."px)'"; echo "sizes=''"; echo "srcset='".$pictData['names'][$type][$size]."'"; echo "type='".$type."'>"; } ?>
also you should keep a look at the foreach row i think it should be the other way round:
foreach ($pictData['types'] as $type) {
instead of ...
foreach ($type as $pictData['types']) {