| Q | A
| --------------------| ---------------
| PHPUnit version | 9.1.2
| PHP version | 7.3+
| Installation Method | Composer
As reported in https://github.com/symfony/symfony/issues/36499, 2b4d7b8bb3fd052095e64999990cc36b63aa0771 broke the Symfony PHPUnit bridge. The bridge was relying on the Blacklist class, which is internal, so it would be expected. The issue here is that there isn't any other way to do the same operation, adding new classes to the blacklist to exclude them from error stack traces.
Is it possible to have any kind of extension point to obtain the same result without relying on an internal class?
Crash like this: https://github.com/symfony/symfony/issues/36499#issuecomment-616365995
Error: Access to undeclared static property: PHPUnit\Util\Blacklist::$blacklistedClassNames
No issues
This is not a bug.
Would this help?
diff --git a/src/Util/Blacklist.php b/src/Util/Blacklist.php
index 8767a5d18..fcb71243f 100644
--- a/src/Util/Blacklist.php
+++ b/src/Util/Blacklist.php
@@ -145,6 +145,20 @@ final class Blacklist
*/
private static $directories;
+ public static function addDirectory(string $directory): void
+ {
+ if (!\is_dir($directory)) {
+ throw new Exception(
+ \sprintf(
+ '"%s" is not a directory',
+ $directory
+ )
+ );
+ }
+
+ self::$directories[] = \realpath($directory);
+ }
+
Surely! @nicolas-grekas can you leverage that for your use case?
@sebastianbergmann yes, that would help, since we basically need a way to add to this list. Thanks for considering!
Most helpful comment
Would this help?