@@ -46,7 +46,7 @@ final public function __construct(
4646 foreach ($attributes as $key => $value ) {
4747 if (self :: isSpreadKey($key )) {
4848 invariant (
49- $value instanceof :x :composable - element ,
49+ $value is :x :composable - element ,
5050 " Only XHP can be used with an attribute spread operator" ,
5151 );
5252 $this -> spreadElementImpl($value );
@@ -78,14 +78,14 @@ final public function __construct(
7878 * @param $child single child or array of children
7979 */
8080 final public function appendChild (mixed $child ): this {
81- if ($child instanceof Traversable ) {
81+ if ($child is Traversable < _ > ) {
8282 foreach ($child as $c ) {
8383 $this -> appendChild($c );
8484 }
85- } else if ($child instanceof :x :frag ) {
85+ } else if ($child is :x :frag ) {
8686 $this -> children -> addAll($child -> getChildren());
8787 } else if ($child !== null ) {
88- assert ($child instanceof XHPChild );
88+ assert ($child is XHPChild );
8989 $this -> children -> add($child );
9090 }
9191 return $this ;
@@ -116,20 +116,20 @@ final public function replaceChildren(XHPChild ...$children): this {
116116 $new_children = Vector {};
117117 foreach ($children as $xhp ) {
118118 /* HH_FIXME[4273] bogus "XHPChild always truthy" - FB T41388073 */
119- if ($xhp instanceof :x :frag ) {
119+ if ($xhp is :x :frag ) {
120120 foreach ($xhp -> children as $child ) {
121121 $new_children -> add($child );
122122 }
123- } else if (! ($xhp instanceof Traversable )) {
123+ } else if (! ($xhp is Traversable < _ > )) {
124124 $new_children -> add($xhp );
125125 } else {
126126 foreach ($xhp as $element ) {
127- if ($element instanceof :x :frag ) {
127+ if ($element is :x :frag ) {
128128 foreach ($element -> children as $child ) {
129129 $new_children -> add($child );
130130 }
131131 } else if ($element !== null ) {
132- $new_children -> add($element );
132+ $new_children -> add($element as XHPChild );
133133 }
134134 }
135135 }
@@ -153,7 +153,7 @@ final public function getChildren(
153153 if ($selector [0 ] == ' %' ) {
154154 $selector = substr ($selector , 1 );
155155 foreach ($this -> children as $child ) {
156- if ($child instanceof :xhp && $child -> categoryOf($selector )) {
156+ if ($child is :xhp && $child -> categoryOf($selector )) {
157157 $children -> add($child );
158158 }
159159 }
@@ -186,7 +186,7 @@ final public function getFirstChild(?string $selector = null): ?XHPChild {
186186 } else if ($selector [0 ] == ' %' ) {
187187 $selector = substr ($selector , 1 );
188188 foreach ($this -> children as $child ) {
189- if ($child instanceof :xhp && $child -> categoryOf($selector )) {
189+ if ($child is :xhp && $child -> categoryOf($selector )) {
190190 return $child ;
191191 }
192192 }
@@ -735,7 +735,7 @@ final private function validateChildrenRule(
735735 case XHPChildrenConstraintType :: PCDATA :
736736 if (
737737 $this -> children -> containsKey($index ) &&
738- ! ($this -> children -> get($index ) instanceof :xhp )
738+ ! ($this -> children -> get($index ) is :xhp )
739739 ) {
740740 return tuple (true , $index + 1 );
741741 }
@@ -754,13 +754,13 @@ final private function validateChildrenRule(
754754 case XHPChildrenConstraintType :: CATEGORY :
755755 if (
756756 ! $this -> children -> containsKey($index ) ||
757- ! ($this -> children -> get($index ) instanceof :xhp )
757+ ! ($this -> children -> get($index ) is :xhp )
758758 ) {
759759 return tuple (false , $index );
760760 }
761761 $category = :xhp :: class2element($expr -> getConstraintString());
762762 $child = $this -> children -> get($index );
763- assert ($child instanceof :xhp );
763+ assert ($child is :xhp );
764764 $categories = $child -> __xhpCategoryDeclaration();
765765 if (($categories [$category ] ?? 0 ) === 0 ) {
766766 return tuple (false , $index );
@@ -795,7 +795,7 @@ public function __getChildrenDeclaration(): string {
795795 final public function __getChildrenDescription (): string {
796796 $desc = array ();
797797 foreach ($this -> children as $child ) {
798- if ($child instanceof :xhp ) {
798+ if ($child is :xhp ) {
799799 $tmp = ' :' . :xhp :: class2element(get_class ($child ));
800800 $categories = $child -> __xhpCategoryDeclaration();
801801 if (C \count ($categories ) > 0 ) {
0 commit comments