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

Update filter.stub to use typed property declaration #9

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

Thavarshan
Copy link
Owner

This Pull Request resolves issue #8 by updating the filter.stub file to include a type declaration for the $filters property, ensuring compatibility with PHP 7.4 and above where property types are supported. The explicit array type declaration enforces that $filters is always an array, preventing type errors.

Background & Issue:

In environments running PHP 7.4+, the filter.stub was causing a fatal error due to the lack of a type declaration for the $filters property. This update ensures that when a filter class is generated, it will have a properly typed property, as required by PHP 7.4+.

Changes Made:

  • Added a type declaration to the $filters property within the filter.stub file.

Before:

protected $filters = ['filter'];

After:

protected array $filters = ['filter'];

Testing:

  • Generated a new filter class using the updated stub to ensure the $filters property is correctly typed.
  • Ensured that the new filter class works as expected without any type errors.

PHP Version Compatibility:

  • This change is compatible with PHP 7.4 and above. Projects using an earlier version of PHP should update accordingly to accommodate typed properties.

Additional Notes:

  • This change adheres to modern PHP standards and improves code reliability by leveraging PHP's type system.

@Thavarshan Thavarshan self-assigned this Apr 10, 2024
@Thavarshan Thavarshan added bug Something isn't working enhancement New feature or request labels Apr 10, 2024
@Thavarshan Thavarshan linked an issue Apr 10, 2024 that may be closed by this pull request
@Thavarshan Thavarshan merged commit 321d06b into main Apr 10, 2024
2 checks passed
@Thavarshan Thavarshan deleted the fix/issue-8 branch April 10, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fatal Error: Type of App\Filters\EventFilter::$filters Must Be Array
1 participant