Skip to content

Add mysqli_fetch_column/fetch_column $column range checking Rule - #828

Open
bpfoley wants to merge 3 commits into
staabm:mainfrom
bpfoley:fetch-column-rule
Open

bpfoley wants to merge 3 commits into
staabm:mainfrom
bpfoley:fetch-column-rule

Conversation

@bpfoley

@bpfoley bpfoley commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread src/Rules/MysqliFetchColumnRule.php Outdated

public function __construct(
ReflectionProvider $reflectionProvider,
bool $reportMaybes,

@staabm staabm Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
bool $reportMaybes,
#[AutowiredParameter]
bool $reportMaybes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment thread src/Rules/MysqliFetchRangeRule.php Outdated
$reflection->getNamedArgumentsVariants(),
);
$call = ArgumentsNormalizer::reorderFuncArguments($acceptor, $node);
if ($call === null || ! isset($call->getArgs()[0], $call->getArgs()[1])) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

put $call->getArgs() into a variable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done for both FuncCall and MethodCall arms.

Comment thread src/Rules/MysqliFetchRangeRule.php Outdated
use staabm\PHPStanDba\MysqliReflection\MysqliResultObjectType;

/** @implements Rule<CallLike> */
final class MysqliFetchRangeRule implements Rule

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
final class MysqliFetchRangeRule implements Rule
final class MysqliFetchColumnRule implements Rule

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done everywhere.

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