Skip to content

Stop changing isset to not empty before a instanceof check#3066

Merged
Crabcyborg merged 1 commit into
masterfrom
stop_changing_isset_to_not_empty_before_a_instanceof_check
Apr 8, 2026
Merged

Stop changing isset to not empty before a instanceof check#3066
Crabcyborg merged 1 commit into
masterfrom
stop_changing_isset_to_not_empty_before_a_instanceof_check

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

This sniff was changing a line in our HubSpot plugin incorrectly.

Summary by CodeRabbit

Bug Fixes

  • Resolved code analysis false positives for patterns involving the instanceof operator, ensuring more accurate quality assessments and reducing unnecessary code change suggestions.

@Crabcyborg Crabcyborg added this to the 6.30 (Pricing Fields) milestone Apr 8, 2026
@coderabbitai

coderabbitai Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fe7e38fb-5037-4a02-99d0-fecfa6692950

📥 Commits

Reviewing files that changed from the base of the PR and between 07832bb and 87f7091.

📒 Files selected for processing (1)
  • phpcs-sniffs/Formidable/Sniffs/CodeAnalysis/SimplifyIssetTruthyCheckSniff.php

📝 Walkthrough

Walkthrough

A single-line modification to a PHP CodeSniffer sniff updates the comparison-operator exclusion list by adding the T_INSTANCEOF token, preventing false-positive matches when isset truthiness patterns are followed by instanceof comparisons.

Changes

Cohort / File(s) Summary
SimplifyIssetTruthyCheckSniff Logic
phpcs-sniffs/Formidable/Sniffs/CodeAnalysis/SimplifyIssetTruthyCheckSniff.php
Added T_INSTANCEOF token to the comparison-operator exclusion list to prevent incorrect pattern matching when instanceof checks follow the isset truthiness expression.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A token was troubling the sniff so keen,
instanceof causing false matches to gleam,
One line was all needed, precise and divine,
Now truthiness checks only work when they're mine! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: preventing the sniff from converting isset checks to not empty checks when an instanceof comparison follows.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stop_changing_isset_to_not_empty_before_a_instanceof_check

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@deepsource-io

deepsource-io Bot commented Apr 8, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 07832bb...87f7091 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Apr 8, 2026 1:27p.m. Review ↗
JavaScript Apr 8, 2026 1:27p.m. Review ↗

@deepsource-io

deepsource-io Bot commented Apr 8, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 07832bb...87f7091 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Apr 8, 2026 1:27p.m. Review ↗
JavaScript Apr 8, 2026 1:27p.m. Review ↗

@Crabcyborg Crabcyborg merged commit 7f2c9ff into master Apr 8, 2026
43 of 46 checks passed
@Crabcyborg Crabcyborg deleted the stop_changing_isset_to_not_empty_before_a_instanceof_check branch April 8, 2026 13:31
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.

1 participant