Page MenuHomePhabricator

Replace magic numbers with constants in AuthManager
Open, Needs TriagePublic

Description

Can we replace the magic numbers being used in AuthManager with something more readable like constants?

	/**
	 * @param int $which Bitmask: 1 = pre, 2 = primary, 4 = secondary
	 * @param string $method
	 * @param array $args
	 */
	private function callMethodOnProviders( $which, $method, array $args ) {
		$providers = [];
		if ( $which & 1 ) {
			$providers += $this->getPreAuthenticationProviders();
		}
		if ( $which & 2 ) {
			$providers += $this->getPrimaryAuthenticationProviders();
		}
		if ( $which & 4 ) {
			$providers += $this->getSecondaryAuthenticationProviders();
		}
		foreach ( $providers as $provider ) {
			$provider->$method( ...$args );
		}
	}

And then it's called with

		$this->callMethodOnProviders( 6, 'providerChangeAuthenticationData', [ $req ] );