[pkg-php-pear] Bug#978334: php-finder-facade: FTBFS: Call to undefined method SebastianBergmann\Timer\Timer::resourceUsage()

Logan Rosen logan at ubuntu.com
Sun Apr 4 23:50:44 BST 2021


Control: tags -1 patch

Hi,

In Ubuntu, the attached patch was applied to achieve the following:

  * d/p/0009-Compatibility-with-php-timer-4.0.patch: Cherrypick upstream
    commit to fix compatibility with php-timer >= 4.0.

Thanks for considering the patch.

Logan
-------------- next part --------------
diff -Nru phpdox-0.12.0/debian/patches/0009-Compatibility-with-php-timer-4.0.patch phpdox-0.12.0/debian/patches/0009-Compatibility-with-php-timer-4.0.patch
--- phpdox-0.12.0/debian/patches/0009-Compatibility-with-php-timer-4.0.patch	1969-12-31 19:00:00.000000000 -0500
+++ phpdox-0.12.0/debian/patches/0009-Compatibility-with-php-timer-4.0.patch	2021-04-04 18:35:45.000000000 -0400
@@ -0,0 +1,54 @@
+From a71dfe4ffce072eb8402e5fd5303e6b3076ee0e7 Mon Sep 17 00:00:00 2001
+From: homerjsimpson000 <homerj.simpson000 at gmail.com>
+Date: Mon, 14 Dec 2020 09:13:14 +0100
+Subject: [PATCH] Update ShellProgressLogger.php
+
+Use ResourceUsageFormatter instead of Timer::resourceUsage to enable updating to use both Timer ^2.0 and Timer 5.0.*
+---
+ src/logger/ShellProgressLogger.php | 26 +++++++++++++++++++++++++-
+ 1 file changed, 25 insertions(+), 1 deletion(-)
+
+diff --git a/src/logger/ShellProgressLogger.php b/src/logger/ShellProgressLogger.php
+index 1017dda1..d76fdfd4 100644
+--- a/src/logger/ShellProgressLogger.php
++++ b/src/logger/ShellProgressLogger.php
+@@ -1,6 +1,7 @@
+ <?php declare(strict_types = 1);
+ namespace TheSeer\phpDox;
+ 
++use SebastianBergmann\Timer\ResourceUsageFormatter;
+ use SebastianBergmann\Timer\Timer;
+ 
+ /**
+@@ -88,7 +89,30 @@ public function log($msg): void {
+ 
+     public function buildSummary(): void {
+         print "\n\n";
+-        print Timer::resourceUsage();
++        print $this->resourceUsage();
+         print "\n\n";
+     }
++
++    /**
++     * @return string
++     */
++    private function resourceUsage(): string {
++        $result = '';
++
++        if(
++            class_exists(ResourceUsageFormatter::class) &&
++            method_exists(ResourceUsageFormatter::class, 'resourceUsageSinceStartOfRequest')
++        ) {
++            /** @var ResourceUsageFormatter $resource */
++            $resource = new ResourceUsageFormatter();
++            $result = $resource->resourceUsageSinceStartOfRequest();
++        } else if(
++            class_exists(Timer::class) &&
++            method_exists(Timer::class, 'resourceUsage')
++        ) {
++            $result = Timer::resourceUsage();
++        }
++
++        return $result;
++    }
+ }
diff -Nru phpdox-0.12.0/debian/patches/series phpdox-0.12.0/debian/patches/series
--- phpdox-0.12.0/debian/patches/series	2020-12-21 07:03:11.000000000 -0500
+++ phpdox-0.12.0/debian/patches/series	2021-04-04 18:35:45.000000000 -0400
@@ -6,3 +6,4 @@
 0006-Compatibility-with-recent-PHPUnit-8.patch
 0007-Drop-versioned-dependency-that-can-t-be-satisfied.patch
 0008-Adapt-to-recent-version-of-PHPUnit-9.patch
+0009-Compatibility-with-php-timer-4.0.patch


More information about the pkg-php-pear mailing list