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

Magic method __toString() must return a string #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

deminy
Copy link

@deminy deminy commented Mar 29, 2018

In some PHP IDE (e.g., PhpStorm) you may see that method _\MrRio\ShellWrap::_toString() is highlighted with notification saying

__toString() method must return a string

This could be triggered with following code piece where no actual shell command invoked:

<?php
require_once __DIR__ . '/vendor/autoload.php';

echo (new MrRio\ShellWrap());
?>

Although in reality people may not make method calls like that, it's better to get it fix to make variables consistent. Property \MrRio\ShellWrap::$output should be initialized and used as a string but not an array, as in the fix.

The warning message looks like this:
PHP Deprecated:  fwrite(): Passing null to parameter MrRio#2 ($data) of type string is deprecated ...
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.

1 participant