title: PHP 8.1 readonly property on arrays
body: <p>I'm trying to use the new readonly property with <strong>PHP8.1</strong> but I can't set my array values.</p>
  <p>My code:</p>
  <pre><code>class MyModel
  {
      public readonly int $id;
      public readonly string $text;
      /** @var array&lt;int, string&gt; $media_keys */
      public readonly array $media_keys;
      
      public function __construct(\stdClass $object)
      {
          $this-&gt;id = $object-&gt;id; // OK
          $this-&gt;text = $object-&gt;text; // OK
          if (isset($object-&gt;attachments)) {
              $this-&gt;media_keys = $object-&gt;attachments-&gt;media_keys; // KO
          }
      }
  }
  </code></pre>
  <p><code>$object-&gt;attachments-&gt;media_keys</code> is a simple array like that:</p>
  <pre><code>array(1) {
      [0]=&gt; string(22) &quot;16_1468553316770668545&quot;
  }
  </code></pre>
  <p>But this doesn't works and returns <code>[&quot;media_keys&quot;] =&gt; uninitialized(array)</code></p>