Skip to content

Commit 68a7ab2

Browse files
authored
Bug Fixes
1 parent ba7ae14 commit 68a7ab2

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
- **Trailing Whitespace**: Removed trailing whitespace (tabs on blank lines) across `export.php`, `download.php`, `cleanup.php`, `admin-page.php`, and `security.php`.
5454
- **JS File Header**: Converted `admin.js` file header from JSDoc (`/** @package`, `@since`) to plain block comment to avoid TSDoc linter false positives.
5555
- **Bulk Cleanup Complexity**: Extracted per-file deletion logic from `sse_bulk_cleanup_exports_handler()` into `sse_cleanup_expired_export_file()` helper, reducing cyclomatic complexity from 13 to 8 and NPath complexity from 336 to under 200.
56+
- **PHPStan Array Shape**: Added `array{filepath: string, filename: string}` shape annotation to `sse_validate_export_file_path()` return type in `security.php`, resolving level-6 error.
57+
- **PHPStan Ignore Cleanup**: Removed three obsolete `ignoreErrors` patterns from `phpstan.neon` (`$post`, `$wp_query`, `$wpdb`) that are now resolved by the WordPress stubs.
5658

5759
## 2.0.0 - March 1, 2026
5860

includes/security.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function sse_validate_filename_format( string $filename ) {
262262
*
263263
* @since 2.0.0
264264
* @param string $filename The filename to validate.
265-
* @return array|WP_Error Result array with file data or WP_Error on failure.
265+
* @return array{filepath: string, filename: string}|WP_Error Result array with file data or WP_Error on failure.
266266
*/
267267
function sse_validate_export_file_path( string $filename ) {
268268
// Get the full path to the file.

phpstan.neon

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,4 @@ parameters:
1616

1717
treatPhpDocTypesAsCertain: false
1818

19-
ignoreErrors:
20-
# Ignore WordPress global variables that might not be defined in test context
21-
- '#Variable \$wpdb might not be defined#'
22-
- '#Variable \$wp_query might not be defined#'
23-
- '#Variable \$post might not be defined#'
19+
ignoreErrors: []

readme.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
129129
* **Code Quality**: Removed trailing whitespace across 5 include files
130130
* **Code Quality**: Converted `admin.js` file header to plain block comment (avoids TSDoc linter false positives)
131131
* **Code Quality**: Extracted `sse_cleanup_expired_export_file()` from bulk cleanup handler to reduce cyclomatic/NPath complexity
132+
* **Code Quality**: Added `array{filepath, filename}` shape annotation to `sse_validate_export_file_path()` return type
133+
* **Code Quality**: Removed obsolete PHPStan ignore patterns for WordPress globals now covered by stubs
132134

133135
= 2.0.0 =
134136
* **Critical Fix**: Fixed bug where automatic export file cleanup via WordPress cron was completely broken due to referer validation blocking cron-triggered deletions

0 commit comments

Comments
 (0)