Automattic / Automattic/VIP-Coding-Standards
Add warning for list_files function and related
- Dominant language
- PHP
- Stars
- 261
- Forks
- 44
- Avg merge
- 19m
- Merged PRs (30d)
- 1
Description
## What problem would the enhancement address for VIP?
I've recently been doing a code review and noticed the `list_files` function had no warning attached. On VIP Filesystem, the `list_files`, `scandir`, `opendir` will return empty result sets or false, so we should probably highlight this to customers to avoid unexpected results.
## Describe the solution you'd like
A warning should be added when the following functions are coded:
- list_files - WP
- scandir - PHP
- opendir - PHP
## What code should be reported as a violation?
```
$files = list_files( $folder, 2 );
```
## What code should *not* be reported as a violation?
## Additional context
Contributor guide
Research direction
Locate the existing PHP_CodeSniffer rules for WordPress and VIP-specific function checks, then review how warnings are defined and tested. Confirm the expected warning behavior for list_files, scandir, and opendir, including the supplied list_files example; done means those calls are reported consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100