Skip to content

Conversation

@n0nag0n
Copy link
Collaborator

@n0nag0n n0nag0n commented Sep 30, 2025

  • PHPStan rules were breaking some IDEs with how they were specified. This was adjusted to keep PHPStan functionality and make IDE's not break.
  • added a new argument caled $fileName to the download() method to allow you to specify the file name.

@n0nag0n n0nag0n requested a review from Copilot September 30, 2025 16:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves PHPStan integration and enhances the file download functionality in FlightPHP. The changes address IDE compatibility issues with PHPStan rules while maintaining static analysis capabilities.

  • Refactored PHPStan annotations to use separate @phpstan-* tags to avoid IDE conflicts while preserving type checking
  • Enhanced the downloadFile() method to accept an optional $fileName parameter for custom download filenames
  • Updated documentation formatting and copyright notices across multiple files

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
flight/net/Response.php Added optional $fileName parameter to downloadFile() method with proper documentation
flight/database/PdoWrapper.php Updated return type annotations for better PHPStan compatibility
flight/core/Dispatcher.php Added PHPStan template support and improved documentation formatting
flight/Flight.php Separated PHPStan-specific annotations from IDE-friendly method tags
flight/Engine.php Applied consistent documentation pattern with separate PHPStan annotations

$this->setRealHeader('Content-Description: File Transfer');
$this->setRealHeader('Content-Type: ' . $mimeType);
$this->setRealHeader('Content-Disposition: attachment; filename="' . basename($filePath) . '"');
$this->setRealHeader('Content-Disposition: attachment; filename="' . $fileName . '"');
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filename is directly concatenated into the header without sanitization. This could allow header injection if the filename contains special characters like quotes or newlines. Consider sanitizing the filename or using proper header encoding.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you sanitize it?

@n0nag0n n0nag0n merged commit 6a2494c into master Sep 30, 2025
6 checks passed
@n0nag0n n0nag0n deleted the download-file branch September 30, 2025 17:17
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.

2 participants