@@ -4955,6 +4955,130 @@ public static function allNullOrIsMap(mixed $array, string $message = ''): mixed
49554955 return $ array ;
49564956 }
49574957
4958+ /**
4959+ * @param Closure|null $closure
4960+ *
4961+ * @psalm-pure
4962+ *
4963+ * @psalm-assert static Closure|null $closure
4964+ *
4965+ * @return static Closure|null
4966+ *
4967+ * @throws InvalidArgumentException
4968+ */
4969+ public static function nullOrIsStatic (mixed $ closure , string $ message = '' ): mixed
4970+ {
4971+ null === $ closure || static ::isStatic ($ closure , $ message );
4972+
4973+ return $ closure ;
4974+ }
4975+
4976+ /**
4977+ * @param iterable<Closure> $closure
4978+ *
4979+ * @psalm-pure
4980+ *
4981+ * @psalm-assert iterable<static Closure> $closure
4982+ *
4983+ * @return iterable<static Closure>
4984+ *
4985+ * @throws InvalidArgumentException
4986+ */
4987+ public static function allIsStatic (mixed $ closure , string $ message = '' ): mixed
4988+ {
4989+ static ::isIterable ($ closure );
4990+
4991+ foreach ($ closure as $ entry ) {
4992+ static ::isStatic ($ entry , $ message );
4993+ }
4994+
4995+ return $ closure ;
4996+ }
4997+
4998+ /**
4999+ * @param iterable<Closure|null> $closure
5000+ *
5001+ * @psalm-pure
5002+ *
5003+ * @psalm-assert iterable<static Closure|null> $closure
5004+ *
5005+ * @return iterable<static Closure|null>
5006+ *
5007+ * @throws InvalidArgumentException
5008+ */
5009+ public static function allNullOrIsStatic (mixed $ closure , string $ message = '' ): mixed
5010+ {
5011+ static ::isIterable ($ closure );
5012+
5013+ foreach ($ closure as $ entry ) {
5014+ null === $ entry || static ::isStatic ($ entry , $ message );
5015+ }
5016+
5017+ return $ closure ;
5018+ }
5019+
5020+ /**
5021+ * @param Closure|null $closure
5022+ *
5023+ * @psalm-pure
5024+ *
5025+ * @psalm-assert Closure|null $closure
5026+ *
5027+ * @return Closure|null
5028+ *
5029+ * @throws InvalidArgumentException
5030+ */
5031+ public static function nullOrNotStatic (mixed $ closure , string $ message = '' ): mixed
5032+ {
5033+ null === $ closure || static ::notStatic ($ closure , $ message );
5034+
5035+ return $ closure ;
5036+ }
5037+
5038+ /**
5039+ * @param iterable<Closure> $closure
5040+ *
5041+ * @psalm-pure
5042+ *
5043+ * @psalm-assert iterable<Closure> $closure
5044+ *
5045+ * @return iterable<Closure>
5046+ *
5047+ * @throws InvalidArgumentException
5048+ */
5049+ public static function allNotStatic (mixed $ closure , string $ message = '' ): mixed
5050+ {
5051+ static ::isIterable ($ closure );
5052+
5053+ foreach ($ closure as $ entry ) {
5054+ static ::notStatic ($ entry , $ message );
5055+ }
5056+
5057+ return $ closure ;
5058+ }
5059+
5060+ /**
5061+ * @param iterable<Closure|null> $closure
5062+ *
5063+ * @psalm-pure
5064+ *
5065+ * @psalm-assert iterable<Closure|null> $closure
5066+ *
5067+ * @return iterable<Closure|null>
5068+ *
5069+ * @throws InvalidArgumentException
5070+ */
5071+ public static function allNullOrNotStatic (mixed $ closure , string $ message = '' ): mixed
5072+ {
5073+ static ::isIterable ($ closure );
5074+
5075+ foreach ($ closure as $ entry ) {
5076+ null === $ entry || static ::notStatic ($ entry , $ message );
5077+ }
5078+
5079+ return $ closure ;
5080+ }
5081+
49585082 /**
49595083 * @psalm-pure
49605084 *
0 commit comments