[TYPO3-core] Creating aliases with the "use" operator

Steffen Müller typo3 at t3node.com
Fri Oct 12 21:24:01 CEST 2012


Hi.

Using namespaces in core is nice, but sometimes makes the code hard to read.

For example in Logging API we make use of \TYPO3\CMS\Core\Log a lot of
times, e.g.

public function debug($message, array $data = array()) {
  return $this->log(\TYPO3\CMS\Core\Log\LogLevel::DEBUG, $message, $data);
}

I'd suggest to make us of aliasing:

namespace TYPO3\CMS\Core\Log;

use \TYPO3\CMS\Core\Log as Log;

class Logger {

	public function debug($message, array $data = array()) {
		return $this->log(Log\LogLevel::DEBUG, $message, $data);
	}
}

What do you think?


-- 
cheers,
Steffen

TYPO3 Blog: http://www.t3node.com/
Twitter: @t3node - http://twitter.com/t3node


More information about the TYPO3-team-core mailing list