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

Fix warning in PHP 8 about optional parameter before mandatory one #25004

Merged

Conversation

MorrisJobke
Copy link
Member

No description provided.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
@@ -56,7 +56,7 @@ class File extends LogDetails implements IWriter, IFileBased {
/** @var SystemConfig */
private $config;

public function __construct(string $path, string $fallbackPath = '', SystemConfig $config) {
public function __construct(string $path, string $fallbackPath, SystemConfig $config) {
Copy link
Member

Choose a reason for hiding this comment

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

is it always set?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, otherwise you cannot set the $config one and therefore PHP would crash initializing this object. I also checked all occurrences of this to be sure xD

Copy link
Member

Choose a reason for hiding this comment

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

Yes:

$fallback = $defaultLogFile !== $logFile ? $defaultLogFile : '';

@rullzer rullzer mentioned this pull request Jan 7, 2021
5 tasks
@@ -56,7 +56,7 @@ class File extends LogDetails implements IWriter, IFileBased {
/** @var SystemConfig */
private $config;

public function __construct(string $path, string $fallbackPath = '', SystemConfig $config) {
public function __construct(string $path, string $fallbackPath, SystemConfig $config) {
Copy link
Member

Choose a reason for hiding this comment

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

Yes:

$fallback = $defaultLogFile !== $logFile ? $defaultLogFile : '';

@MorrisJobke MorrisJobke merged commit 15e8f8b into master Jan 7, 2021
@MorrisJobke MorrisJobke deleted the fix/noid/php8-optional-parameter-before-mandatory branch January 7, 2021 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants