-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[8.x] Add new VendorTagPublished
event
#36458
Merged
taylorotwell
merged 9 commits into
laravel:8.x
from
ryangjchandler:feature/vendor-tag-published-event
Mar 4, 2021
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4cadadc
feature: add new VendorTagPublished event
ryangjchandler 08b48c1
fix: only fire event when something was published
ryangjchandler 390b609
refactor: fire event before erroring in console
ryangjchandler ddb1d02
revert: move event dispatch into else arm
ryangjchandler 385f682
chore: update comment on $paths
ryangjchandler d3376b8
chore: publish to publishable
ryangjchandler 8a25a0a
chore: add missing comment
ryangjchandler 81d6847
Update VendorPublishCommand.php
taylorotwell 8a7318d
Update VendorTagPublished.php
taylorotwell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Illuminate\Foundation\Events; | ||
|
||
class VendorTagPublished | ||
{ | ||
/** | ||
* The vendor tag published. | ||
* | ||
* @var string | ||
*/ | ||
public $tag; | ||
|
||
/** | ||
* The paths that were published. | ||
* | ||
* @var array | ||
*/ | ||
public $paths; | ||
|
||
/** | ||
* Create a new event instance. | ||
* | ||
* @param string $tag | ||
* @return void | ||
*/ | ||
public function __construct($tag, $paths) | ||
{ | ||
$this->tag = $tag; | ||
$this->paths = $paths; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a couple of concerns here: first of all it's unsure if anything is published at this point. As such it's better that this line is part of the
else
condition of theif
statement below.Secondly, the
$pathsToPublish
isn't necessarily all of the paths that were published (see the contents ofpublishItem
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryangjchandler I answered this before reading your main PR comment, sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@driesvints No worries, wanted to get your opinion on it because the console output is actually a bit misleading.
An alternative solution might be only passing the
$tag
through to the event, technically speaking if you're listening for a particular tag, then you are 99% of the time going to know what might have been published.What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@driesvints Okay, I've moved the event into the
else
arm and also updated the comment on the$paths
property, so instead of stating that the array contains the paths that were published, it instead states that the$paths
property holds all of the publishable paths registered by that tag.Is this better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ryangjchandler I'll let Taylor review this one, thanks.