diff -Nru php-psr-log-1.1.4/composer.json php-psr-log-3.0.0/composer.json --- php-psr-log-1.1.4/composer.json 2021-05-03 11:20:27.000000000 +0000 +++ php-psr-log-3.0.0/composer.json 2021-07-14 16:46:02.000000000 +0000 @@ -11,16 +11,16 @@ } ], "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.x-dev" } } } diff -Nru php-psr-log-1.1.4/debian/changelog php-psr-log-3.0.0/debian/changelog --- php-psr-log-1.1.4/debian/changelog 2022-01-27 15:52:12.000000000 +0000 +++ php-psr-log-3.0.0/debian/changelog 2021-07-18 16:24:57.000000000 +0000 @@ -1,11 +1,25 @@ -php-psr-log (1.1.4-2) unstable; urgency=medium +php-psr-log (3.0.0-1) experimental; urgency=medium - * Upload to unstable since Bullseye has been released - * Track version 1 for now (Bookworm?) - * Mark package as Multi-Arch: foreign - * Update standards version to 4.6.0, no changes needed. + [ Larry Garfield ] + * Add return types. - -- David Prévot Thu, 27 Jan 2022 11:52:12 -0400 + -- David Prévot Sun, 18 Jul 2021 18:24:57 +0200 + +php-psr-log (2.0.0-1) experimental; urgency=medium + + [ Larry Garfield ] + * Remove outdated test files. + * Require PHP 8.0 for Stringable support. + * Add parameter types. + * Add property type. + * Fold AbstractLogger and LoggerTrait together. + * Switch to standard PSR-4 directory structure. + + [ David Prévot ] + * Drop patch not needed anymore + * Adapt packaging to PSR-4 directory structure + + -- David Prévot Sun, 18 Jul 2021 17:35:51 +0200 php-psr-log (1.1.4-1) experimental; urgency=medium diff -Nru php-psr-log-1.1.4/debian/clean php-psr-log-3.0.0/debian/clean --- php-psr-log-1.1.4/debian/clean 2022-01-27 15:42:33.000000000 +0000 +++ php-psr-log-3.0.0/debian/clean 2021-07-18 15:31:35.000000000 +0000 @@ -1 +1 @@ -Psr/Log/autoload.php +src/autoload.php diff -Nru php-psr-log-1.1.4/debian/control php-psr-log-3.0.0/debian/control --- php-psr-log-1.1.4/debian/control 2022-01-27 15:47:00.000000000 +0000 +++ php-psr-log-3.0.0/debian/control 2021-07-18 15:33:23.000000000 +0000 @@ -5,15 +5,14 @@ Uploaders: François-Régis Vuillemin , David Prévot Build-Depends: debhelper-compat (= 13), dh-sequence-phpcomposer, phpab -Standards-Version: 4.6.0 +Standards-Version: 4.5.1 Homepage: https://www.php-fig.org/psr/psr-3/ -Vcs-Git: https://salsa.debian.org/php-team/pear/php-psr-log.git -b debian/bookworm +Vcs-Git: https://salsa.debian.org/php-team/pear/php-psr-log.git -b debian/latest Vcs-Browser: https://salsa.debian.org/php-team/pear/php-psr-log Rules-Requires-Root: no Package: php-psr-log Architecture: all -Multi-Arch: foreign Depends: ${misc:Depends}, ${phpcomposer:Debian-require} Suggests: ${phpcomposer:Debian-suggest} Description: common interface for logging libraries diff -Nru php-psr-log-1.1.4/debian/gbp.conf php-psr-log-3.0.0/debian/gbp.conf --- php-psr-log-1.1.4/debian/gbp.conf 2022-01-27 15:44:23.000000000 +0000 +++ php-psr-log-3.0.0/debian/gbp.conf 2021-05-07 10:08:36.000000000 +0000 @@ -1,5 +1,4 @@ [DEFAULT] -debian-branch = debian/bookworm +debian-branch = debian/latest pristine-tar = True -upstream-branch = upstream-bookworm upstream-vcs-tag = %(version%~%-)s diff -Nru php-psr-log-1.1.4/debian/install php-psr-log-3.0.0/debian/install --- php-psr-log-1.1.4/debian/install 2022-01-27 15:42:33.000000000 +0000 +++ php-psr-log-3.0.0/debian/install 2021-07-18 15:32:08.000000000 +0000 @@ -1 +1 @@ -Psr usr/share/php +src/* usr/share/php/Psr/Log diff -Nru php-psr-log-1.1.4/debian/patches/0001-Adapt-to-recent-version-of-PHPUnit-9.patch php-psr-log-3.0.0/debian/patches/0001-Adapt-to-recent-version-of-PHPUnit-9.patch --- php-psr-log-1.1.4/debian/patches/0001-Adapt-to-recent-version-of-PHPUnit-9.patch 2022-01-27 15:48:38.000000000 +0000 +++ php-psr-log-3.0.0/debian/patches/0001-Adapt-to-recent-version-of-PHPUnit-9.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -From: =?utf-8?q?David_Pr=C3=A9vot?= -Date: Sat, 26 Dec 2020 10:45:44 -0400 -Subject: Adapt to recent version of PHPUnit (9) - ---- - Psr/Log/Test/LoggerInterfaceTest.php | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/Psr/Log/Test/LoggerInterfaceTest.php b/Psr/Log/Test/LoggerInterfaceTest.php -index e1e5354..36e15b5 100644 ---- a/Psr/Log/Test/LoggerInterfaceTest.php -+++ b/Psr/Log/Test/LoggerInterfaceTest.php -@@ -65,11 +65,9 @@ abstract class LoggerInterfaceTest extends TestCase - ); - } - -- /** -- * @expectedException \Psr\Log\InvalidArgumentException -- */ - public function testThrowsOnInvalidLevel() - { -+ $this->expectException('\Psr\Log\InvalidArgumentException'); - $logger = $this->getLogger(); - $logger->log('invalid level', 'Foo'); - } diff -Nru php-psr-log-1.1.4/debian/patches/series php-psr-log-3.0.0/debian/patches/series --- php-psr-log-1.1.4/debian/patches/series 2022-01-27 15:48:38.000000000 +0000 +++ php-psr-log-3.0.0/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -0001-Adapt-to-recent-version-of-PHPUnit-9.patch diff -Nru php-psr-log-1.1.4/debian/rules php-psr-log-3.0.0/debian/rules --- php-psr-log-1.1.4/debian/rules 2022-01-27 15:42:33.000000000 +0000 +++ php-psr-log-3.0.0/debian/rules 2021-07-18 15:32:25.000000000 +0000 @@ -3,7 +3,7 @@ dh $@ override_dh_auto_build: - phpab --output Psr/Log/autoload.php Psr/Log + phpab --output src/autoload.php src override_dh_installchangelogs: dh_installchangelogs debian/upstream/changelog diff -Nru php-psr-log-1.1.4/debian/watch php-psr-log-3.0.0/debian/watch --- php-psr-log-1.1.4/debian/watch 2022-01-27 15:44:08.000000000 +0000 +++ php-psr-log-3.0.0/debian/watch 2021-05-07 10:08:36.000000000 +0000 @@ -1,4 +1,4 @@ version=4 opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/php-psr-log_$1\.tar\.gz/ \ https://github.com/php-fig/log/tags \ -.*/(1\S*)\.tar\.gz +.*/(\d\S*)\.tar\.gz diff -Nru php-psr-log-1.1.4/Psr/Log/AbstractLogger.php php-psr-log-3.0.0/Psr/Log/AbstractLogger.php --- php-psr-log-1.1.4/Psr/Log/AbstractLogger.php 2021-05-03 11:20:27.000000000 +0000 +++ php-psr-log-3.0.0/Psr/Log/AbstractLogger.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,128 +0,0 @@ -log(LogLevel::EMERGENCY, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function alert($message, array $context = array()) - { - $this->log(LogLevel::ALERT, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function critical($message, array $context = array()) - { - $this->log(LogLevel::CRITICAL, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function error($message, array $context = array()) - { - $this->log(LogLevel::ERROR, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function warning($message, array $context = array()) - { - $this->log(LogLevel::WARNING, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function notice($message, array $context = array()) - { - $this->log(LogLevel::NOTICE, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function info($message, array $context = array()) - { - $this->log(LogLevel::INFO, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function debug($message, array $context = array()) - { - $this->log(LogLevel::DEBUG, $message, $context); - } -} diff -Nru php-psr-log-1.1.4/Psr/Log/InvalidArgumentException.php php-psr-log-3.0.0/Psr/Log/InvalidArgumentException.php --- php-psr-log-1.1.4/Psr/Log/InvalidArgumentException.php 2021-05-03 11:20:27.000000000 +0000 +++ php-psr-log-3.0.0/Psr/Log/InvalidArgumentException.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -logger = $logger; - } -} diff -Nru php-psr-log-1.1.4/Psr/Log/LoggerInterface.php php-psr-log-3.0.0/Psr/Log/LoggerInterface.php --- php-psr-log-1.1.4/Psr/Log/LoggerInterface.php 2021-05-03 11:20:27.000000000 +0000 +++ php-psr-log-3.0.0/Psr/Log/LoggerInterface.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,125 +0,0 @@ -log(LogLevel::EMERGENCY, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function alert($message, array $context = array()) - { - $this->log(LogLevel::ALERT, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function critical($message, array $context = array()) - { - $this->log(LogLevel::CRITICAL, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function error($message, array $context = array()) - { - $this->log(LogLevel::ERROR, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function warning($message, array $context = array()) - { - $this->log(LogLevel::WARNING, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function notice($message, array $context = array()) - { - $this->log(LogLevel::NOTICE, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function info($message, array $context = array()) - { - $this->log(LogLevel::INFO, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function debug($message, array $context = array()) - { - $this->log(LogLevel::DEBUG, $message, $context); - } - - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string $message - * @param array $context - * - * @return void - * - * @throws \Psr\Log\InvalidArgumentException - */ - abstract public function log($level, $message, array $context = array()); -} diff -Nru php-psr-log-1.1.4/Psr/Log/LogLevel.php php-psr-log-3.0.0/Psr/Log/LogLevel.php --- php-psr-log-1.1.4/Psr/Log/LogLevel.php 2021-05-03 11:20:27.000000000 +0000 +++ php-psr-log-3.0.0/Psr/Log/LogLevel.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -logger) { }` - * blocks. - */ -class NullLogger extends AbstractLogger -{ - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string $message - * @param array $context - * - * @return void - * - * @throws \Psr\Log\InvalidArgumentException - */ - public function log($level, $message, array $context = array()) - { - // noop - } -} diff -Nru php-psr-log-1.1.4/Psr/Log/Test/DummyTest.php php-psr-log-3.0.0/Psr/Log/Test/DummyTest.php --- php-psr-log-1.1.4/Psr/Log/Test/DummyTest.php 2021-05-03 11:20:27.000000000 +0000 +++ php-psr-log-3.0.0/Psr/Log/Test/DummyTest.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ - ". - * - * Example ->error('Foo') would yield "error Foo". - * - * @return string[] - */ - abstract public function getLogs(); - - public function testImplements() - { - $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger()); - } - - /** - * @dataProvider provideLevelsAndMessages - */ - public function testLogsAtAllLevels($level, $message) - { - $logger = $this->getLogger(); - $logger->{$level}($message, array('user' => 'Bob')); - $logger->log($level, $message, array('user' => 'Bob')); - - $expected = array( - $level.' message of level '.$level.' with context: Bob', - $level.' message of level '.$level.' with context: Bob', - ); - $this->assertEquals($expected, $this->getLogs()); - } - - public function provideLevelsAndMessages() - { - return array( - LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), - LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), - LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), - LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), - LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), - LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), - LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), - LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), - ); - } - - /** - * @expectedException \Psr\Log\InvalidArgumentException - */ - public function testThrowsOnInvalidLevel() - { - $logger = $this->getLogger(); - $logger->log('invalid level', 'Foo'); - } - - public function testContextReplacement() - { - $logger = $this->getLogger(); - $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); - - $expected = array('info {Message {nothing} Bob Bar a}'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testObjectCastToString() - { - if (method_exists($this, 'createPartialMock')) { - $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString')); - } else { - $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString')); - } - $dummy->expects($this->once()) - ->method('__toString') - ->will($this->returnValue('DUMMY')); - - $this->getLogger()->warning($dummy); - - $expected = array('warning DUMMY'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testContextCanContainAnything() - { - $closed = fopen('php://memory', 'r'); - fclose($closed); - - $context = array( - 'bool' => true, - 'null' => null, - 'string' => 'Foo', - 'int' => 0, - 'float' => 0.5, - 'nested' => array('with object' => new DummyTest), - 'object' => new \DateTime, - 'resource' => fopen('php://memory', 'r'), - 'closed' => $closed, - ); - - $this->getLogger()->warning('Crazy context data', $context); - - $expected = array('warning Crazy context data'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testContextExceptionKeyCanBeExceptionOrOtherValues() - { - $logger = $this->getLogger(); - $logger->warning('Random message', array('exception' => 'oops')); - $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); - - $expected = array( - 'warning Random message', - 'critical Uncaught Exception!' - ); - $this->assertEquals($expected, $this->getLogs()); - } -} diff -Nru php-psr-log-1.1.4/Psr/Log/Test/TestLogger.php php-psr-log-3.0.0/Psr/Log/Test/TestLogger.php --- php-psr-log-1.1.4/Psr/Log/Test/TestLogger.php 2021-05-03 11:20:27.000000000 +0000 +++ php-psr-log-3.0.0/Psr/Log/Test/TestLogger.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,147 +0,0 @@ - $level, - 'message' => $message, - 'context' => $context, - ]; - - $this->recordsByLevel[$record['level']][] = $record; - $this->records[] = $record; - } - - public function hasRecords($level) - { - return isset($this->recordsByLevel[$level]); - } - - public function hasRecord($record, $level) - { - if (is_string($record)) { - $record = ['message' => $record]; - } - return $this->hasRecordThatPasses(function ($rec) use ($record) { - if ($rec['message'] !== $record['message']) { - return false; - } - if (isset($record['context']) && $rec['context'] !== $record['context']) { - return false; - } - return true; - }, $level); - } - - public function hasRecordThatContains($message, $level) - { - return $this->hasRecordThatPasses(function ($rec) use ($message) { - return strpos($rec['message'], $message) !== false; - }, $level); - } - - public function hasRecordThatMatches($regex, $level) - { - return $this->hasRecordThatPasses(function ($rec) use ($regex) { - return preg_match($regex, $rec['message']) > 0; - }, $level); - } - - public function hasRecordThatPasses(callable $predicate, $level) - { - if (!isset($this->recordsByLevel[$level])) { - return false; - } - foreach ($this->recordsByLevel[$level] as $i => $rec) { - if (call_user_func($predicate, $rec, $i)) { - return true; - } - } - return false; - } - - public function __call($method, $args) - { - if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { - $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; - $level = strtolower($matches[2]); - if (method_exists($this, $genericMethod)) { - $args[] = $level; - return call_user_func_array([$this, $genericMethod], $args); - } - } - throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); - } - - public function reset() - { - $this->records = []; - $this->recordsByLevel = []; - } -} diff -Nru php-psr-log-1.1.4/src/AbstractLogger.php php-psr-log-3.0.0/src/AbstractLogger.php --- php-psr-log-1.1.4/src/AbstractLogger.php 1970-01-01 00:00:00.000000000 +0000 +++ php-psr-log-3.0.0/src/AbstractLogger.php 2021-07-14 16:46:02.000000000 +0000 @@ -0,0 +1,15 @@ +logger = $logger; + } +} diff -Nru php-psr-log-1.1.4/src/LoggerInterface.php php-psr-log-3.0.0/src/LoggerInterface.php --- php-psr-log-1.1.4/src/LoggerInterface.php 1970-01-01 00:00:00.000000000 +0000 +++ php-psr-log-3.0.0/src/LoggerInterface.php 2021-07-14 16:46:02.000000000 +0000 @@ -0,0 +1,125 @@ +log(LogLevel::EMERGENCY, $message, $context); + } + + /** + * Action must be taken immediately. + * + * Example: Entire website down, database unavailable, etc. This should + * trigger the SMS alerts and wake you up. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function alert(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::ALERT, $message, $context); + } + + /** + * Critical conditions. + * + * Example: Application component unavailable, unexpected exception. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function critical(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::CRITICAL, $message, $context); + } + + /** + * Runtime errors that do not require immediate action but should typically + * be logged and monitored. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function error(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::ERROR, $message, $context); + } + + /** + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function warning(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::WARNING, $message, $context); + } + + /** + * Normal but significant events. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function notice(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::NOTICE, $message, $context); + } + + /** + * Interesting events. + * + * Example: User logs in, SQL logs. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function info(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::INFO, $message, $context); + } + + /** + * Detailed debug information. + * + * @param string|\Stringable $message + * @param array $context + * + * @return void + */ + public function debug(string|\Stringable $message, array $context = []): void + { + $this->log(LogLevel::DEBUG, $message, $context); + } + + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string|\Stringable $message + * @param array $context + * + * @return void + * + * @throws \Psr\Log\InvalidArgumentException + */ + abstract public function log($level, string|\Stringable $message, array $context = []): void; +} diff -Nru php-psr-log-1.1.4/src/LogLevel.php php-psr-log-3.0.0/src/LogLevel.php --- php-psr-log-1.1.4/src/LogLevel.php 1970-01-01 00:00:00.000000000 +0000 +++ php-psr-log-3.0.0/src/LogLevel.php 2021-07-14 16:46:02.000000000 +0000 @@ -0,0 +1,18 @@ +logger) { }` + * blocks. + */ +class NullLogger extends AbstractLogger +{ + /** + * Logs with an arbitrary level. + * + * @param mixed $level + * @param string|\Stringable $message + * @param array $context + * + * @return void + * + * @throws \Psr\Log\InvalidArgumentException + */ + public function log($level, string|\Stringable $message, array $context = []): void + { + // noop + } +}