Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make PhpStorm (JetBrains) enforce case sensitivity of function names in PHP

Tags:

php

phpstorm

It's probably not a big deal but I think the code should be consistent and I think case sensitivity is important for function calls. Is their a way to get PhpStorm to identify if a function call does not have the same case as it's definition?

Occasionally I find functions like updateNote looking like updateNOte due to my right hand typing faster than my left. I want to catch these and fix them.

PhpStorm finds a lot of other syntax items like data types and such, but I can't find an inspection for this. Does such an inspection exist?

like image 393
danielson317 Avatar asked Jan 31 '19 16:01

danielson317


People also ask

Is function name in PHP case-sensitive?

In PHP, class names as well as function/method names are case-insensitive, but it is considered good practice to them functions as they appear in their declaration.

Are PHP properties case-sensitive?

In PHP, variable and constant names are case sensitive, while function names are not.

Is PyCharm case-sensitive?

PyCharm, a dedicated Python Integrated Development Environment (IDE), assumes that macOS filesystems are case-insensitive. However, if you are on a case-sensitive file system, unexpected things may happen, such as missing files, undetected external changes, file cache conflicts and excessive indexing.


1 Answers

So while not intentional to answer my own question I finally found (after over an hour of searching and 5min after posting to stack overflow) a built in inspection for this in PHPStorm.

  1. Settings (Preferences on Mac)
  2. Editor
  3. Inspections
  4. PHP
  5. Code Smell (seriously this is what the category is called)
  6. Method call or class usage is not case sensitive

It is turned off by default and stored under an odd but perhaps good name.

like image 174
danielson317 Avatar answered Sep 18 '22 13:09

danielson317