The new StreamAware
interface may conflict with version 2.0 StreamAware
abstract class.
The Formatter
character sequences constants will soon be removed, in favor of the ASCII
class constants
- Use
ASCII::CR
instead ofFormatter::CR
- Use
ASCII::LF
instead ofFormatter::LF
- Use
ASCII::CRLF
instead ofFormatter::CRLF
- Use
ASCII::TAB
instead ofFormatter::TAB
- Use
ASCII::STAB
instead ofFormatter::STAB
- Use
Application::PAD
instead ofFormatter::PAD
The whole stream handling methods have been rehomed in IOHelper
- The
StreamAware
super class have been removed - The stream pseudo-properties are now handled by the trait's
__get()
method
To implement a proper __get()
method in a class which uses the trait, one will have to import IOHelper::__get()
as an alias.
class Acme
{
use IOHelper {
__get as __stream_get;
}
// Implement proper magic getter
public function __get($name)
{
// Put user-defined logic here
if ($name == 'foo') {
return 'bar';
}
// ...
// Call the trait method then
return $this->__stream_get($name);
}
}
StreamAwareTrait
have been removed, in favor of IOHelper
StreamAwareTrait::ioread()
is replaced byIOHelper::read()
StreamAwareTrait::iowrite()
is replaced byIOHelper::write()
StreamAwareTrait::ioerror()
is replaced byIOHelper::error()
- Use
error()
instead oferrorln()
- Use
write()
instead ofwriteln()
- Use
Registry::get()
ifIOHelper
stream properties are available - Use
new PosixFormatter()
otherwise (eg. when in a static context)
- Now formatters are stored in an application-wide
FormatterRegistry
- The formatter is picked by output methods at each call, allowing for a better context detection (pipe, reg file, tty...)
- Use
Verbosity::get()
instead ofCommand::getVerbosity()
- Use
Verbosity::set()
instead ofCommand::setVerbosity()