PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: humbug/php-scoper (php)

Issue:
Disable empty string in symbol exclusion
Disable `''` in favour of a regex like `~.*~` instead. I think this will be less confusing

Pull request:
Don't allow empty string as a symbol regex or name
Closes #727

Patch:
diff --git a/src/Symbol/SymbolRegistry.php b/src/Symbol/SymbolRegistry.php
index 107ff98..bdf9048 100644
--- a/src/Symbol/SymbolRegistry.php
+++ b/src/Symbol/SymbolRegistry.php
@@ -78,6 +78,14 @@ final class SymbolRegistry
         private bool $constants
     ) {
         $this->names = array_flip($names);
+
+        if (array_key_exists('', $this->names)) {
+            throw new InvalidArgumentException('Cannot register "" as a symbol name.');
+        }
+
+        if (array_key_exists('', array_flip($regexes))) {
+            throw new InvalidArgumentException('Cannot register "" as a symbol regex.');
+        }
     }
 
     public function matches(string $symbol): bool


Test patch:
diff --git a/tests/Symbol/SymbolRegistryTest.php b/tests/Symbol/SymbolRegistryTest.php
index a5e74a2..88b4c0b 100644
--- a/tests/Symbol/SymbolRegistryTest.php
+++ b/tests/Symbol/SymbolRegistryTest.php
@@ -15,6 +15,7 @@ declare(strict_types=1);
 namespace Humbug\PhpScoper\Symbol;
 
 use Humbug\PhpScoper\Configuration\RegexChecker;
+use InvalidArgumentException;
 use PHPUnit\Framework\TestCase;
 
 /**
@@ -337,6 +338,22 @@ class SymbolRegistryTest extends TestCase
         ];
     }
 
+    public function test_it_cannot_create_a_symbol_with_an_empty_string_for_a_name(): void
+    {
+        $this->expectException(InvalidArgumentException::class);
+        $this->expectExceptionMessage('Cannot register "" as a symbol name.');
+
+        SymbolRegistry::create(['']);
+    }
+
+    public function test_it_cannot_create_a_symbol_with_an_empty_string_for_a_regex(): void
+    {
+        $this->expectException(InvalidArgumentException::class);
+        $this->expectExceptionMessage('Cannot register "" as a symbol regex.');
+
+        SymbolRegistry::create(regexes: ['']);
+    }
+
     private function validateRegexes(array $regexes): void
     {
         foreach ($regexes as $regex) {