@@ 406-449 (lines=44) @@ | ||
403 | $this->inheritMethodsFromParent($storage, $trait_storage); |
|
404 | $this->inheritPropertiesFromParent($storage, $trait_storage); |
|
405 | ||
406 | if ($trait_storage->template_types) { |
|
407 | if (isset($storage->template_type_extends[$trait_storage->name])) { |
|
408 | foreach ($storage->template_type_extends[$trait_storage->name] as $i => $type) { |
|
409 | $trait_template_type_names = array_keys($trait_storage->template_types); |
|
410 | ||
411 | $mapped_name = $trait_template_type_names[$i] ?? null; |
|
412 | ||
413 | if ($mapped_name) { |
|
414 | $storage->template_type_extends[$trait_storage->name][$mapped_name] = $type; |
|
415 | } |
|
416 | } |
|
417 | ||
418 | if ($trait_storage->template_type_extends) { |
|
419 | foreach ($trait_storage->template_type_extends as $t_storage_class => $type_map) { |
|
420 | foreach ($type_map as $i => $type) { |
|
421 | if (is_int($i)) { |
|
422 | continue; |
|
423 | } |
|
424 | ||
425 | $storage->template_type_extends[$t_storage_class][$i] = self::extendType( |
|
426 | $type, |
|
427 | $storage |
|
428 | ); |
|
429 | } |
|
430 | } |
|
431 | } |
|
432 | } else { |
|
433 | $storage->template_type_extends[$trait_storage->name] = []; |
|
434 | ||
435 | foreach ($trait_storage->template_types as $template_name => $template_type_map) { |
|
436 | foreach ($template_type_map as $template_type) { |
|
437 | $default_param = clone $template_type[0]; |
|
438 | $default_param->from_docblock = false; |
|
439 | $storage->template_type_extends[$trait_storage->name][$template_name] |
|
440 | = $default_param; |
|
441 | } |
|
442 | } |
|
443 | } |
|
444 | } elseif ($trait_storage->template_type_extends) { |
|
445 | $storage->template_type_extends = array_merge( |
|
446 | $storage->template_type_extends ?: [], |
|
447 | $trait_storage->template_type_extends |
|
448 | ); |
|
449 | } |
|
450 | ||
451 | $storage->pseudo_property_get_types += $trait_storage->pseudo_property_get_types; |
|
452 | $storage->pseudo_property_set_types += $trait_storage->pseudo_property_set_types; |
|
@@ 522-565 (lines=44) @@ | ||
519 | $storage->parent_classes = array_merge($storage->parent_classes, $parent_storage->parent_classes); |
|
520 | ||
521 | if ($parent_storage->template_types) { |
|
522 | if (isset($storage->template_type_extends[$parent_storage->name])) { |
|
523 | foreach ($storage->template_type_extends[$parent_storage->name] as $i => $type) { |
|
524 | $parent_template_type_names = array_keys($parent_storage->template_types); |
|
525 | ||
526 | $mapped_name = $parent_template_type_names[$i] ?? null; |
|
527 | ||
528 | if ($mapped_name) { |
|
529 | $storage->template_type_extends[$parent_storage->name][$mapped_name] = $type; |
|
530 | } |
|
531 | } |
|
532 | ||
533 | if ($parent_storage->template_type_extends) { |
|
534 | foreach ($parent_storage->template_type_extends as $t_storage_class => $type_map) { |
|
535 | foreach ($type_map as $i => $type) { |
|
536 | if (is_int($i)) { |
|
537 | continue; |
|
538 | } |
|
539 | ||
540 | $storage->template_type_extends[$t_storage_class][$i] = self::extendType( |
|
541 | $type, |
|
542 | $storage |
|
543 | ); |
|
544 | } |
|
545 | } |
|
546 | } |
|
547 | } else { |
|
548 | $storage->template_type_extends[$parent_storage->name] = []; |
|
549 | ||
550 | foreach ($parent_storage->template_types as $template_name => $template_type_map) { |
|
551 | foreach ($template_type_map as $template_type) { |
|
552 | $default_param = clone $template_type[0]; |
|
553 | $default_param->from_docblock = false; |
|
554 | $storage->template_type_extends[$parent_storage->name][$template_name] |
|
555 | = $default_param; |
|
556 | } |
|
557 | } |
|
558 | ||
559 | if ($parent_storage->template_type_extends) { |
|
560 | $storage->template_type_extends = array_merge( |
|
561 | $storage->template_type_extends, |
|
562 | $parent_storage->template_type_extends |
|
563 | ); |
|
564 | } |
|
565 | } |
|
566 | } elseif ($parent_storage->template_type_extends) { |
|
567 | $storage->template_type_extends = array_merge( |
|
568 | $storage->template_type_extends ?: [], |
|
@@ 752-795 (lines=44) @@ | ||
749 | $implemented_interface_storage->invalid_dependencies |
|
750 | ); |
|
751 | ||
752 | if ($implemented_interface_storage->template_types) { |
|
753 | if (isset($storage->template_type_extends[$implemented_interface_storage->name])) { |
|
754 | foreach ($storage->template_type_extends[$implemented_interface_storage->name] as $i => $type) { |
|
755 | $parent_template_type_names = array_keys($implemented_interface_storage->template_types); |
|
756 | ||
757 | $mapped_name = $parent_template_type_names[$i] ?? null; |
|
758 | ||
759 | if ($mapped_name) { |
|
760 | $storage->template_type_extends[$implemented_interface_storage->name][$mapped_name] = $type; |
|
761 | } |
|
762 | } |
|
763 | ||
764 | if ($implemented_interface_storage->template_type_extends) { |
|
765 | foreach ($implemented_interface_storage->template_type_extends as $e_i => $type_map) { |
|
766 | foreach ($type_map as $i => $type) { |
|
767 | if (is_int($i)) { |
|
768 | continue; |
|
769 | } |
|
770 | ||
771 | $storage->template_type_extends[$e_i][$i] = self::extendType( |
|
772 | $type, |
|
773 | $storage |
|
774 | ); |
|
775 | } |
|
776 | } |
|
777 | } |
|
778 | } else { |
|
779 | $storage->template_type_extends[$implemented_interface_storage->name] = []; |
|
780 | ||
781 | foreach ($implemented_interface_storage->template_types as $template_name => $template_type_map) { |
|
782 | foreach ($template_type_map as $template_type) { |
|
783 | $default_param = clone $template_type[0]; |
|
784 | $default_param->from_docblock = false; |
|
785 | $storage->template_type_extends[$implemented_interface_storage->name][$template_name] |
|
786 | = $default_param; |
|
787 | } |
|
788 | } |
|
789 | } |
|
790 | } elseif ($implemented_interface_storage->template_type_extends) { |
|
791 | $storage->template_type_extends = array_merge( |
|
792 | $storage->template_type_extends ?: [], |
|
793 | $implemented_interface_storage->template_type_extends |
|
794 | ); |
|
795 | } |
|
796 | ||
797 | $extra_interfaces = array_merge($extra_interfaces, $implemented_interface_storage->parent_interfaces); |
|
798 | } |