@@ -761,230 +761,230 @@ discard block |
||
761 | 761 | return \in_array($tag_name, self::$optional_end_tags, true) |
762 | 762 | || |
763 | 763 | ( |
764 | - $tag_name === 'li' |
|
764 | + $tag_name === 'li' |
|
765 | 765 | && |
766 | 766 | ( |
767 | - $nextSibling === null |
|
767 | + $nextSibling === null |
|
768 | 768 | || |
769 | 769 | ( |
770 | - $nextSibling instanceof \DOMElement |
|
770 | + $nextSibling instanceof \DOMElement |
|
771 | 771 | && |
772 | 772 | $nextSibling->tagName === 'li' |
773 | - ) |
|
774 | - ) |
|
775 | - ) |
|
773 | + ) |
|
774 | + ) |
|
775 | + ) |
|
776 | 776 | || |
777 | 777 | ( |
778 | - $tag_name === 'optgroup' |
|
778 | + $tag_name === 'optgroup' |
|
779 | 779 | && |
780 | 780 | ( |
781 | - $nextSibling === null |
|
781 | + $nextSibling === null |
|
782 | 782 | || |
783 | 783 | ( |
784 | - $nextSibling instanceof \DOMElement |
|
784 | + $nextSibling instanceof \DOMElement |
|
785 | 785 | && |
786 | 786 | $nextSibling->tagName === 'optgroup' |
787 | - ) |
|
788 | - ) |
|
789 | - ) |
|
787 | + ) |
|
788 | + ) |
|
789 | + ) |
|
790 | 790 | || |
791 | 791 | ( |
792 | - $tag_name === 'rp' |
|
792 | + $tag_name === 'rp' |
|
793 | 793 | && |
794 | 794 | ( |
795 | - $nextSibling === null |
|
795 | + $nextSibling === null |
|
796 | 796 | || |
797 | 797 | ( |
798 | - $nextSibling instanceof \DOMElement |
|
798 | + $nextSibling instanceof \DOMElement |
|
799 | 799 | && |
800 | 800 | ( |
801 | - $nextSibling->tagName === 'rp' |
|
801 | + $nextSibling->tagName === 'rp' |
|
802 | 802 | || |
803 | 803 | $nextSibling->tagName === 'rt' |
804 | - ) |
|
805 | - ) |
|
806 | - ) |
|
807 | - ) |
|
804 | + ) |
|
805 | + ) |
|
806 | + ) |
|
807 | + ) |
|
808 | 808 | || |
809 | 809 | ( |
810 | - $tag_name === 'tr' |
|
810 | + $tag_name === 'tr' |
|
811 | 811 | && |
812 | 812 | ( |
813 | - $nextSibling === null |
|
813 | + $nextSibling === null |
|
814 | 814 | || |
815 | 815 | ( |
816 | - $nextSibling instanceof \DOMElement |
|
816 | + $nextSibling instanceof \DOMElement |
|
817 | 817 | && |
818 | 818 | $nextSibling->tagName === 'tr' |
819 | - ) |
|
820 | - ) |
|
821 | - ) |
|
819 | + ) |
|
820 | + ) |
|
821 | + ) |
|
822 | 822 | || |
823 | 823 | ( |
824 | - $tag_name === 'source' |
|
824 | + $tag_name === 'source' |
|
825 | 825 | && |
826 | 826 | ( |
827 | - $parent_tag_name === 'audio' |
|
827 | + $parent_tag_name === 'audio' |
|
828 | 828 | || |
829 | 829 | $parent_tag_name === 'video' |
830 | 830 | || |
831 | 831 | $parent_tag_name === 'picture' |
832 | 832 | || |
833 | 833 | $parent_tag_name === 'source' |
834 | - ) |
|
834 | + ) |
|
835 | 835 | && |
836 | 836 | ( |
837 | - $nextSibling === null |
|
837 | + $nextSibling === null |
|
838 | 838 | || |
839 | 839 | ( |
840 | - $nextSibling instanceof \DOMElement |
|
840 | + $nextSibling instanceof \DOMElement |
|
841 | 841 | && |
842 | 842 | $nextSibling->tagName === 'source' |
843 | - ) |
|
844 | - ) |
|
845 | - ) |
|
843 | + ) |
|
844 | + ) |
|
845 | + ) |
|
846 | 846 | || |
847 | 847 | ( |
848 | - ( |
|
849 | - $tag_name === 'td' |
|
848 | + ( |
|
849 | + $tag_name === 'td' |
|
850 | 850 | || |
851 | 851 | $tag_name === 'th' |
852 | - ) |
|
852 | + ) |
|
853 | 853 | && |
854 | 854 | ( |
855 | - $nextSibling === null |
|
855 | + $nextSibling === null |
|
856 | 856 | || |
857 | 857 | ( |
858 | - $nextSibling instanceof \DOMElement |
|
858 | + $nextSibling instanceof \DOMElement |
|
859 | 859 | && |
860 | 860 | ( |
861 | - $nextSibling->tagName === 'td' |
|
861 | + $nextSibling->tagName === 'td' |
|
862 | 862 | || |
863 | 863 | $nextSibling->tagName === 'th' |
864 | - ) |
|
865 | - ) |
|
866 | - ) |
|
867 | - ) |
|
864 | + ) |
|
865 | + ) |
|
866 | + ) |
|
867 | + ) |
|
868 | 868 | || |
869 | 869 | ( |
870 | - ( |
|
871 | - $tag_name === 'dd' |
|
870 | + ( |
|
871 | + $tag_name === 'dd' |
|
872 | 872 | || |
873 | 873 | $tag_name === 'dt' |
874 | - ) |
|
874 | + ) |
|
875 | 875 | && |
876 | 876 | ( |
877 | - ( |
|
878 | - $nextSibling === null |
|
877 | + ( |
|
878 | + $nextSibling === null |
|
879 | 879 | && |
880 | 880 | $tag_name === 'dd' |
881 | - ) |
|
881 | + ) |
|
882 | 882 | || |
883 | 883 | ( |
884 | - $nextSibling instanceof \DOMElement |
|
884 | + $nextSibling instanceof \DOMElement |
|
885 | 885 | && |
886 | 886 | ( |
887 | - $nextSibling->tagName === 'dd' |
|
887 | + $nextSibling->tagName === 'dd' |
|
888 | 888 | || |
889 | 889 | $nextSibling->tagName === 'dt' |
890 | - ) |
|
891 | - ) |
|
892 | - ) |
|
893 | - ) |
|
890 | + ) |
|
891 | + ) |
|
892 | + ) |
|
893 | + ) |
|
894 | 894 | || |
895 | 895 | ( |
896 | - $tag_name === 'option' |
|
896 | + $tag_name === 'option' |
|
897 | 897 | && |
898 | 898 | ( |
899 | - $nextSibling === null |
|
899 | + $nextSibling === null |
|
900 | 900 | || |
901 | 901 | ( |
902 | - $nextSibling instanceof \DOMElement |
|
902 | + $nextSibling instanceof \DOMElement |
|
903 | 903 | && |
904 | 904 | ( |
905 | - $nextSibling->tagName === 'option' |
|
905 | + $nextSibling->tagName === 'option' |
|
906 | 906 | || |
907 | 907 | $nextSibling->tagName === 'optgroup' |
908 | - ) |
|
909 | - ) |
|
910 | - ) |
|
911 | - ) |
|
908 | + ) |
|
909 | + ) |
|
910 | + ) |
|
911 | + ) |
|
912 | 912 | || |
913 | 913 | ( |
914 | - $tag_name === 'p' |
|
914 | + $tag_name === 'p' |
|
915 | 915 | && |
916 | 916 | ( |
917 | - ( |
|
918 | - $nextSibling === null |
|
917 | + ( |
|
918 | + $nextSibling === null |
|
919 | 919 | && |
920 | 920 | ( |
921 | - $node->parentNode !== null |
|
921 | + $node->parentNode !== null |
|
922 | 922 | && |
923 | 923 | ( |
924 | - $node->parentNode->lastChild !== null |
|
924 | + $node->parentNode->lastChild !== null |
|
925 | 925 | && |
926 | 926 | ( |
927 | 927 | $node->parentNode->lastChild === $node |
928 | 928 | || |
929 | 929 | \trim($node->parentNode->lastChild->textContent) === '' |
930 | 930 | ) |
931 | - ) |
|
931 | + ) |
|
932 | 932 | && |
933 | 933 | !\in_array( |
934 | - $node->parentNode->nodeName, |
|
935 | - [ |
|
936 | - 'a', |
|
937 | - 'audio', |
|
938 | - 'del', |
|
939 | - 'ins', |
|
940 | - 'map', |
|
941 | - 'noscript', |
|
942 | - 'video', |
|
943 | - ], |
|
944 | - true |
|
945 | - ) |
|
946 | - ) |
|
947 | - ) |
|
934 | + $node->parentNode->nodeName, |
|
935 | + [ |
|
936 | + 'a', |
|
937 | + 'audio', |
|
938 | + 'del', |
|
939 | + 'ins', |
|
940 | + 'map', |
|
941 | + 'noscript', |
|
942 | + 'video', |
|
943 | + ], |
|
944 | + true |
|
945 | + ) |
|
946 | + ) |
|
947 | + ) |
|
948 | 948 | || |
949 | 949 | ( |
950 | - $nextSibling instanceof \DOMElement |
|
950 | + $nextSibling instanceof \DOMElement |
|
951 | 951 | && |
952 | 952 | \in_array( |
953 | - $nextSibling->tagName, |
|
954 | - [ |
|
955 | - 'address', |
|
956 | - 'article', |
|
957 | - 'aside', |
|
958 | - 'blockquote', |
|
959 | - 'dir', |
|
960 | - 'div', |
|
961 | - 'dl', |
|
962 | - 'fieldset', |
|
963 | - 'footer', |
|
964 | - 'form', |
|
965 | - 'h1', |
|
966 | - 'h2', |
|
967 | - 'h3', |
|
968 | - 'h4', |
|
969 | - 'h5', |
|
970 | - 'h6', |
|
971 | - 'header', |
|
972 | - 'hgroup', |
|
973 | - 'hr', |
|
974 | - 'menu', |
|
975 | - 'nav', |
|
976 | - 'ol', |
|
977 | - 'p', |
|
978 | - 'pre', |
|
979 | - 'section', |
|
980 | - 'table', |
|
981 | - 'ul', |
|
982 | - ], |
|
983 | - true |
|
984 | - ) |
|
985 | - ) |
|
986 | - ) |
|
987 | - ); |
|
953 | + $nextSibling->tagName, |
|
954 | + [ |
|
955 | + 'address', |
|
956 | + 'article', |
|
957 | + 'aside', |
|
958 | + 'blockquote', |
|
959 | + 'dir', |
|
960 | + 'div', |
|
961 | + 'dl', |
|
962 | + 'fieldset', |
|
963 | + 'footer', |
|
964 | + 'form', |
|
965 | + 'h1', |
|
966 | + 'h2', |
|
967 | + 'h3', |
|
968 | + 'h4', |
|
969 | + 'h5', |
|
970 | + 'h6', |
|
971 | + 'header', |
|
972 | + 'hgroup', |
|
973 | + 'hr', |
|
974 | + 'menu', |
|
975 | + 'nav', |
|
976 | + 'ol', |
|
977 | + 'p', |
|
978 | + 'pre', |
|
979 | + 'section', |
|
980 | + 'table', |
|
981 | + 'ul', |
|
982 | + ], |
|
983 | + true |
|
984 | + ) |
|
985 | + ) |
|
986 | + ) |
|
987 | + ); |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | protected function domNodeToString(\DOMNode $node): string |
@@ -1113,9 +1113,9 @@ discard block |
||
1113 | 1113 | } |
1114 | 1114 | |
1115 | 1115 | return '<!DOCTYPE ' . $child->name . '' |
1116 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
1117 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
1118 | - . '>'; |
|
1116 | + . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
1117 | + . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
1118 | + . '>'; |
|
1119 | 1119 | } |
1120 | 1120 | } |
1121 | 1121 |