2

Json-like structures are quite common in php applications that deal some sort of json api. The precise type of such a structure is recursive:

/**
 * @return null|scalar|array< null|scalar|array< null|scalar|array< ... >>>
 */
public function normalize(): null|scalar|array
{
  ...
}

Is there any way to represent this recursive type so that phpstan understands it?

1
  • This question is similar to: PHP, Static Analysis, and Recursive Type Checking. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Jan 3 at 12:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.