From 77272698fe3f71cdd40d2ad2a5134d6cb8719e78 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 28 Aug 2024 10:53:46 +0545 Subject: [PATCH 1/2] chore: adjust code to make php-cs-fixer and phpstan pass --- bin/bench.php | 2 +- bin/bench_freebusygenerator.php | 6 +++--- bin/bench_manipulatevcard.php | 4 ++-- bin/rrulebench.php | 4 ++-- composer.json | 4 ++-- tests/VObject/ITip/BrokerDeleteEventTest.php | 10 ++++++---- 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/bin/bench.php b/bin/bench.php index 0a2736fa6..98994d1b6 100755 --- a/bin/bench.php +++ b/bin/bench.php @@ -7,6 +7,6 @@ $start = microtime(true); -$lol = Sabre\VObject\Reader::read($data); +$lol = VObject\Reader::read($data); echo 'time: '.(microtime(true) - $start)."\n"; diff --git a/bin/bench_freebusygenerator.php b/bin/bench_freebusygenerator.php index ae859f487..bc2210532 100644 --- a/bin/bench_freebusygenerator.php +++ b/bin/bench_freebusygenerator.php @@ -3,7 +3,7 @@ include __DIR__.'/../vendor/autoload.php'; if ($argc < 2) { - echo 'sabre/vobject ', Sabre\VObject\Version::VERSION, " freebusy benchmark\n"; + echo 'sabre/vobject ', VObject\Version::VERSION, " freebusy benchmark\n"; echo "\n"; echo "This script can be used to measure the speed of generating a\n"; echo "free-busy report based on a calendar.\n"; @@ -19,7 +19,7 @@ $bench = new Hoa\Bench\Bench(); $bench->parse->start(); -$vcal = Sabre\VObject\Reader::read(fopen($inputFile, 'r')); +$vcal = VObject\Reader::read(fopen($inputFile, 'r')); $bench->parse->stop(); @@ -31,7 +31,7 @@ $bench->fb->start(); for ($i = 0; $i < $repeat; ++$i) { - $fb = new Sabre\VObject\FreeBusyGenerator($start, $end, $vcal, $timeZone); + $fb = new VObject\FreeBusyGenerator($start, $end, $vcal, $timeZone); $results = $fb->getResult(); } $bench->fb->stop(); diff --git a/bin/bench_manipulatevcard.php b/bin/bench_manipulatevcard.php index 96a506907..790912023 100644 --- a/bin/bench_manipulatevcard.php +++ b/bin/bench_manipulatevcard.php @@ -3,7 +3,7 @@ include __DIR__.'/../vendor/autoload.php'; if ($argc < 2) { - echo 'sabre/vobject ', Sabre\VObject\Version::VERSION, " manipulation benchmark\n"; + echo 'sabre/vobject ', VObject\Version::VERSION, " manipulation benchmark\n"; echo "\n"; echo "This script can be used to measure the speed of opening a large amount of\n"; echo "vcards, making a few alterations and serializing them again.\n"; @@ -17,7 +17,7 @@ $input = file_get_contents($inputFile); -$splitter = new Sabre\VObject\Splitter\VCard($input); +$splitter = new VObject\Splitter\VCard($input); $bench = new Hoa\Bench\Bench(); diff --git a/bin/rrulebench.php b/bin/rrulebench.php index c8be08d46..bb31053b8 100644 --- a/bin/rrulebench.php +++ b/bin/rrulebench.php @@ -3,7 +3,7 @@ include __DIR__.'/../vendor/autoload.php'; if ($argc < 4) { - echo 'sabre/vobject ', Sabre\VObject\Version::VERSION, " RRULE benchmark\n"; + echo 'sabre/vobject ', VObject\Version::VERSION, " RRULE benchmark\n"; echo "\n"; echo "This script can be used to measure the speed of the 'recurrence expansion'\n"; echo 'system.'; @@ -18,7 +18,7 @@ $bench->parse->start(); echo "Parsing.\n"; -$vobj = Sabre\VObject\Reader::read(fopen($inputFile, 'r')); +$vobj = VObject\Reader::read(fopen($inputFile, 'r')); $bench->parse->stop(); diff --git a/composer.json b/composer.json index 0040076bc..4e1aa271a 100644 --- a/composer.json +++ b/composer.json @@ -38,10 +38,10 @@ "sabre/xml" : "^3.0 || ^4.0" }, "require-dev" : { - "friendsofphp/php-cs-fixer": "^3.54", + "friendsofphp/php-cs-fixer": "^3.63", "phpunit/phpunit" : "^9.6", "phpunit/php-invoker" : "^2.0 || ^3.1", - "phpstan/phpstan": "^1.11" + "phpstan/phpstan": "^1.12" }, "suggest" : { "hoa/bench" : "If you would like to run the benchmark scripts" diff --git a/tests/VObject/ITip/BrokerDeleteEventTest.php b/tests/VObject/ITip/BrokerDeleteEventTest.php index 4de219f82..81f2b7cac 100644 --- a/tests/VObject/ITip/BrokerDeleteEventTest.php +++ b/tests/VObject/ITip/BrokerDeleteEventTest.php @@ -2,6 +2,8 @@ namespace Sabre\VObject\ITip; +use Sabre\VObject\Version; + class BrokerDeleteEventTest extends BrokerTester { public function testOrganizerDeleteWithDtend(): void @@ -24,7 +26,7 @@ public function testOrganizerDeleteWithDtend(): void $newMessage = null; - $version = \Sabre\VObject\Version::VERSION; + $version = Version::VERSION; $expected = [ [ @@ -107,7 +109,7 @@ public function testOrganizerDeleteWithDuration(): void $newMessage = null; - $version = \Sabre\VObject\Version::VERSION; + $version = Version::VERSION; $expected = [ [ @@ -190,7 +192,7 @@ public function testAttendeeDeleteWithDtend(): void $newMessage = null; - $version = \Sabre\VObject\Version::VERSION; + $version = Version::VERSION; $expected = [ [ @@ -245,7 +247,7 @@ public function testAttendeeReplyWithDuration(): void $newMessage = null; - $version = \Sabre\VObject\Version::VERSION; + $version = Version::VERSION; $expected = [ [ From e1cc24614bc026f5c8d7a7bf3da63a5d42a2b168 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Wed, 28 Aug 2024 15:03:36 +0545 Subject: [PATCH 2/2] Use php-cs-fixer 3.62.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4e1aa271a..f2c378d63 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "sabre/xml" : "^3.0 || ^4.0" }, "require-dev" : { - "friendsofphp/php-cs-fixer": "^3.63", + "friendsofphp/php-cs-fixer": "3.62.0", "phpunit/phpunit" : "^9.6", "phpunit/php-invoker" : "^2.0 || ^3.1", "phpstan/phpstan": "^1.12"