@@ -689,220 +689,220 @@ discard block |
||
689 | 689 | return \in_array($tag_name, self::$optional_end_tags, true) |
690 | 690 | || |
691 | 691 | ( |
692 | - $tag_name === 'li' |
|
692 | + $tag_name === 'li' |
|
693 | 693 | && |
694 | 694 | ( |
695 | - $nextSibling === null |
|
695 | + $nextSibling === null |
|
696 | 696 | || |
697 | 697 | ( |
698 | - $nextSibling instanceof \DOMElement |
|
698 | + $nextSibling instanceof \DOMElement |
|
699 | 699 | && |
700 | 700 | $nextSibling->tagName === 'li' |
701 | - ) |
|
702 | - ) |
|
703 | - ) |
|
701 | + ) |
|
702 | + ) |
|
703 | + ) |
|
704 | 704 | || |
705 | 705 | ( |
706 | - $tag_name === 'optgroup' |
|
706 | + $tag_name === 'optgroup' |
|
707 | 707 | && |
708 | 708 | ( |
709 | - $nextSibling === null |
|
709 | + $nextSibling === null |
|
710 | 710 | || |
711 | 711 | ( |
712 | - $nextSibling instanceof \DOMElement |
|
712 | + $nextSibling instanceof \DOMElement |
|
713 | 713 | && |
714 | 714 | $nextSibling->tagName === 'optgroup' |
715 | - ) |
|
716 | - ) |
|
717 | - ) |
|
715 | + ) |
|
716 | + ) |
|
717 | + ) |
|
718 | 718 | || |
719 | 719 | ( |
720 | - $tag_name === 'rp' |
|
720 | + $tag_name === 'rp' |
|
721 | 721 | && |
722 | 722 | ( |
723 | - $nextSibling === null |
|
723 | + $nextSibling === null |
|
724 | 724 | || |
725 | 725 | ( |
726 | - $nextSibling instanceof \DOMElement |
|
726 | + $nextSibling instanceof \DOMElement |
|
727 | 727 | && |
728 | 728 | ( |
729 | - $nextSibling->tagName === 'rp' |
|
729 | + $nextSibling->tagName === 'rp' |
|
730 | 730 | || |
731 | 731 | $nextSibling->tagName === 'rt' |
732 | - ) |
|
733 | - ) |
|
734 | - ) |
|
735 | - ) |
|
732 | + ) |
|
733 | + ) |
|
734 | + ) |
|
735 | + ) |
|
736 | 736 | || |
737 | 737 | ( |
738 | - $tag_name === 'tr' |
|
738 | + $tag_name === 'tr' |
|
739 | 739 | && |
740 | 740 | ( |
741 | - $nextSibling === null |
|
741 | + $nextSibling === null |
|
742 | 742 | || |
743 | 743 | ( |
744 | - $nextSibling instanceof \DOMElement |
|
744 | + $nextSibling instanceof \DOMElement |
|
745 | 745 | && |
746 | 746 | $nextSibling->tagName === 'tr' |
747 | - ) |
|
748 | - ) |
|
749 | - ) |
|
747 | + ) |
|
748 | + ) |
|
749 | + ) |
|
750 | 750 | || |
751 | 751 | ( |
752 | - $tag_name === 'source' |
|
752 | + $tag_name === 'source' |
|
753 | 753 | && |
754 | 754 | ( |
755 | - $parent_tag_name === 'audio' |
|
755 | + $parent_tag_name === 'audio' |
|
756 | 756 | || |
757 | 757 | $parent_tag_name === 'video' |
758 | 758 | || |
759 | 759 | $parent_tag_name === 'picture' |
760 | 760 | || |
761 | 761 | $parent_tag_name === 'source' |
762 | - ) |
|
762 | + ) |
|
763 | 763 | && |
764 | 764 | ( |
765 | - $nextSibling === null |
|
765 | + $nextSibling === null |
|
766 | 766 | || |
767 | 767 | ( |
768 | - $nextSibling instanceof \DOMElement |
|
768 | + $nextSibling instanceof \DOMElement |
|
769 | 769 | && |
770 | 770 | $nextSibling->tagName === 'source' |
771 | - ) |
|
772 | - ) |
|
773 | - ) |
|
771 | + ) |
|
772 | + ) |
|
773 | + ) |
|
774 | 774 | || |
775 | 775 | ( |
776 | - ( |
|
777 | - $tag_name === 'td' |
|
776 | + ( |
|
777 | + $tag_name === 'td' |
|
778 | 778 | || |
779 | 779 | $tag_name === 'th' |
780 | - ) |
|
780 | + ) |
|
781 | 781 | && |
782 | 782 | ( |
783 | - $nextSibling === null |
|
783 | + $nextSibling === null |
|
784 | 784 | || |
785 | 785 | ( |
786 | - $nextSibling instanceof \DOMElement |
|
786 | + $nextSibling instanceof \DOMElement |
|
787 | 787 | && |
788 | 788 | ( |
789 | - $nextSibling->tagName === 'td' |
|
789 | + $nextSibling->tagName === 'td' |
|
790 | 790 | || |
791 | 791 | $nextSibling->tagName === 'th' |
792 | - ) |
|
793 | - ) |
|
794 | - ) |
|
795 | - ) |
|
792 | + ) |
|
793 | + ) |
|
794 | + ) |
|
795 | + ) |
|
796 | 796 | || |
797 | 797 | ( |
798 | - ( |
|
799 | - $tag_name === 'dd' |
|
798 | + ( |
|
799 | + $tag_name === 'dd' |
|
800 | 800 | || |
801 | 801 | $tag_name === 'dt' |
802 | - ) |
|
802 | + ) |
|
803 | 803 | && |
804 | 804 | ( |
805 | - ( |
|
806 | - $nextSibling === null |
|
805 | + ( |
|
806 | + $nextSibling === null |
|
807 | 807 | && |
808 | 808 | $tag_name === 'dd' |
809 | - ) |
|
809 | + ) |
|
810 | 810 | || |
811 | 811 | ( |
812 | - $nextSibling instanceof \DOMElement |
|
812 | + $nextSibling instanceof \DOMElement |
|
813 | 813 | && |
814 | 814 | ( |
815 | - $nextSibling->tagName === 'dd' |
|
815 | + $nextSibling->tagName === 'dd' |
|
816 | 816 | || |
817 | 817 | $nextSibling->tagName === 'dt' |
818 | - ) |
|
819 | - ) |
|
820 | - ) |
|
821 | - ) |
|
818 | + ) |
|
819 | + ) |
|
820 | + ) |
|
821 | + ) |
|
822 | 822 | || |
823 | 823 | ( |
824 | - $tag_name === 'option' |
|
824 | + $tag_name === 'option' |
|
825 | 825 | && |
826 | 826 | ( |
827 | - $nextSibling === null |
|
827 | + $nextSibling === null |
|
828 | 828 | || |
829 | 829 | ( |
830 | - $nextSibling instanceof \DOMElement |
|
830 | + $nextSibling instanceof \DOMElement |
|
831 | 831 | && |
832 | 832 | ( |
833 | - $nextSibling->tagName === 'option' |
|
833 | + $nextSibling->tagName === 'option' |
|
834 | 834 | || |
835 | 835 | $nextSibling->tagName === 'optgroup' |
836 | - ) |
|
837 | - ) |
|
838 | - ) |
|
839 | - ) |
|
836 | + ) |
|
837 | + ) |
|
838 | + ) |
|
839 | + ) |
|
840 | 840 | || |
841 | 841 | ( |
842 | - $tag_name === 'p' |
|
842 | + $tag_name === 'p' |
|
843 | 843 | && |
844 | 844 | ( |
845 | - ( |
|
846 | - $nextSibling === null |
|
845 | + ( |
|
846 | + $nextSibling === null |
|
847 | 847 | && |
848 | 848 | ( |
849 | - $node->parentNode !== null |
|
849 | + $node->parentNode !== null |
|
850 | 850 | && |
851 | 851 | !\in_array( |
852 | - $node->parentNode->nodeName, |
|
853 | - [ |
|
854 | - 'a', |
|
855 | - 'audio', |
|
856 | - 'del', |
|
857 | - 'ins', |
|
858 | - 'map', |
|
859 | - 'noscript', |
|
860 | - 'video', |
|
861 | - ], |
|
862 | - true |
|
863 | - ) |
|
864 | - ) |
|
865 | - ) |
|
852 | + $node->parentNode->nodeName, |
|
853 | + [ |
|
854 | + 'a', |
|
855 | + 'audio', |
|
856 | + 'del', |
|
857 | + 'ins', |
|
858 | + 'map', |
|
859 | + 'noscript', |
|
860 | + 'video', |
|
861 | + ], |
|
862 | + true |
|
863 | + ) |
|
864 | + ) |
|
865 | + ) |
|
866 | 866 | || |
867 | 867 | ( |
868 | - $nextSibling instanceof \DOMElement |
|
868 | + $nextSibling instanceof \DOMElement |
|
869 | 869 | && |
870 | 870 | \in_array( |
871 | - $nextSibling->tagName, |
|
872 | - [ |
|
873 | - 'address', |
|
874 | - 'article', |
|
875 | - 'aside', |
|
876 | - 'blockquote', |
|
877 | - 'dir', |
|
878 | - 'div', |
|
879 | - 'dl', |
|
880 | - 'fieldset', |
|
881 | - 'footer', |
|
882 | - 'form', |
|
883 | - 'h1', |
|
884 | - 'h2', |
|
885 | - 'h3', |
|
886 | - 'h4', |
|
887 | - 'h5', |
|
888 | - 'h6', |
|
889 | - 'header', |
|
890 | - 'hgroup', |
|
891 | - 'hr', |
|
892 | - 'menu', |
|
893 | - 'nav', |
|
894 | - 'ol', |
|
895 | - 'p', |
|
896 | - 'pre', |
|
897 | - 'section', |
|
898 | - 'table', |
|
899 | - 'ul', |
|
900 | - ], |
|
901 | - true |
|
902 | - ) |
|
903 | - ) |
|
904 | - ) |
|
905 | - ); |
|
871 | + $nextSibling->tagName, |
|
872 | + [ |
|
873 | + 'address', |
|
874 | + 'article', |
|
875 | + 'aside', |
|
876 | + 'blockquote', |
|
877 | + 'dir', |
|
878 | + 'div', |
|
879 | + 'dl', |
|
880 | + 'fieldset', |
|
881 | + 'footer', |
|
882 | + 'form', |
|
883 | + 'h1', |
|
884 | + 'h2', |
|
885 | + 'h3', |
|
886 | + 'h4', |
|
887 | + 'h5', |
|
888 | + 'h6', |
|
889 | + 'header', |
|
890 | + 'hgroup', |
|
891 | + 'hr', |
|
892 | + 'menu', |
|
893 | + 'nav', |
|
894 | + 'ol', |
|
895 | + 'p', |
|
896 | + 'pre', |
|
897 | + 'section', |
|
898 | + 'table', |
|
899 | + 'ul', |
|
900 | + ], |
|
901 | + true |
|
902 | + ) |
|
903 | + ) |
|
904 | + ) |
|
905 | + ); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | protected function domNodeToString(\DOMNode $node): string |
@@ -934,9 +934,9 @@ discard block |
||
934 | 934 | } |
935 | 935 | |
936 | 936 | $html .= '<!DOCTYPE ' . $child->name . '' |
937 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
938 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
939 | - . '>'; |
|
937 | + . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
938 | + . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
939 | + . '>'; |
|
940 | 940 | } |
941 | 941 | } elseif ($child instanceof \DOMElement) { |
942 | 942 | $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child)); |