-
-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to exclude WordPress native classes by Regex? #1082
Comments
I don't really understand what you mean by "nor work properly". Excluding classes does work for sure, there is plenty of tests, so if there is a peculiar broken case it should be possible to get a reproducer. I recommend you to check https://github.com/humbug/php-scoper/blob/main/docs/further-reading.md#wordpress-support though |
Sorry for not being able to explain it clearly. The |
@theofidry You should really use the package |
@nahid I would need more details than "it is not working", because I simply do not understand what you mean by that. For instance if I have the following specs: 'Declaration of an excluded class' => SpecWithConfig::create(
excludeClasses: ['/^NewPhp.+$/'],
expectedRecordedClasses: [
['NewPhp20Interface', 'Humbug\NewPhp20Interface'],
],
spec: <<<'PHP'
<?php
interface NewPhp20Interface {}
----
<?php
namespace Humbug;
interface NewPhp20Interface
{
}
\class_alias('Humbug\NewPhp20Interface', 'NewPhp20Interface', \false);
PHP,
),
'Usage of an excluded class' => SpecWithConfig::create(
excludeClasses: ['/^NewPhp.+$/'],
spec: <<<'PHP'
<?php
class Foo implements NewPhp20Interface {}
----
<?php
namespace Humbug;
class Foo implements \NewPhp20Interface
{
}
PHP,
), Both of those passes the tests. |
I want to
exclude-classes
for all the native WordPress classes by Regex? I also tried the given way, but it's not workingTried these ways
but these did not work properly. Please help me, how can I do this?
The text was updated successfully, but these errors were encountered: