-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
[Php81] Add NullToStrictStringFuncCallArgRector #1655
Conversation
4e76f87
to
2898bfb
Compare
655782e
to
70bae0b
Compare
update: implemented for non-named args. |
rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php
Outdated
Show resolved
Hide resolved
50933f6
to
ed049e3
Compare
packages/Testing/PHPUnit/Behavior/MultipleFilesChangedTrait.php
Outdated
Show resolved
Hide resolved
636c8c8
to
be98cf0
Compare
rules/CodingStyle/Rector/FuncCall/ConsistentPregDelimiterRector.php
Outdated
Show resolved
Hide resolved
c5a2e47
to
6f5cd0c
Compare
dca159e
to
53038c6
Compare
update: implemented for named args as well. |
@TomasVotruba it seems can be multi position in single function, eg on We possibly need to use type detection from parameter if it got string, need to pass as string in the loop: $positions = [];
foreach ($parametersAcceptor->getParameters() as $position => $parameterReflection) {
if ($parameterReflection->getType() === 'PHPStan\Type\StringType) {
$positions[] = $position;
}
} |
implemented multi positions 🎉 |
Apply multi positions seems cause error in CI https://github.com/rectorphp/rector-src/runs/4801793600?check_suite_focus=true |
CI notice resolved with check args in position exists as Expr 05eb2de |
It seems still error: bin/rector process config utils scoper.php --ansi --no-progress-bar
bin/rector process config utils scoper.php --ansi --no-progress-bar
shell: /usr/bin/bash -e {0}
env:
COMPOSER_ROOT_VERSION: dev-main
[ERROR] Could not process "scoper.php" file, due to:
"System error: "Internal error."
Run Rector with "--debug" option and post the report here:
https://github.com/rectorphp/rector/issues/new
". On line: 38
|
8210d1a
to
4a8b715
Compare
@TomasVotruba I rolled back multi positions automatically by string type check as it is not reliable. I will update to support define array of arg name, something like: private const ARG_POSITION_NAME_NULL_TO_STRICT_STRING = [
'preg_split' => ['subject'],
'preg_match' => ['subject'],
'preg_match_all' => ['subject'],
'explode' => ['string'],
'strlen' => ['string'],
'str_contains' => ['haystack', 'needle'],
]; |
implemented define multi positions per function defined 🎉 |
f31345f
to
70de008
Compare
All checks have passed 🎉 @TomasVotruba it is ready for review. |
Thank you 👍 |
Add new rule to change null to strict string defined function call args
Fixes rectorphp/rector#6910