Support Drupal >=10.3. Modernize the code
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3503767. --> Reported by: [claudiu.cristea](https://www.drupal.org/user/56348) Related to !26 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Drupal 10.3 is currently the minimum supported version from major versions 10. It brings a lot of modern coding patterns.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>N/A</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <table> <tr> <th width="72%">What</th> <th>Since</th> <th>Status</th> </tr> <tr> <td>Set Drupal 10.3 as minimum required Drupal Core</td> <td>Drupal 10.3</td> <td>&#9989;</td> </tr><tr> <td>Provide attributes definition, as alternative to annotations, for plugins defined by OG (<a href="https://www.drupal.org/node/3395575">https://www.drupal.org/node/3395575</a>)</td> <td>Drupal 10.2.0/ PHP 8.0</td> <td>&#9989;</td> </tr> <tr> <td>Class constructor property promotion (<a href="https://stitcher.io/blog/constructor-promotion-in-php-8">https://stitcher.io/blog/constructor-promotion-in-php-8</a>)</td> <td>PHP 8.0</td> <td>&#9989;</td> </tr> <tr> <td>Autowire services (<a href="https://www.drupal.org/node/3218156">https://www.drupal.org/node/3218156</a>)</td> <td>Drupal 9.3</td> <td>&#9989;</td> </tr> <tr> <td>Autowire controllers (<a href="https://www.drupal.org/node/3395716">https://www.drupal.org/node/3395716</a>)</td> <td>Drupal 10.2</td> <td>&#9989;</td> </tr> <tr> <td>Autowire classes implementing ContainerInjectionInterface (<a href="https://www.drupal.org/node/3396179">https://www.drupal.org/node/3396179</a>)</td> <td>Drupal 10.2</td> <td>&#9989;</td> </tr> <tr> <td>Remove tag from event subscriber services (<a href="https://www.drupal.org/node/3357408">https://www.drupal.org/node/3357408</a>)</td> <td>Drupal 10.2</td> <td>&#9989;</td> </tr> <tr> <td>Hook implementations using autowired services with BC support (<a href="https://www.drupal.org/node/3442349">https://www.drupal.org/node/3442349</a>)</td> <td>Drupal 11.1 (with BC)</td> <td><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-1"><a href="https://www.drupal.org/project/og/issues/3518175" title="Status: Active">#3518175: Modernize code (part 2)</a></span></td> </tr> <tr> <td>Where possible, strict type methods/functions return &amp; params (<a href="https://www.php.net/releases/7_0_0.php">https://www.php.net/releases/7_0_0.php</a>)</td> <td>PHP 7.0</td> <td><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-1"><a href="https://www.drupal.org/project/og/issues/3518175" title="Status: Active">#3518175: Modernize code (part 2)</a></span></td> </tr> <tr> <td>Where possible, strict type class properties (<a href="https://www.php.net/releases/7_4_0.php">https://www.php.net/releases/7_4_0.php</a>)</td> <td>PHP 7.4</td> <td><span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-1"><a href="https://www.drupal.org/project/og/issues/3518175" title="Status: Active">#3518175: Modernize code (part 2)</a></span></td> </tr> <tr> <td>Read-only class properties (<a href="https://php.watch/versions/8.1/readonly">https://php.watch/versions/8.1/readonly</a>). Note that PHP 8.2 implements also read-only classes but we cannot implement as the minimum core version is 10.3 which still supports PHP 8.1</td> <td>PHP 8.1</td> <td>&#9989;</td> </tr> <tr> <td>Remove useless constructor documentation, with exceptions where the docblock still adds value, e.g., attrribute/annotation definitions (<a href="https://www.drupal.org/i/2140961">https://www.drupal.org/i/2140961</a>)</td> <td></td> <td>&#9989;</td> </tr> </table> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>None.</p> <h3 id="summary-ui-changes">User interface changes</h3> <p>None.</p> <h3 id="summary-api-changes">API changes</h3> <p>Third-party is able to define OG plugins by using attributes.</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>None.</p>
issue