Skip to content

Commit 20892ab

Browse files
committed
Auto-append prefix for php-extension packages
1 parent e9d3f7e commit 20892ab

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/StaticPHP/Attribute/Package/Extension.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
* Indicates that the annotated class defines a PHP extension.
99
*/
1010
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)]
11-
readonly class Extension
11+
class Extension
1212
{
13-
public function __construct(public string $name) {}
13+
public function __construct(public string $name)
14+
{
15+
if (!str_starts_with($name, 'ext-')) {
16+
$this->name = "ext-{$name}";
17+
}
18+
}
1419
}

0 commit comments

Comments
 (0)