Repository: VKCOM/noverify
Pull request #820 (2020-11-25 08:42:40)

cmd/embeddedrules: add callSimplify checker
	in_array($k, array_keys($a))
	=>
	array_key_exists($k, $a)

Idea is borrowed from EA PhpStorm extension:
```
[EA] 'array_key_exists($setting_id, Settings::RIGHTS)' should be used instead.
```


Patch:
diff --git a/src/cmd/embeddedrules/rules.go b/src/cmd/embeddedrules/rules.go
index 7e0baae..7be4b60 100644
--- a/src/cmd/embeddedrules/rules.go
+++ b/src/cmd/embeddedrules/rules.go
@@ -77,7 +77,7 @@ func (fi bindataFileInfo) Sys() interface{} {
 	return nil
 }
 
-var _embeddedrulesRulesPhp = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x98\xdb\x6e\xe3\x36\x13\x80\xef\xfd\x14\x63\x43\xeb\xd8\x5e\xdb\xfa\x17\xff\x5d\x8e\xdb\xde\x15\x58\x34\xc0\x16\x7b\x55\xec\xda\x94\x34\xb2\xb8\x91\x49\x95\xa4\x12\xab\x51\xde\xbd\x20\x29\xc5\xb2\x0e\xb1\x94\x36\x40\x0c\x7b\x48\xce\x37\x27\x72\x28\x5d\xdf\x25\x51\x32\x1a\xb9\x8b\xc5\x08\x16\xf0\x99\x71\xca\x64\x82\xbe\xa2\x9c\xc1\x2f\x5f\xbe\x18\x61\x4c\x99\x42\x01\xf6\x2f\xa0\x92\x78\x31\x8e\x60\xe1\x1e\x97\xf9\x7c\xbf\x47\xa6\xe0\x2b\x26\x5c\x28\x50\x28\x18\x11\x19\xe0\x21\x11\x28\x25\xe5\x4c\x82\x8a\x88\x02\x9f\x30\xf0\x10\x24\xdd\x27\x31\x0d\x29\x06\x6b\xb3\xdc\xc3\x90\x0b\x04\x70\x0e\x70\xa7\x3f\x2e\xc1\xc9\xcc\x00\x09\x2d\x58\x0f\x14\x42\x77\x14\xa6\xcc\xda\x57\x60\xfe\xb0\xda\xb2\xd9\x1c\x9e\x47\x00\xc6\x26\xd0\xab\xf7\x24\xf3\x10\x7c\x9e\xc6\x01\x08\x4c\x62\xe2\x23\xa8\x08\x5f\xcd\x7b\xa2\x2a\x82\x9f\xa9\x54\xe0\xf8\x9c\x05\xc5\x2a\x95\x25\x08\x1e\xe7\x71\x45\xea\x8e\xc0\xfe\x82\x3b\x50\x22\x45\xb8\x84\x90\xc4\x12\xaf\x46\x6f\x00\x9f\x04\x55\x08\x44\xc2\x76\xa6\xd5\xcd\x8d\x82\x6d\x95\x02\xe3\xff\x96\x53\x86\xa9\x84\x84\xf4\x50\x09\x9d\x11\x25\xa9\x40\x70\x0e\x47\x5a\x25\xe4\x03\x28\x77\x2d\x94\xbb\x92\xa2\xf5\x52\x29\x51\xcd\x9c\xc3\xbc\xaa\xfe\xa5\xb3\x62\x12\xae\x90\x29\x4a\x62\xe0\x09\x0a\x62\xd2\x9b\x08\xf4\x31\x40\xe6\xa3\xd6\x96\xa2\x6c\x14\xcb\x14\x9c\x3d\x91\x0f\x70\x73\x03\xff\xbb\x02\xd7\xd5\x5f\x22\x22\x21\xa2\xbb\x08\x45\x55\x81\x8a\x08\x83\xe9\x49\x4d\xcd\x8e\x0a\xe6\x46\xc3\x69\x71\x1d\x17\x97\x75\xe5\xc2\xef\x5c\xe1\x25\x3c\xa1\xae\x26\x6d\xf5\xb6\x62\xc3\xf8\x46\x87\x44\x07\x88\x34\x2c\x07\x7c\x44\x66\x55\xd0\x10\xe8\xeb\x3e\xf0\x49\xba\x8b\x94\xad\xc3\xad\xae\x08\x3f\x42\xff\xe1\x3e\xd9\x16\xbb\x45\xff\x92\xe0\x71\x15\xd9\xb0\x98\x2a\x71\x5d\xd0\x53\x25\x98\xaa\x02\x2a\x81\x71\x05\x04\x76\x9c\x07\xe5\x34\x08\xb9\x00\x8f\xaa\x27\x2a\xf1\x18\xd1\xf9\xda\x2c\xb7\x3a\x6c\xe0\x29\xdb\xc1\x96\xb2\x47\x12\xd3\xc0\xaa\x5d\xea\x5d\x8b\xbe\xc2\x00\x58\xba\xf7\x50\x40\xc8\x53\x16\x98\x1d\xb1\x05\x2a\xed\x6a\x8d\x34\x36\x46\x18\x27\x61\x1a\x2f\xc1\x43\x9f\xa4\xd2\x6e\x30\xc1\xb9\x02\x1e\x9a\xef\x89\xe0\x5e\x8c\x7b\x6d\xe7\x31\x2c\xd6\x10\xf8\xad\x0a\x06\x22\x10\x08\x08\x94\x69\x5c\xac\x26\x6a\x5d\x94\x24\x7c\x7e\x22\x82\x69\x6b\xcf\xa4\xd8\x56\x1f\x61\xd9\x06\xff\xda\x78\x54\x11\x16\x5c\x9a\xf4\x01\x38\x1b\xbd\xd8\xd9\xe8\x94\x6d\xae\x4a\xd1\xf4\x55\xae\x45\x2f\x75\xdc\xb8\x2f\x8e\xb5\xf1\xc6\x1d\xbc\x71\x27\xef\x66\x80\x7f\xff\x6f\x73\xb0\xd3\xc3\x37\x5c\x1c\xe0\x63\x0b\x73\xdc\xc5\x1c\x57\x98\xc3\xd2\x98\xd7\xd3\xc8\x45\x23\x8b\x79\x95\x97\xff\x9b\x2c\xe6\x8d\x2c\x9e\xe0\xc6\x1d\xb8\x77\x27\x31\x6f\x24\xb1\xe6\x5e\xa7\x7f\xef\xcd\x61\xde\xcc\x61\xcd\xc5\x4e\x1f\x8f\xc8\xee\xd3\x9b\x48\x49\x77\x4c\x4b\x7a\xf7\xf9\x1b\xfd\xf1\xd1\x74\x85\x5a\xa3\xff\x78\x53\x48\x2b\x87\xb1\x05\xdc\x27\x67\x5a\xfc\x49\x8f\x32\x7a\x6a\x3d\xca\xc8\xba\x3b\x61\xc5\xa8\xbe\x94\x55\x0b\x65\xd5\x83\xb2\x1a\x44\x59\xb4\x50\x16\x3d\x28\x8b\x41\x14\xb7\x85\xe2\xf6\xa0\xb8\x83\x28\x1f\x5a\x28\x1f\x7a\x50\x3e\x0c\xa2\x4c\x5b\x28\xd3\x1e\x94\xe9\x20\x4a\xde\x42\xc9\x7b\x50\xf2\x41\x94\x1f\x2d\x94\x1f\x3d\x28\x3f\x06\x51\xae\xaf\x5b\x30\x56\x78\x86\x73\x7d\x3d\x08\x74\x7b\xdb\x02\xb2\xc2\x33\xa0\xdb\xdb\x41\xa0\x75\x0b\x67\xdd\x03\xb3\x1e\x78\x17\x6e\xc1\x58\xe1\x19\x8e\xb9\x31\xf7\xbc\x15\x87\xe1\xca\xcb\x56\x9c\x21\xec\xa9\x54\xe4\xa1\x71\x1b\x26\x7f\xfa\x3c\x65\x6a\xe6\x90\xf9\xf7\xd3\x23\xb5\x32\xb2\xfa\xf4\xfd\xf4\x60\xe5\x61\xf8\x6b\xf6\xa9\x71\xac\x96\x6d\x45\x5f\xde\x88\x17\x67\xa0\x9f\x00\x59\x80\x01\x28\x0e\xfa\x96\x67\x34\xae\x3e\x99\xeb\x2e\x03\xca\x02\x3c\x54\x02\x00\x35\x2c\xac\x40\x83\x4b\xf7\xab\xa6\xd6\xe2\x7c\x16\x2c\xe9\xdf\xc8\xc3\x73\x64\x3b\xab\x15\x7d\x1c\xfa\xfe\x56\xe8\x65\x2a\x13\xea\x53\x9e\xea\x7b\xe9\x2e\xb5\xbd\x8d\x8b\x00\xc5\x69\xdc\xa5\x12\x09\x97\xb3\x0b\xf7\x62\x09\x8e\x9c\x9f\x44\xbe\x18\x73\xe4\x12\x2e\xdc\x8b\x79\xad\xa5\x89\x9d\xbc\xd7\xfa\xba\x83\x5f\x66\xdf\x84\xc1\xe7\x42\xa0\xaf\x20\x22\x99\x54\xc4\x7f\x00\x7d\xcd\x67\x88\x41\x8c\x75\x0b\x5f\xdd\xd5\xfd\xbe\x9c\xbf\xb1\x73\xcb\xa6\x5f\xda\xf6\x3c\xf1\x23\x22\x26\x2f\x4b\x70\x9e\x27\x8b\xc9\xcb\xfc\xaa\x1c\xa6\x67\xc6\xdf\x5e\x9f\x7a\x52\x89\x4d\x91\xe7\xe7\x89\x54\xf5\x39\x2f\x1d\x89\x6f\x75\xba\x78\x7a\x37\x09\xd2\x7e\xcb\xd4\xfb\xa9\xe5\x5d\x8e\x27\x02\x77\x9b\x62\xd1\xcc\xd9\x2c\xc1\xfc\x37\xcd\x18\x6e\x82\xc5\x2b\xa1\x27\xbe\x15\x76\xed\x7d\xb1\xa4\x12\xf2\x36\x9b\xba\xe2\xdb\x98\x3b\x99\xbc\x3f\x80\x01\xc6\x74\x4f\x75\x59\xf6\xb0\x1f\x0f\x49\xcc\x83\x02\xdc\x62\x60\xaf\x5d\x93\x4a\xb2\x43\xfd\x18\xd7\x78\x0c\xad\x9d\x5c\x34\x84\x99\x43\xe5\xb7\xaf\x5f\x74\xf3\x7d\x44\x41\xc3\x6c\x0e\xeb\xf5\xfa\x64\x2f\x55\x67\x35\xa6\x55\xb6\x55\x41\xbb\x4f\x64\xe7\xbe\xfa\x26\x31\x80\x69\xcd\x2e\x2e\x80\x3f\xa2\xb0\x2f\x7e\x8a\xa7\x68\xb9\x84\x04\x45\x44\x12\xa9\x99\x54\xbe\x1e\x46\x77\xb5\x7b\xc5\xf4\x78\xd6\x57\xde\x1e\x1d\x9a\xa2\xac\xda\x03\x5a\xae\x1a\x27\x26\xe6\xc3\x4c\xcc\xf3\x37\x4c\xcc\xf3\x77\x99\x98\x17\x0d\xea\x9f\x00\x00\x00\xff\xff\x98\x8d\x25\xec\x26\x14\x00\x00")
+var _embeddedrulesRulesPhp = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x98\x4b\x6f\xe3\x36\x10\x80\xef\xfe\x15\x63\x43\xeb\xd8\x5e\xdb\xea\xa2\xb7\x3c\xb7\xed\xa9\xc0\xa2\x01\xb6\xd8\x53\xb1\xb1\x29\x69\x64\x71\x23\x93\x2a\x49\x25\x56\xa3\xfc\xf7\x82\x94\x14\xeb\x69\x4b\x69\x03\xc4\xb0\x87\xe4\x7c\xf3\x22\x87\xd2\xf5\x5d\x14\x44\xa3\x91\xbd\x58\x8c\x60\x01\x9f\x19\xa7\x4c\x46\xe8\x2a\xca\x19\xfc\xf2\xe5\x8b\x11\x86\x94\x29\x14\x90\xfd\x79\x54\x12\x27\xc4\x11\x2c\xec\xe3\x32\x97\xef\xf7\xc8\x14\x7c\xc5\x88\x0b\x05\x0a\x05\x23\x22\x01\x3c\x44\x02\xa5\xa4\x9c\x49\x50\x01\x51\xe0\x12\x06\x0e\x82\xa4\xfb\x28\xa4\x3e\x45\x6f\x6d\x96\x3b\xe8\x73\x81\x00\xd6\x01\xee\xf4\xc7\x25\x58\x89\x19\x20\x7e\x06\xd6\x03\xb9\xd0\x1e\xf9\x31\xcb\xec\xcb\x31\x7f\x66\xda\x92\xd9\x1c\x5e\x46\x00\xc6\x26\xd0\xab\xf7\x24\x71\x10\x5c\x1e\x87\x1e\x08\x8c\x42\xe2\x22\xa8\x00\xdf\xcc\x7b\xa6\x2a\x80\x1f\xb1\x54\x60\xb9\x9c\x79\xf9\x2a\x95\x44\x08\x0e\xe7\x61\x49\x6a\x8f\x20\xfb\x05\x77\xa0\x44\x8c\x70\x09\x3e\x09\x25\x5e\x8d\x4e\x00\x9f\x05\x55\x08\x44\xc2\x76\xa6\xd5\xcd\x8d\x82\x6d\x99\x02\xe3\xff\x97\x53\x84\xa9\x80\xf8\xf4\x50\x0a\x9d\x11\x45\xb1\x40\xb0\x0e\x47\x5a\x29\xe4\x03\x28\x77\x2d\x94\xbb\x82\xa2\xf5\x52\x29\x51\xcd\xac\xc3\xbc\xac\xfe\xb5\xb3\x62\x22\xae\x90\x29\x4a\x42\xe0\x11\x0a\x62\xd2\x1b\x09\x74\xd1\x43\xe6\xa2\xd6\x16\xa3\x6c\x14\xcb\x14\xac\x3d\x91\x8f\x70\x73\x03\x3f\x5d\x81\x6d\xeb\x2f\x01\x91\x10\xd0\x5d\x80\xa2\xac\x40\x05\x84\xc1\xb4\x52\x53\xb3\xa3\x82\xb9\xd1\x50\x2d\xae\xe3\xe2\xa2\xae\x6c\xf8\x83\x2b\xbc\x84\x67\xd4\xd5\xa4\xad\xde\x96\x6c\x18\xdf\xe8\x90\xe8\x00\x91\x86\xe5\x80\x4f\xc8\x32\x15\xd4\x07\xfa\xb6\x0f\x5c\x12\xef\x02\x95\xd5\xe1\x56\x57\x84\x1b\xa0\xfb\x78\x1f\x6d\xf3\xdd\xa2\x7f\x49\x70\xb8\x0a\xb2\xb0\x98\x2a\xb1\x6d\xd0\x53\x25\x98\xaa\x02\x2a\x81\x71\x05\x04\x76\x9c\x7b\xc5\x34\xf0\xb9\x00\x87\xaa\x67\x2a\xf1\x18\xd1\xf9\xda\x2c\xcf\x74\x64\x81\xa7\x6c\x07\x5b\xca\x9e\x48\x48\xbd\x4c\xed\x52\xef\x5a\x74\x15\x7a\xc0\xe2\xbd\x83\x02\x7c\x1e\x33\xcf\xec\x88\x2d\x50\x99\xad\xd6\x48\x63\x63\x80\x61\xe4\xc7\xe1\x12\x1c\x74\x49\x2c\xb3\x0d\x26\x38\x57\xc0\x7d\xf3\x3d\x12\xdc\x09\x71\xaf\xed\x3c\x86\x25\x33\x04\x7e\x2f\x83\x81\x08\x04\x02\x02\x65\x1c\xe6\xab\x89\x5a\xe7\x25\x09\x9f\x9f\x89\x60\xda\xda\x33\x29\xce\xaa\x8f\xb0\x64\x83\x7f\x6f\x1c\xaa\x08\xf3\x2e\x4d\xfa\x00\xac\x8d\x5e\x6c\x6d\x74\xca\x36\x57\x85\x68\xfa\x26\xd7\xa2\xd7\x3a\x6e\xdc\x17\xc7\xda\x78\xe3\x0e\xde\xb8\x93\x77\x33\xc0\xbf\x9f\xdb\x1c\xec\xf4\xf0\x84\x8b\x03\x7c\x6c\x61\x8e\xbb\x98\xe3\x12\x73\x58\x1a\xd3\x7a\x1a\xb9\x68\x64\x31\x2d\xf3\xd2\xff\x92\xc5\xb4\x91\xc5\x0a\x6e\xdc\x81\x7b\x77\x12\xd3\x46\x12\x6b\xee\x75\xfa\xf7\xde\x1c\xa6\xcd\x1c\xd6\x5c\xec\xf4\xf1\x88\xec\x3e\xbd\x89\x94\x74\xc7\xb4\xa4\x77\x9f\xbf\xd1\x1f\x1f\x4d\x57\xa8\x35\xfa\x8f\x37\xb9\xb4\x74\x18\x67\x80\xfb\xe8\x4c\x8b\xaf\xf4\x28\xa3\xa7\xd6\xa3\x8c\xac\xbb\x13\x96\x8c\xea\x4b\x59\xb5\x50\x56\x3d\x28\xab\x41\x94\x45\x0b\x65\xd1\x83\xb2\x18\x44\xb1\x5b\x28\x76\x0f\x8a\x3d\x88\xf2\xa1\x85\xf2\xa1\x07\xe5\xc3\x20\xca\xb4\x85\x32\xed\x41\x99\x0e\xa2\xa4\x2d\x94\xb4\x07\x25\x1d\x44\x79\x68\xa1\x3c\xf4\xa0\x3c\x0c\xa2\x5c\x5f\xb7\x60\x32\xe1\x19\xce\xf5\xf5\x20\xd0\xed\x6d\x0b\x28\x13\x9e\x01\xdd\xde\x0e\x02\xad\x5b\x38\xeb\x1e\x98\xf5\xc0\xbb\x70\x0b\x26\x13\x9e\xe1\x98\x1b\x73\xcf\x5b\xb1\xef\xaf\x9c\x64\xc5\x19\xc2\x9e\x4a\x45\x1e\x1b\xb7\x61\xf2\x97\xcb\x63\xa6\x66\x16\x99\x7f\xaf\x1e\xa9\xa5\x91\xd5\xa7\xef\xd5\x83\x95\xfb\xfe\xaf\xc9\xa7\xc6\xb1\x5a\xb4\x15\x7d\x79\x23\x4e\x98\x80\x7e\x02\x64\x1e\x7a\xa0\x38\xe8\x5b\x9e\xd1\xb8\xfa\x64\xae\xbb\x0c\x28\xf3\xf0\x50\x0a\x00\xd4\xb0\xb0\x02\x0d\x2e\xdc\x2f\x9b\x5a\x8b\xf3\x59\xb0\xa4\xff\x20\xf7\xcf\x91\xb3\x59\xad\xe8\xe3\xd0\xf7\x53\xa1\x97\xb1\x8c\xa8\x4b\x79\xac\xef\xa5\xbb\x38\xeb\x6d\x5c\x78\x28\xaa\x71\x97\x4a\x44\x5c\xce\x2e\xec\x8b\x25\x58\x72\x5e\x89\x7c\x3e\x66\xc9\x25\x5c\xd8\x17\xf3\x5a\x4b\x13\x3b\x79\xaf\xf5\x75\x07\xbf\xc8\xbe\x09\x83\xcb\x85\x40\x57\x41\x40\x12\xa9\x88\xfb\x08\xfa\x9a\xcf\x10\xbd\x10\xeb\x16\xbe\xb9\xab\xfb\x7d\x31\x7f\x93\xcd\x2d\x9a\x7e\x61\xdb\xcb\xc4\x0d\x88\x98\xbc\x2e\xc1\x7a\x99\x2c\x26\xaf\xf3\xab\x62\x98\x9e\x19\x3f\xbd\x3e\x76\xa4\x12\x9b\x3c\xcf\x2f\x13\xa9\xea\x73\x5e\x3b\x12\xdf\xea\x74\xfe\xf4\x6e\x12\xa4\xfd\x96\xb1\xf3\x43\xcb\xbb\x1c\x8f\x04\xee\x36\xf9\xa2\x99\xb5\x59\x82\xf9\x6f\x9a\x31\xdc\x84\x0c\xaf\x84\x9e\x78\x2a\xec\xda\xfb\x7c\x49\x29\xe4\x6d\x36\x75\xc5\xb7\x31\x77\x32\x79\x7f\x00\x3d\x0c\xe9\x9e\xea\xb2\xec\x61\x3f\x1e\xa2\x90\x7b\x39\xb8\xc5\xc0\x5e\xbb\x26\x96\x64\x87\xfa\x31\xae\xf1\x18\x5a\x3b\xb9\xa8\x0f\x33\x8b\xca\x6f\x5f\xbf\xe8\xe6\xfb\x84\x82\xfa\xc9\x1c\xd6\xeb\x75\x65\x2f\x95\x67\x35\xa6\x95\xb6\x55\x4e\xbb\x8f\x64\xe7\xbe\xfa\x26\xd1\x83\x69\xcd\x2e\x2e\x80\x3f\xa1\xc8\x5e\xfc\xe4\x4f\xd1\x72\x09\x11\x8a\x80\x44\x52\x33\xa9\x7c\x3b\x8c\xee\x6a\xf7\x8a\xe9\xf1\xac\x2f\xbd\x3d\x3a\x34\x45\x49\xb9\x07\xb4\x5c\x35\x2a\x26\xa6\xc3\x4c\x4c\xd3\x13\x26\xa6\xe9\xbb\x4c\x4c\xcf\x34\x28\x97\x84\xe1\xe0\xb7\x7c\x94\x6d\x88\x10\x24\x99\x59\x8f\x4b\x30\xdf\x36\x8f\x98\xc8\x99\xa5\x02\x2a\x57\xb7\x1e\x51\x64\x5e\x3d\x48\xdf\x26\x6d\xf0\x40\xa5\x92\x66\x65\x79\x7a\xb5\x06\xb4\x55\x67\x5e\x0a\xfe\x66\x3a\x79\x6e\x61\xa2\x9b\x4b\x0b\x03\x93\x25\x58\x5a\x79\xa9\xbd\x9c\x99\x66\x5e\x7d\x1d\xfd\xd3\x43\x65\x0f\xc9\xdc\x6c\x9f\x7f\x03\x00\x00\xff\xff\xe2\x8d\x2a\x7e\x75\x15\x00\x00")
 
 func embeddedrulesRulesPhpBytes() ([]byte, error) {
 	return bindataRead(
diff --git a/src/cmd/embeddedrules/rules.php b/src/cmd/embeddedrules/rules.php
index 9f90778..52d11aa 100644
--- a/src/cmd/embeddedrules/rules.php
+++ b/src/cmd/embeddedrules/rules.php
@@ -261,3 +261,16 @@ function bitwiseOps() {
    */
   $x | $y;
 }
+
+/**
+ * @comment Report call expressions that can be simplified.
+ * @before  in_array($k, array_keys($this->data))
+ * @after   array_key_exists($k, $this->data)
+ */
+function callSimplify() {
+  /**
+   * @maybe Could simplify to array_key_exists($key, $a)
+   * @fix   array_key_exists($key, $a)
+   */
+  in_array($key, array_keys($a));
+}


Test patch:
diff --git a/src/tests/golden/testdata/embeddedrules/callSimplify.php b/src/tests/golden/testdata/embeddedrules/callSimplify.php
new file mode 100644
index 0000000..3497240
--- /dev/null
+++ b/src/tests/golden/testdata/embeddedrules/callSimplify.php
@@ -0,0 +1,8 @@
+<?php
+
+function in_array_over_array_keys(array $array) {
+    $_ = in_array('abc', array_keys($array)); // bad
+    $_ = array_keys('abc', $array); // good
+    $_ = in_array('abc', array_keys($array), true);  // don't touch, has 3rd arg
+    $_ = in_array('abc', array_keys($array), false); // don't touch, has 3rd arg
+}
diff --git a/src/tests/golden/testdata/embeddedrules/golden.txt b/src/tests/golden/testdata/embeddedrules/golden.txt
index b24df65..1efdc6d 100644
--- a/src/tests/golden/testdata/embeddedrules/golden.txt
+++ b/src/tests/golden/testdata/embeddedrules/golden.txt
@@ -64,6 +64,9 @@ WARNING bitwiseOps: Used & bitwise operator over bool operands, perhaps && is in
 WARNING bitwiseOps: Used | bitwise operator over bool operands, perhaps || is intended? at testdata/embeddedrules/bitwiseOps.php:9
   $_ = (($x == 1) | ($x == 2)); // Bad 2
         ^^^^^^^^^^^^^^^^^^^^^
+MAYBE   callSimplify: Could simplify to array_key_exists('abc', $array) at testdata/embeddedrules/callSimplify.php:4
+    $_ = in_array('abc', array_keys($array)); // bad
+         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 WARNING offBy1: probably intended to use count-1 as an index at testdata/embeddedrules/offBy1.php:7
   $_ = $xs[count($xs)];
        ^^^^^^^^^^^^^^^
diff --git a/src/tests/golden/testdata/quickfix/callSimplify.php b/src/tests/golden/testdata/quickfix/callSimplify.php
new file mode 100644
index 0000000..1443c05
--- /dev/null
+++ b/src/tests/golden/testdata/quickfix/callSimplify.php
@@ -0,0 +1,15 @@
+<?php
+
+$array = ['a' => 1, 'b' => 2, 'c' => 3];
+
+function f1($k, $xs) {
+    return in_array($k . '_id', array_keys($xs['data'][0])); // 1
+}
+
+function f2($k, $xs) {
+    return in_array($k . '_id', $xs['data'][0]);
+}
+
+if (in_array('z', array_keys($array))) { // 2
+    echo "contains z key\n";
+}
diff --git a/src/tests/golden/testdata/quickfix/callSimplify.php.fix.expected b/src/tests/golden/testdata/quickfix/callSimplify.php.fix.expected
new file mode 100644
index 0000000..272554e
--- /dev/null
+++ b/src/tests/golden/testdata/quickfix/callSimplify.php.fix.expected
@@ -0,0 +1,15 @@
+<?php
+
+$array = ['a' => 1, 'b' => 2, 'c' => 3];
+
+function f1($k, $xs) {
+    return array_key_exists($k . '_id', $xs['data'][0]); // 1
+}
+
+function f2($k, $xs) {
+    return in_array($k . '_id', $xs['data'][0]);
+}
+
+if (array_key_exists('z', $array)) { // 2
+    echo "contains z key\n";
+}