Fix PHP 8.2 in TypedInputsTrait with const string
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3566157. --> Reported by: [robloach](https://www.drupal.org/user/61114) Related to !68 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>In TypedInputsTrait.php, we have this syntax...</p> <pre>const string STORAGE_CONFIGURATION = 'config';<br>const string STORAGE_INPUT = 'input';<br>const string INPUT_SOURCE_INPUT = 'input';<br>const string INPUT_SOURCE_CONFIG = 'config';<br>const string INPUT_SOURCE_LOCKED = 'locked';<br>const string INPUT_SOURCE_DEFAULT = 'default';</pre><p>This syntax is not available in PHP 8.2, even though the Tool module asks for PHP &gt;=8.2.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>1. Use PHP 8.2<br> 2. Check syntax for TypedInputsTrait.php<br> 3. See the following exception...</p> <blockquote><p> PHP Fatal error: During class fetch: Uncaught ParseError: syntax error, unexpected identifier "STORAGE_CONFIGURATION", expected "=" in TypedInputsTrait.php:27 </p></blockquote> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Don't use const string, but just const. Alternatively, we could target PHP 8.3, but that would require a major version release.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>Fix it.</p> <h3 id="summary-ui-changes">User interface changes</h3> <p>Nothing.</p> <h3 id="summary-api-changes">API changes</h3> <p>Nothing.</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>It's a const instead of a const string.</p>
issue