Skip to content

[5.6] Check whether method fetch exists instead of checking variable existence#23471

Merged
taylorotwell merged 1 commit into
laravel:5.6from
mohamed-aiman:patch-1
Mar 9, 2018
Merged

[5.6] Check whether method fetch exists instead of checking variable existence#23471
taylorotwell merged 1 commit into
laravel:5.6from
mohamed-aiman:patch-1

Conversation

@mohamed-aiman
Copy link
Copy Markdown
Contributor

check whether method fetch exists instead of checking variable existence before calling fetch method as $this->lastOutput might be an object of ConsoleOutput which implements OutputInterface but doesn't have fetch method.

Now that its possible to pass OutputInterface which doesn't strict output method and also some will be passing instances of Symfony\Component\Console\Output\ConsoleOutput, in this case, it will through the following error.
Call to undefined method Symfony\Component\Console\Output\ConsoleOutput::fetch()
To prevent it from throwing error we are checking

check whether method fetch exists instead of checking variable existence before calling fetch method as $this->lastOutput might be an object of ConsoleOutput which implements OutputInterface but doesn't have fetch method.

Now that its possible to pass OutputInterface which doesn't strict output method and also some will be passing instances of Symfony\Component\Console\Output\ConsoleOutput, in this case, it will through the following error. 
Call to undefined method Symfony\Component\Console\Output\ConsoleOutput::fetch()
To prevent it from throwing error we are checking
@taylorotwell taylorotwell merged commit d9a693c into laravel:5.6 Mar 9, 2018
@GrahamCampbell GrahamCampbell changed the title check whether method fetch exists instead of checking variable existence [5.6] Check whether method fetch exists instead of checking variable existence Mar 10, 2018
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.

2 participants