PHPStan 0.8: Successful Jan 8 2018

https://phpstan-08.staging.clippings.com

Haralan Dobrev
By Haralan Dobrev

What is this about?

Updates PHPStan with the highest level of checks (now 7) and every error reported fixed. Re-opened after #2356 was closed.

During updating found out that we actually had a misconfiguration which caused all errors with null to be ignored. (The regex pipe character was not escaped)

This fixes all PHPStan reported errors and removes a lot of ignored errors either due to PHPStan understanding the code better now or because the errors were addressed.

Removed some code which is not used and had errors reporeted inside.

Checklist

  • [x] Update PHPStan to 0.8.4 - Changelog
  • [ ] Fix all PHPStan errors
  • [x] Remove Architonic import commands
  • [x] Remove completely merging products in the admin (there were a few things still left from last cleanup)
  • [x] Remove restoring deleted products from admin
  • [x] Add PHPStan extension for Jam_Meta methods and their return type
  • [x] Fix an actual bug with swatch pictures
  • [x] Make sure nullable types are consistently used throughout the codebase
  • [ ] Fixed tests
  • [x] Assigned people to review

Staging to review

https://phpstan-08.staging.clippings.com

Notes for deployment

None

Screenshots, links and notes

🏇 PHPStan now runs for ~20 seconds. It is even more convenient to run quickly while you work:
image

It now also has an improved support for linting individual files so we could try to introduce it as a pre-commit hook.

Creating database staging_phpstan-08
Populating database phpstan-08
Warning: Using a password on the command line interface can be insecure.
Warning: Using a password on the command line interface can be insecure.
 118MiB 0:00:30 [3.95MiB/s] [>                                 ]  1% ETA 0:33:17
 172MiB 0:01:00 [1.77MiB/s] [>                                 ]  2% ETA 0:45:32
 200MiB 0:01:30 [ 972KiB/s] [>                                 ]  2% ETA 0:58:23
 259MiB 0:02:00 [1.96MiB/s] [>                                 ]  3% ETA 0:59:49
 340MiB 0:02:30 [2.71MiB/s] [>                                 ]  4% ETA 0:56:18
 423MiB 0:03:00 [2.76MiB/s] [>                                 ]  5% ETA 0:53:45
 504MiB 0:03:30 [2.67MiB/s] [=>                                ]  6% ETA 0:52:08
 593MiB 0:04:00 [2.94MiB/s] [=>                                ]  7% ETA 0:50:03
 673MiB 0:04:30 [2.69MiB/s] [=>                                ]  8% ETA 0:49:01
 751MiB 0:05:00 [2.59MiB/s] [==>                               ]  9% ETA 0:48:20
 836MiB 0:05:30 [2.85MiB/s] [==>                               ] 10% ETA 0:47:13
 920MiB 0:06:00 [2.81MiB/s] [==>                               ] 11% ETA 0:46:14
   1GiB 0:06:30 [3.62MiB/s] [===>                              ] 12% ETA 0:44:09
1.12GiB 0:07:00 [3.79MiB/s] [===>                              ] 14% ETA 0:42:07
1.31GiB 0:07:30 [6.54MiB/s] [====>                             ] 16% ETA 0:37:23
1.37GiB 0:08:00 [2.19MiB/s] [====>                             ] 17% ETA 0:37:38
1.44GiB 0:08:30 [2.32MiB/s] [=====>                            ] 18% ETA 0:37:43
1.51GiB 0:09:00 [2.27MiB/s] [=====>                            ] 19% ETA 0:37:46
1.57GiB 0:09:30 [2.33MiB/s] [=====>                            ] 20% ETA 0:37:44
1.64GiB 0:10:00 [2.33MiB/s] [=====>                            ] 20% ETA 0:37:37
1.71GiB 0:10:30 [2.33MiB/s] [======>                           ] 21% ETA 0:37:31
1.78GiB 0:11:00 [2.34MiB/s] [======>                           ] 22% ETA 0:37:23
1.84GiB 0:11:30 [2.06MiB/s] [======>                           ] 23% ETA 0:37:26
 1.9GiB 0:12:00 [2.13MiB/s] [=======>                          ] 24% ETA 0:37:21
1.96GiB 0:12:30 [2.12MiB/s] [=======>                          ] 25% ETA 0:37:17
2.02GiB 0:13:00 [2.08MiB/s] [=======>                          ] 25% ETA 0:37:15
2.09GiB 0:13:30 [2.13MiB/s] [=======>                          ] 26% ETA 0:37:05
2.15GiB 0:14:00 [2.12MiB/s] [========>                         ] 27% ETA 0:36:58
2.21GiB 0:14:30 [2.15MiB/s] [========>                         ] 28% ETA 0:36:47
2.27GiB 0:15:00 [ 2.1MiB/s] [========>                         ] 29% ETA 0:36:37
2.33GiB 0:15:30 [2.05MiB/s] [========>                         ] 29% ETA 0:36:28
 2.4GiB 0:16:00 [ 2.1MiB/s] [=========>                        ] 30% ETA 0:36:15
2.45GiB 0:16:30 [1.99MiB/s] [=========>                        ] 31% ETA 0:36:07
2.51GiB 0:17:00 [   2MiB/s] [=========>                        ] 32% ETA 0:35:57
2.57GiB 0:17:30 [1.95MiB/s] [=========>                        ] 32% ETA 0:35:47
2.62GiB 0:18:00 [1.83MiB/s] [==========>                       ] 33% ETA 0:35:41
2.67GiB 0:18:30 [1.57MiB/s] [==========>                       ] 34% ETA 0:35:44
2.73GiB 0:19:00 [1.89MiB/s] [==========>                       ] 34% ETA 0:35:34
2.78GiB 0:19:30 [1.93MiB/s] [==========>                       ] 35% ETA 0:35:20
2.84GiB 0:20:00 [1.97MiB/s] [===========>                      ] 36% ETA 0:35:07
 2.9 iB 0:20:30 [2.14MiB/s] [===========>                      ] 37% ETA 0:34:46
2.96GiB 0:21:00 [2.08MiB/s] [===========>                      ] 37% ETA 0:34:28
3.02GiB 0:21:30 [2.11MiB/s] [===========>                      ] 38% ETA 0:34:08
3.09GiB 0:22:00 [2.19MiB/s] [============>                     ] 39% ETA 0:33:44
3.15GiB 0:22:30 [2.15MiB/s] [============>                     ] 40% ETA 0:33:22
3.22GiB 0:23:00 [2.38MiB/s] [============>                     ] 41% ETA 0:32:52
3.28GiB 0:23:30 [   2MiB/s] [============>                     ] 41% ETA 0:32:34
3.34GiB 0:24:00 [1.96MiB/s] [=============>                    ] 42% ETA 0:32:15
3.39GiB 0:24:30 [1.94MiB/s] [=============>                    ] 43% ETA 0:31:59
3.45GiB 0:25:00 [1.96MiB/s] [=============>                    ] 44% ETA 0:31:40
3.51GiB 0:25:30 [1.95MiB/s] [=============>                    ] 44% ETA 0:31:22
3.57GiB 0:26:00 [1.97MiB/s] [==============>                   ] 45% ETA 0:31:02
3.63GiB 0:26:30 [2.09MiB/s] [==============>                   ] 46% ETA 0:30:40
3.69GiB 0:27:00 [2.01MiB/s] [==============>                   ] 47% ETA 0:30:19
3.74GiB 0:27:30 [1.94MiB/s] [==============>                   ] 47% ETA 0:29:59
 3.8GiB 0:28:00 [   2MiB/s] [===============>                  ] 48% ETA 0:29:38
3.86GiB 0:28:30 [1.98MiB/s] [===============>                  ] 49% ETA 0:29:17
3.92GiB 0:29:00 [2.02MiB/s] [================>                 ] 50% ETA 0:28:54
3.98GiB 0:29:30 [1.95MiB/s] [================>                 ] 50% ETA 0:28:32
4.04GiB 0:30:00 [2.01MiB/s] [================>                 ] 51% ETA 0:28:09
4.09GiB 0:30:30 [   2MiB/s] [================>                 ] 52% ETA 0:27:48
4.15GiB 0:31:00 [2.02MiB/s] [=================>                ] 53% ETA 0:27:24
4.21GiB 0:31:30 [2.08MiB/s] [=================>                ] 53% ETA 0:26:59
4.28GiB 0:32:00 [2.07MiB/s] [=================>                ] 54% ETA 0:26:35
4.33GiB 0:32:30 [2.03MiB/s] [=================>                ] 55% ETA 0:26:10
4.39GiB 0:33:00 [1.94MiB/s] [==================>               ] 56% ETA 0:25:48
4.45GiB 0:33:30 [2.08MiB/s] [==================>               ] 56% ETA 0:25:23
4.51GiB 0:34:00 [2.09MiB/s] [==================>               ] 57% ETA 0:24:57
4.57GiB 0:34:30 [2.04MiB/s] [==================>               ] 58% ETA 0:24:32
4.63GiB 0:35:00 [2.03MiB/s] [===================>              ] 59% ETA 0:24:07
4.69GiB 0:35:31 [1.99MiB/s] [===================>              ] 59% ETA 0:23:43
4.75GiB 0:36:00 [1.91MiB/s] [===================>              ] 60% ETA 0:23:20
4.81GiB 0:36:31 [1.97MiB/s] [===================>              ] 61% ETA 0:22:57
4.86GiB 0:37:00 [1.95MiB/s] [====================>             ] 62% ETA 0:22:33
4.92GiB 0:37:30 [1.97MiB/s] [====================>             ] 62% ETA 0:22:10
4.98GiB 0:38:00 [1.95MiB/s] [====================>             ] 63% ETA 0:21:46
5.03GiB 0:38:30 [1.99MiB/s] [====================>             ] 64% ETA 0:21:21
5.09GiB 0:39:00 [1.99MiB/s] [=====================>            ] 65% ETA 0:20:56
5.15GiB 0:39:30 [1.96MiB/s] [=====================>            ] 65% ETA 0:20:31
 5.2GiB 0:40:00 [1.73MiB/s] [=====================>            ] 66% ETA 0:20:11
5.25GiB 0:40:30 [1.78MiB/s] [=====================>            ] 67% ETA 0:19:50
5.34GiB 0:41:00 [2.94MiB/s] [======================>           ] 68% ETA 0:19:06
5.43GiB 0:41:30 [3.17MiB/s] [======================>           ] 69% ETA 0:18:16
5.52GiB 0:42:00 [3.03MiB/s] [======================>           ] 70% ETA 0:17:31
 5.6GiB 0:42:30 [2.66MiB/s] [=======================>          ] 71% ETA 0:16:53
5.69GiB 0:43:00 [3.08MiB/s] [=======================>          ] 72% ETA 0:16:09
5.77GiB 0:43:30 [2.88MiB/s] [=======================>          ] 73% ETA 0:15:28
5.86GiB 0:44:00 [   3MiB/s] [========================>         ] 74% ETA 0:14:44
5.96GiB 0:44:30 [3.24MiB/s] [========================>         ] 76% ETA 0:13:58
6.05GiB 0:45:00 [3.25MiB/s] [=========================>        ] 77% ETA 0:13:10
6.16GiB 0:45:30 [3.58MiB/s] [=========================>        ] 78% ETA 0:12:20
6.26GiB 0:46:00 [ 3.4MiB/s] [=========================>        ] 79% ETA 0:11:33
6.35GiB 0:46:30 [3.38MiB/s] [==========================>       ] 81% ETA 0:10:46
6.46GiB 0:47:00 [3.65MiB/s] [==========================>       ] 82% ETA 0:09:55
6.57GiB 0:47:30 [3.62MiB/s] [===========================>      ] 83% ETA 0:09:06
6.67GiB 0:48:00 [3.48MiB/s] [===========================>      ] 85% ETA 0:08:19
6.76GiB 0:48:30 [3.05MiB/s] [============================>     ] 86% ETA 0:07:39
6.84GiB 0:49:00 [2.83MiB/s] [============================>     ] 87% ETA 0:07:02
6.92GiB 0:49:30 [2.64MiB/s] [============================>     ] 88% ETA 0:06:29
   7GiB 0:50:00 [2.76MiB/s] [=============================>    ] 89% ETA 0:05:54
7.08GiB 0:50:30 [2.71MiB/s] [=============================>    ] 90% ETA 0:05:20
7.16GiB 0:51:00 [ 2.7MiB/s] [=============================>    ] 91% ETA 0:04:44
7.24GiB 0:51:30 [ 2.8MiB/s] [==============================>   ] 92% ETA 0:04:10
7.32GiB 0:52:00 [2.78MiB/s] [==============================>   ] 93% ETA 0:03:34
 7.4GiB 0:52:30 [2.76MiB/s] [==============================>   ] 94% ETA 0:03:00
7.49GiB 0:53:00 [2.82MiB/s] [===============================>  ] 95% ETA 0:02:24
7.56GiB 0:53:30 [2.55MiB/s] [===============================>  ] 96% ETA 0:01:53
7.67GiB 0:54:00 [3.65MiB/s] [===============================>  ] 97% ETA 0:01:07
7.75GiB 0:54:30 [2.93MiB/s] [================================> ] 99% ETA 0:00:31
7.83GiB 0:55:01 [2.39MiB/s] [================================> ] 99% ETA 0:00:00
7.83GiB 0:55:01 [2.43MiB/s] [================================>] 100%            
Set umask to 002
Cloning git repository origin/phpstan-08
Updating permissions
Installing composer dependencies
Installing javascript dependencies
yarn install v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > react-text-truncate@0.12.0" has incorrect peer dependency "react@^15.4.1".
warning " > react-text-truncate@0.12.0" has incorrect peer dependency "react-dom@^15.4.1".
[4/4] Rebuilding all packages...
success Saved lockfile.
Done in 52.22s.
Compiling assets
[15:50:25] Using gulpfile ~/staging-sites/phpstan-08/gulpfile.js
[15:50:25] Starting 'build-production'...
[15:50:25] Starting 'scss'...
[15:50:25] Starting 'babel'...
[15:50:25] Starting 'browserify-production'...
[15:50:25] Finished 'build-production' after 64 ms
[15:50:26] Finished 'babel' after 1.53 s
[15:50:56] Finished 'browserify-production' after 31 s
[15:50:57] Finished 'scss' after 32 s
[15:50:57] Starting 'useref'...
[15:51:58] Finished 'useref' after 1 min
Updating composer permissions
Fixing Directories
Configuring secrets
Migrating
Nothing to do