Skip to content

Detect callable parameters #281

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

Merged
merged 3 commits into from
Jan 9, 2025
Merged

Detect callable parameters #281

merged 3 commits into from
Jan 9, 2025

Conversation

spaze
Copy link
Owner

@spaze spaze commented Jan 9, 2025

Detects disallowed methods and functions in callable parameters

For example:

  • array_map('function', []);
  • array_map([$object, 'method'], []);
  • array_map([Class::class, 'staticMethod']);
  • IntlChar::enumCharTypes('function');
  • also in custom functions and methods

Ref #275

spaze added 3 commits January 9, 2025 04:03
Reuses existing detection from DisallowedFunctionRuleErrors (for simple `'function'` callables) and DisallowedMethodRuleErrors (for `[$object, 'method']` callables) called from the new DisallowedCallableParameterRuleErrors service.

Ref #275
@spaze spaze self-assigned this Jan 9, 2025
@spaze spaze merged commit 3c11864 into main Jan 9, 2025
124 checks passed
@spaze spaze deleted the spaze/detect-callable-params branch January 9, 2025 03:20
spaze added a commit that referenced this pull request Jan 9, 2025
spaze added a commit that referenced this pull request Jan 9, 2025
spaze added a commit that referenced this pull request Jan 9, 2025
spaze added a commit that referenced this pull request Jan 9, 2025
spaze added a commit that referenced this pull request Jan 9, 2025
Callables detection added in #281 but I missed callable detection in constructors, e.g.:

```php
new ConstructorCallable('strlen');
new ConstructorCallable([$obj, 'method']);
```

Follow-up to #281
Ref #275
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant