Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Jun 26, 2019

The __toString() magic method can no longer accept arguments.

Ref: https://www.php.net/manual/en/migration53.incompatible.php

This introduces a sister-sniff called PHPCompatibility.MethodUse.ForbiddenToStringParameters to the PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters which will detect parameters being passed in direct calls to the magic __toString() method. (as per my previous remark in #815)

Potential additional enhancement which could be added (now or later):

  • Check whether direct calls to __toString() methods pass arguments, i.e. self::__toString($param), $obj->__toString($param).

@jrfnl jrfnl added this to the 9.2.0 milestone Jun 26, 2019
@jrfnl jrfnl requested a review from wimg June 26, 2019 14:24
> The __toString() magic method can no longer accept arguments.

Ref: https://www.php.net/manual/en/migration53.incompatible.php

This introduces a sister-sniff called `PHPCompatibility.MethodUse.ForbiddenToStringParameters` to the `PHPCompatibility.FunctionDeclarations.ForbiddenToStringParameters` which will detect parameters being passed in direct calls to the magic `__toString()` method. (as per my previous remark in 815)
@jrfnl jrfnl force-pushed the php-5.3/new-methoduse-forbiddentostringparameters-sniff branch from fc0346e to e518ecf Compare June 26, 2019 14:25
@wimg wimg merged commit 21929b1 into master Jun 26, 2019
@wimg wimg deleted the php-5.3/new-methoduse-forbiddentostringparameters-sniff branch June 26, 2019 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants