Skip to content

Commit b86b6fc

Browse files
Spomkyclaude
andcommitted
fix: exclude .castor.stub.php from classmap to prevent interface redeclaration errors in PHP 8.2-8.3
The .castor.stub.php file is auto-generated by Castor and contains stub definitions for IDE support. In PHP 8.2 and 8.3, when this file is loaded by Composer's autoloader during tests, it causes a fatal error: 'Cannot declare interface Psr\Cache\CacheItemInterface, because the name is already in use' This happens because the stub file defines interfaces that are already defined in the project's PSR dependencies. PHP 8.4 handles this differently and doesn't encounter the issue. The fix adds 'exclude-from-classmap' configuration to exclude .castor.stub.php from Composer's autoloader, preventing it from being loaded during test execution. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent a0023df commit b86b6fc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

composer.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
"Webauthn\\": "src/webauthn/src/",
2929
"Webauthn\\Bundle\\": "src/symfony/src/",
3030
"Webauthn\\Stimulus\\": "src/stimulus/src/"
31-
}
31+
},
32+
"exclude-from-classmap": [
33+
"/.castor.stub.php"
34+
]
3235
},
3336
"autoload-dev": {
3437
"psr-4": {
@@ -38,7 +41,10 @@
3841
],
3942
"Webauthn\\Tests\\Bundle\\Functional\\": "tests/symfony/functional/",
4043
"Webauthn\\Tests\\MetadataService\\": "tests/MDS/"
41-
}
44+
},
45+
"exclude-from-classmap": [
46+
"/.castor.stub.php"
47+
]
4248
},
4349
"require": {
4450
"php": ">=8.2",

0 commit comments

Comments
 (0)