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: cast the replaced value as string #95

Merged
merged 3 commits into from
Aug 9, 2023
Merged

fix: cast the replaced value as string #95

merged 3 commits into from
Aug 9, 2023

Conversation

Yokann
Copy link
Contributor

@Yokann Yokann commented Jul 27, 2023

On PHP8.1 when a value is an object, str_replace failed because of the type checking.

As a solution, we can cast the value returned by the propertyAccessor.

I also apply cs-fix to make the CI green 🤷‍♂️

@Yokann Yokann requested a review from a team as a code owner July 27, 2023 09:50
@@ -16,14 +16,14 @@
class ConsoleListener
{
/** @var EventDispatcherInterface */
protected $eventDispatcher = null;
protected $eventDispatcher;

Choose a reason for hiding this comment

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

You should update line 67 to check with isset

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest, I trusted blindly the cs-fixer. Thank you.


/**
* Time when command started
*
* @var float
*/
protected $startTime = null;
protected $startTime;

Choose a reason for hiding this comment

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

If for some reason onException or onTerminate are called before onCommand we will get an exception (L.76) because startTime will not have been set. We should check if startTime is set before dispatching.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am struggling with the cs-fixer. I initialized these vars inside the constructor

@Yokann Yokann merged commit 658a73e into master Aug 9, 2023
34 checks passed
@Yokann Yokann deleted the fix/cast-string branch August 9, 2023 12:18
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