Let User::idFromName always return int or null
authorWMDE-Fisch <christoph.jauera@wikimedia.de>
Tue, 30 Apr 2019 14:22:48 +0000 (16:22 +0200)
committerWMDE-Fisch <christoph.jauera@wikimedia.de>
Tue, 30 Apr 2019 14:45:59 +0000 (16:45 +0200)
commita91638bd387a320fb68e31f7bc0757a8c417c057
treee49fd4256c5cfe79be58ef24a5133723e7d970e0
parentf79ad343f7170eecc7673fcaf32fc9229469808c
Let User::idFromName always return int or null

This patch makes sure, that idFromName always returns either an int
or null value. The $idCacheByName can contain string values so we cast
the values if necessary.

An alternative could have been to make sure that just int values go
into the cache. But since the cache is public the current approach
to seems to be better atm.

Change-Id: I3085d89b93db2b888c190ba193623b86dc93759a
includes/user/User.php
tests/phpunit/includes/user/UserTest.php