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

Adding of messages can be chained #1449

Closed

Conversation

alex-i07
Copy link
Contributor

fixes #1376

Allow to call debugbar()->emergency('message #1')->alert('message #2')->critical('message #3').

Copy link
Contributor

@erikn69 erikn69 left a comment

Choose a reason for hiding this comment

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

What about this??

/**
* @method static LaravelDebugbar addCollector(DataCollectorInterface $collector)
* @method static void addMessage(mixed $message, string $label = 'info')
* @method static void alert(mixed $message)
* @method static void critical(mixed $message)
* @method static void debug(mixed $message)
* @method static void emergency(mixed $message)
* @method static void error(mixed $message)
* @method static LaravelDebugbar getCollector(string $name)
* @method static bool hasCollector(string $name)
* @method static void info(mixed $message)
* @method static void log(mixed $message)
* @method static void notice(mixed $message)
* @method static void warning(mixed $message)

* @method void emergency(...$message)
* @method void alert(...$message)
* @method void critical(...$message)
* @method void error(...$message)
* @method void warning(...$message)
* @method void notice(...$message)
* @method void info(...$message)
* @method void debug(...$message)
* @method void log(...$message)

@alex-i07
Copy link
Contributor Author

Do you mean messages must be added like this debugbar()->alert('1st message', '2nd message', '3rd message');?
Assume several messages must be added and each is different psr-3 level, in this case chaining looks cleaner then call each one in new line

@erikn69
Copy link
Contributor

erikn69 commented Aug 30, 2023

Do you mean messages must be added like this debugbar()->alert('1st message', '2nd message', '3rd message');?

I'm not talking about that, I'm talking about the return void, that must be return LaravelDebugbar
without that IDEs give "alert" method not found on debugbar()->emergency('message #1')->alert('message #2')

@alex-i07
Copy link
Contributor Author

alex-i07 commented Aug 31, 2023

I'm not talking about that, I'm talking about the return void, that must be return LaravelDebugbar
without that IDEs give "alert" method not found on debugbar()->emergency('message #1')->alert('message #2')

Sorry for my misunderstanding, you are right. I fixed that.

@parallels999
Copy link
Contributor

It should follow the guidelines of psr/log,
they are supposed to return void, look php-fig/log@4f25c9a

@barryvdh barryvdh closed this Feb 13, 2024
@barryvdh
Copy link
Owner

yes we follow psr/log for this.

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.

Feature: create a chain
4 participants