Page MenuHomePhabricator

Upgrade phpstan level to 9
Open, Needs TriagePublic

Description

Following repositories already have phpstan level 9:

Lernings:

  • Always strictly type functions, variables, arrays
  • Whenever possible use scalar type instead of mixed
  • If possible, do not make your function return null, take care of the null value then and there
  • string[] and array<int, string> are different! (string[] has consecutive keys, it's a list, while array<int, string> can have arbitrary keys)
  • If you encounter any code smell, please create a ticket to take care of it in the future
  • You should use assertTrue() instead of assertSame() when expecting true
  • You should use assertCount() instead of assertSame() when comparing count of something
  • If you don't want json_encode() to return null, give it a second argument JSON_THROW_ON_ERROR
  • To make sure a string is non-empty use assertNotEmpty() function in tests.

Event Timeline