Skip to content
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

Readme: mention ignoreUnknownFunctions #126

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,14 @@ return $config
// for multiple, use ignoreErrorsOnPackagesAndPaths() or ignoreErrorsOnPackageAndPaths()
->ignoreErrorsOnPackageAndPath('symfony/console', __DIR__ . '/src/OptionalCommand.php', [ErrorType::SHADOW_DEPENDENCY])

// allow using classes not present in composer's autoloader
// allow using non-autoloadable classes
// e.g. a library may conditionally support some feature only when Memcached is available
->ignoreUnknownClasses(['Memcached'])
->ignoreUnknownClassesRegex('~^DDTrace~')

// allow using classes not present in composer's autoloader by regex
// e.g. when you want to ignore whole namespace of classes
->ignoreUnknownClassesRegex('~^PHPStan\\.*?~')
// allow using functions not defined during runtime
->ignoreUnknownFunctions(['opcache_invalidate'])
->ignoreUnknownFunctionsRegex('~^opcache_~')

// force certain classes to be treated as used
// handy when dealing with dependencies in non-php files (e.g. DIC config), see example below
Expand Down
Loading