RickDBCN / filament-email

Log emails in your Filament project
https://filament-email-demo.marcogermani.it/
MIT License
83 stars 22 forks source link

[Bug]: ParseError after composer update: Unexpected identifier in EmailResource #25

Closed haaszcs closed 12 months ago

haaszcs commented 12 months ago

What happened?

After running composer update, I encountered a ParseError with the message:

syntax error, unexpected identifier "filament", expecting ")"

The error traces back to vendor/rickdbcn/filament-email/src/Filament/Resources/EmailResource.php on line 34: return __('Config::get('filament-email.label')') ?? __('Email log');

The issue seems to be with the incorrect usage of single quotes inside the translation function. Instead of evaluating the Config::get() method, it's treated as a literal string causing the syntax error.

How to reproduce the bug

  1. Install the rickdbcn/filament-email package.
  2. Run composer update.
  3. Navigate to any route or command that would use the EmailResource class from the filament-email package.
  4. The error should appear and reference the mentioned line of code.

Package Version

1.0.8

PHP Version

8.2.10

Laravel Version

10.30.1

Which operating systems does with happen with?

Linux

Notes

A possible fix for the getNavigationLabel method is: return __(Config::get('filament-email.label', 'Email log'));

The getNavigationGroup method has an incorrect usage of the nullish coalescing operator. The correct implementation should be: return __(Config::get('filament-email.resource.group', parent::getNavigationGroup()));

It would be beneficial to add unit tests to catch these kinds of issues in the future.

Thank you for looking into this!

RickDBCN commented 12 months ago

Hi! I've reverted last nights PR. Will address this when I have time. New release is up! Sorry for the inconvenience.