-
Notifications
You must be signed in to change notification settings - Fork 13
PHP Docs: int/bool vs integer/boolean #22
Comments
Thanks for the report, I'll have to look into the PHP Codesniffer core for this one I think. |
The conversion is done here. I do not know yet if is possible change it, or if php-integrator is that conflicts with that... since |
Thanks for tracking that down @natanfelles, I can definitely fix that. I've a deadline for Tuesday 20th so I'll be able to look at after that if I cant squeeze it in before. |
Just dropping an approach I use on huge projects. Coding standard can break typehints in many ways, since they don't know the context of parent/child files: <?php
final class SuperCoolSniff implements Sniff
{
/**
* @param int $position
*/
- public function process(File $file, $position)
+ public function process(File $file, int $position)
{
// ...
}
} It's better to use AST for this in tools like Retor instead of |
Currently the
int
params and returns are being updated tointeger
. Same frombool
toboolean
.The following doc (right):
is updated to it (wrong):
The issue is that
@return integer
is notint
(a number)... On returns it must beint
because updating tointeger
we say that we are returning an instance of theclass integer
... Then the type hint:int
would have to be changed to:integer
, but the PHP will show a fatal error. Because the correct would be:The same applies to boolean's, while the short syntax is the correct.
See:
Test:
The CodeIgniter4 Standard is not updating the method type hint, but the docs. What instructs wrong params and return types.
Detected with PHP Integrator.
The text was updated successfully, but these errors were encountered: