Hello

I was recently looking at the substr plugin and noticed it had a couple small issues according to the PHP Inspections (EA Extended) plugin for PHP Storm. The 2 issues are:

1. is_null should not be used any longer. Per the plugin:

All 'is_null(...)' calls can be safely replaced with 'null === ...' constructs (or 'null !== ...' if the original construct was negated).

2. The return statement is redundant:

Variable  $new_value is redundant.   In some cases one-time use variable are simply not needed.

I know these are minor, but every little performance gain helps in the end. Patch to follow in comment.

CommentFileSizeAuthor
#3 3087461-substr-3.patch1.25 KBlabboy0276

Comments

labboy0276 created an issue. See original summary.

labboy0276’s picture

Issue summary: View changes
labboy0276’s picture

Status: Active » Needs review
StatusFileSize
new1.25 KB

Patch is attached.

heddn’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Trivial patch of the month

Minor improvements.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 71169689e9 to 9.0.x and 79c710773c to 8.9.x. Thanks!

  • alexpott committed 7116968 on 9.0.x
    Issue #3087461 by labboy0276: Optimizations to the substr process plugin
    

  • alexpott committed 79c7107 on 8.9.x
    Issue #3087461 by labboy0276: Optimizations to the substr process plugin...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.