From 5a27dfb0930bff286d6b2c501a67d29f27ef1c48 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Sat, 1 May 2021 22:48:00 +0000 Subject: [PATCH 01/14] Resolved all unit test refactoring errors and failures --- src/DateFactory.php | 72 +-- src/DateFactoryInterface.php | 5 +- src/DateTimeFactory.php | 112 ++--- src/DateTimeFactoryInterface.php | 29 +- src/DateTimeImmutableFactory.php | 72 +++ src/DateTimeZoneFactory.php | 94 ++++ src/DateTimeZoneFactoryInterface.php | 34 ++ .../DateTimeZoneFactoryException.php | 13 + test/unit/DateFactoryTest.php | 450 +++--------------- test/unit/DateTimeFactoryTest.php | 186 ++------ test/unit/DateTimeZoneFactoryTest.php | 150 ++++++ 11 files changed, 569 insertions(+), 648 deletions(-) create mode 100755 src/DateTimeImmutableFactory.php create mode 100755 src/DateTimeZoneFactory.php create mode 100755 src/DateTimeZoneFactoryInterface.php create mode 100755 src/Exception/DateTimeZoneFactoryException.php create mode 100755 test/unit/DateTimeZoneFactoryTest.php diff --git a/src/DateFactory.php b/src/DateFactory.php index cf2e21f..c79d0eb 100755 --- a/src/DateFactory.php +++ b/src/DateFactory.php @@ -4,9 +4,9 @@ namespace Arp\DateTime; -use Arp\DateTime\Exception\DateFactoryException; use Arp\DateTime\Exception\DateIntervalFactoryException; use Arp\DateTime\Exception\DateTimeFactoryException; +use Arp\DateTime\Exception\DateTimeZoneFactoryException; /** * @author Alex Patterson @@ -19,20 +19,30 @@ final class DateFactory implements DateFactoryInterface */ private DateTimeFactoryInterface $dateTimeFactory; + /** + * @var DateTimeZoneFactoryInterface + */ + private DateTimeZoneFactoryInterface $dateTimeZoneFactory; + /** * @var DateIntervalFactoryInterface */ private DateIntervalFactoryInterface $dateIntervalFactory; /** - * @param DateTimeFactoryInterface $dateTimeFactory + * @param DateTimeFactoryInterface|null $dateTimeFactory + * @param DateTimeZoneFactoryInterface|null $dateTimeZoneFactory * @param DateIntervalFactoryInterface|null $dateIntervalFactory + * + * @throws DateTimeFactoryException */ public function __construct( - DateTimeFactoryInterface $dateTimeFactory, - DateIntervalFactoryInterface $dateIntervalFactory = null + ?DateTimeFactoryInterface $dateTimeFactory = null, + ?DateTimeZoneFactoryInterface $dateTimeZoneFactory = null, + ?DateIntervalFactoryInterface $dateIntervalFactory = null ) { - $this->dateTimeFactory = $dateTimeFactory ?? new DateTimeFactory(); + $this->dateTimeZoneFactory = $dateTimeZoneFactory ?? new DateTimeZoneFactory(); + $this->dateTimeFactory = $dateTimeFactory ?? new DateTimeFactory($this->dateTimeZoneFactory); $this->dateIntervalFactory = $dateIntervalFactory ?? new DateIntervalFactory(); } @@ -42,15 +52,11 @@ public function __construct( * * @return \DateTimeInterface * - * @throws DateFactoryException + * @throws DateTimeFactoryException */ public function createDateTime(?string $spec = null, $timeZone = null): \DateTimeInterface { - try { - return $this->dateTimeFactory->createDateTime($spec, $timeZone); - } catch (DateTimeFactoryException $e) { - throw new DateFactoryException($e->getMessage(), $e->getCode(), $e); - } + return $this->dateTimeFactory->createDateTime($spec, $timeZone); } /** @@ -60,15 +66,11 @@ public function createDateTime(?string $spec = null, $timeZone = null): \DateTim * * @return \DateTimeInterface * - * @throws DateFactoryException + * @throws DateTimeFactoryException */ public function createFromFormat(string $spec, string $format, $timeZone = null): \DateTimeInterface { - try { - return $this->dateTimeFactory->createFromFormat($spec, $format, $timeZone); - } catch (DateTimeFactoryException $e) { - throw new DateFactoryException($e->getMessage(), $e->getCode(), $e); - } + return $this->dateTimeFactory->createFromFormat($spec, $format, $timeZone); } /** @@ -76,15 +78,23 @@ public function createFromFormat(string $spec, string $format, $timeZone = null) * * @return \DateTimeZone * - * @throws DateFactoryException + * @throws DateTimeZoneFactoryException */ public function createDateTimeZone(string $spec): \DateTimeZone { - try { - return $this->dateTimeFactory->createDateTimeZone($spec); - } catch (DateTimeFactoryException $e) { - throw new DateFactoryException($e->getMessage(), $e->getCode(), $e); - } + return $this->dateTimeZoneFactory->createDateTimeZone($spec); + } + + /** + * @param \DateTimeZone|string|null $timeZone + * + * @return \DateTimeZone|null + * + * @throws DateTimeZoneFactoryException + */ + public function resolveDateTimeZone($timeZone): ?\DateTimeZone + { + return $this->dateTimeZoneFactory->resolveDateTimeZone($timeZone); } /** @@ -92,15 +102,11 @@ public function createDateTimeZone(string $spec): \DateTimeZone * * @return \DateInterval * - * @throws DateFactoryException + * @throws DateIntervalFactoryException */ public function createDateInterval(string $spec): \DateInterval { - try { - return $this->dateIntervalFactory->createDateInterval($spec); - } catch (DateIntervalFactoryException $e) { - throw new DateFactoryException($e->getMessage(), $e->getCode(), $e); - } + return $this->dateIntervalFactory->createDateInterval($spec); } /** @@ -110,14 +116,10 @@ public function createDateInterval(string $spec): \DateInterval * * @return \DateInterval * - * @throws DateFactoryException + * @throws DateIntervalFactoryException */ public function diff(\DateTimeInterface $origin, \DateTimeInterface $target, bool $absolute = false): \DateInterval { - try { - return $this->dateIntervalFactory->diff($origin, $target, $absolute); - } catch (DateIntervalFactoryException $e) { - throw new DateFactoryException($e->getMessage(), $e->getCode(), $e); - } + return $this->dateIntervalFactory->diff($origin, $target, $absolute); } } diff --git a/src/DateFactoryInterface.php b/src/DateFactoryInterface.php index bc39d17..77dd942 100755 --- a/src/DateFactoryInterface.php +++ b/src/DateFactoryInterface.php @@ -8,6 +8,9 @@ * @author Alex Patterson * @package Arp\DateTime */ -interface DateFactoryInterface extends DateTimeFactoryInterface, DateIntervalFactoryInterface +interface DateFactoryInterface extends + DateTimeFactoryInterface, + DateTimeZoneFactoryInterface, + DateIntervalFactoryInterface { } diff --git a/src/DateTimeFactory.php b/src/DateTimeFactory.php index 2d57dec..4ef8d68 100755 --- a/src/DateTimeFactory.php +++ b/src/DateTimeFactory.php @@ -5,6 +5,7 @@ namespace Arp\DateTime; use Arp\DateTime\Exception\DateTimeFactoryException; +use Arp\DateTime\Exception\DateTimeZoneFactoryException; /** * @author Alex Patterson @@ -13,49 +14,38 @@ final class DateTimeFactory implements DateTimeFactoryInterface { /** - * @var string + * @var DateTimeZoneFactoryInterface */ - private string $dateTimeClassName; + private DateTimeZoneFactoryInterface $dateTimeZoneFactory; /** * @var string */ - private string $dateTimeZoneClassName; + private string $dateTimeClassName; /** - * @param string|null $dateTimeClassName - * @param string|null $dateTimeZoneClassName + * @param DateTimeZoneFactoryInterface|null $dateTimeZoneFactory + * @param string|null $dateTimeClassName * * @throws DateTimeFactoryException */ - public function __construct(string $dateTimeClassName = null, string $dateTimeZoneClassName = null) - { + public function __construct( + DateTimeZoneFactoryInterface $dateTimeZoneFactory = null, + string $dateTimeClassName = null + ) { + $this->dateTimeZoneFactory = $dateTimeZoneFactory ?? new DateTimeZoneFactory(); + $dateTimeClassName ??= \DateTime::class; if (!is_a($dateTimeClassName, \DateTimeInterface::class, true)) { throw new DateTimeFactoryException( sprintf( - 'The \'dateTimeClassName\' must the fully qualified class name' - . ' of a class that implements \'%s\'; \'%s\' provided', - \DateTimeInterface::class, - $dateTimeClassName - ) - ); - } - - $dateTimeZoneClassName ??= \DateTimeZone::class; - if (!is_a($dateTimeZoneClassName, \DateTimeZone::class, true)) { - throw new DateTimeFactoryException( - sprintf( - 'The \'dateTimeZoneClassName\' must the fully qualified class name' - . ' of a class that implements \'%s\'; \'%s\' provided', - \DateTimeZone::class, - $dateTimeZoneClassName + 'The \'dateTimeClassName\' parameter must be a class name that implements \'%s\'', + \DateTimeInterface::class ) ); } $this->dateTimeClassName = $dateTimeClassName; - $this->dateTimeZoneClassName = $dateTimeZoneClassName; } /** @@ -69,8 +59,11 @@ public function __construct(string $dateTimeClassName = null, string $dateTimeZo public function createDateTime(?string $spec = null, $timeZone = null): \DateTimeInterface { try { - return (new $this->dateTimeClassName($spec ?? 'now', $this->resolveDateTimeZone($timeZone))); - } catch (\Throwable $e) { + return new $this->dateTimeClassName( + $spec ?? 'now', + $this->dateTimeZoneFactory->resolveDateTimeZone($timeZone) + ); + } catch (\Exception $e) { throw new DateTimeFactoryException( sprintf( 'Failed to create a valid \DateTime instance using \'%s\': %s', @@ -90,43 +83,24 @@ public function createDateTime(?string $spec = null, $timeZone = null): \DateTim * * @return \DateTimeInterface * - * @throws DateTimeFactoryException If the \DateTime instance cannot be created. + * @throws DateTimeFactoryException If the \DateTime instance cannot be created */ public function createFromFormat(string $spec, string $format, $timeZone = null): \DateTimeInterface { /** @var callable $factory */ $factory = [$this->dateTimeClassName, 'createFromFormat']; - $dateTime = $factory($format, $spec, $this->resolveDateTimeZone($timeZone)); - - if (false === $dateTime || !$dateTime instanceof \DateTimeInterface) { - throw new DateTimeFactoryException( - sprintf( - 'Failed to create a valid \DateTime instance using \'%s\' and format \'%s\'', - $spec, - $format - ) - ); - } - - return $dateTime; - } - - /** - * @param string $spec The date time zone specification - * - * @return \DateTimeZone - * - * @throws DateTimeFactoryException If the \DateTimeZone cannot be created - */ - public function createDateTimeZone(string $spec): \DateTimeZone - { try { - return (new $this->dateTimeZoneClassName($spec)); - } catch (\Throwable $e) { + $dateTime = $factory( + $format, + $spec, + $this->dateTimeZoneFactory->resolveDateTimeZone($timeZone) + ); + } catch (\Exception $e) { throw new DateTimeFactoryException( sprintf( - 'Failed to create a valid \DateTimeZone instance using \'%s\': %s', + 'Failed to create a valid \DateTime instance from format \'%s\' using \'%s\': %s', + $format, $spec, $e->getMessage() ), @@ -134,37 +108,17 @@ public function createDateTimeZone(string $spec): \DateTimeZone $e ); } - } - - /** - * @param string|null|\DateTimeZone $timeZone - * - * @return \DateTimeZone|null - * - * @throws DateTimeFactoryException - */ - private function resolveDateTimeZone($timeZone): ?\DateTimeZone - { - if (null === $timeZone || empty($timeZone)) { - return null; - } - - if (is_string($timeZone)) { - $timeZone = $this->createDateTimeZone($timeZone); - } - if (!$timeZone instanceof \DateTimeZone) { + if (false === $dateTime || !$dateTime instanceof \DateTimeInterface) { throw new DateTimeFactoryException( sprintf( - 'The \'timeZone\' argument must be a \'string\'' - . 'or an object of type \'%s\'; \'%s\' provided in \'%s\'', - \DateTimeZone::class, - get_class($timeZone), - __FUNCTION__ + 'Failed to create a valid \DateTime instance using \'%s\' and format \'%s\'', + $spec, + $format ) ); } - return $timeZone; + return $dateTime; } } diff --git a/src/DateTimeFactoryInterface.php b/src/DateTimeFactoryInterface.php index 6a9bb68..600e7a2 100755 --- a/src/DateTimeFactoryInterface.php +++ b/src/DateTimeFactoryInterface.php @@ -13,38 +13,27 @@ interface DateTimeFactoryInterface { /** - * Create a new \DateTime instance using the provided specification. + * Create a new \DateTimeInterface instance using the provided specification * - * @param null|string $spec The date and time specification. - * @param string|\DateTimeZone|null $timeZone The date time zone. If omitted or null the PHP default will be used. + * @param null|string $spec The date and time specification + * @param string|\DateTimeZone|null $timeZone The date time zone. If omitted or null the PHP default will be used * * @return \DateTimeInterface * - * @throws DateTimeFactoryException If the \DateTime instance cannot be created. + * @throws DateTimeFactoryException If the \DateTimeInterface instance cannot be created */ public function createDateTime(?string $spec = null, $timeZone = null): \DateTimeInterface; /** - * Create a new \DateTime instance using the provided format. + * Create a new \DateTimeInterface instance using the provided format * - * @param string $spec The date and time specification. - * @param string $format The date and time format. - * @param string|\DateTimeZone|null $timeZone The date time zone. If omitted or null the PHP default will be used. + * @param string $spec The date and time specification + * @param string $format The date and time format + * @param string|\DateTimeZone|null $timeZone The date time zone. If omitted or null the PHP default will be used * * @return \DateTimeInterface * - * @throws DateTimeFactoryException If the \DateTime instance cannot be created. + * @throws DateTimeFactoryException If the \DateTimeInterface instance cannot be created */ public function createFromFormat(string $spec, string $format, $timeZone = null): \DateTimeInterface; - - /** - * Create a new \DateTimeZone instance using the provided specification. - * - * @param string $spec The date time zone specification. - * - * @return \DateTimeZone - * - * @throws DateTimeFactoryException If the \DateTimeZone cannot be created. - */ - public function createDateTimeZone(string $spec): \DateTimeZone; } diff --git a/src/DateTimeImmutableFactory.php b/src/DateTimeImmutableFactory.php new file mode 100755 index 0000000..d3658ea --- /dev/null +++ b/src/DateTimeImmutableFactory.php @@ -0,0 +1,72 @@ + + * @package Arp\DateTime + */ +final class DateTimeImmutableFactory implements DateTimeFactoryInterface +{ + /** + * @var DateTimeFactory + */ + private DateTimeFactory $dateTimeFactory; + + /** + * @param string|null $dateTimeClassName + * @param DateTimeZoneFactoryInterface|null $dateTimeZoneFactory + * + * @throws DateTimeFactoryException + */ + public function __construct( + ?string $dateTimeClassName = null, + ?DateTimeZoneFactoryInterface $dateTimeZoneFactory = null + ) { + $dateTimeClassName ??= \DateTimeImmutable::class; + if (!is_a($dateTimeClassName, \DateTimeImmutable::class, true)) { + throw new DateTimeFactoryException( + sprintf( + 'The \'dateTimeClassName\' parameter must be a class name that implements \'%s\'', + \DateTimeImmutable::class + ) + ); + } + + $dateTimeZoneFactory ??= new DateTimeZoneFactory(); + $this->dateTimeFactory = new DateTimeFactory($dateTimeZoneFactory, $dateTimeClassName); + } + + /** + * @param string|null $spec + * @param null|string|\DateTimeZone $timeZone + * + * @return \DateTimeImmutable&\DateTimeInterface + * + * @throws DateTimeFactoryException + */ + public function createDateTime(?string $spec = null, $timeZone = null): \DateTimeInterface + { + /** @phpstan-ignore-next-line */ + return $this->dateTimeFactory->createDateTime($spec, $timeZone); + } + + /** + * @param string $spec + * @param string $format + * @param null|string|\DateTimeZone $timeZone + * + * @return \DateTimeImmutable&\DateTimeInterface + * + * @throws DateTimeFactoryException + */ + public function createFromFormat(string $spec, string $format, $timeZone = null): \DateTimeInterface + { + /** @phpstan-ignore-next-line */ + return $this->dateTimeFactory->createDateTime($spec, $timeZone); + } +} diff --git a/src/DateTimeZoneFactory.php b/src/DateTimeZoneFactory.php new file mode 100755 index 0000000..05097a5 --- /dev/null +++ b/src/DateTimeZoneFactory.php @@ -0,0 +1,94 @@ + + * @package Arp\DateTime + */ +final class DateTimeZoneFactory implements DateTimeZoneFactoryInterface +{ + /** + * @var string + */ + private string $dateTimeZoneClassName; + + /** + * @param string|null $dateTimeZoneClassName + * + * @throws DateTimeZoneFactoryException + */ + public function __construct(string $dateTimeZoneClassName = null) + { + $dateTimeZoneClassName ??= \DateTimeZone::class; + if (!is_a($dateTimeZoneClassName, \DateTimeZone::class, true)) { + throw new DateTimeZoneFactoryException( + sprintf( + 'The \'dateTimeZoneClassName\' parameter must be a class name that implements \'%s\'', + \DateTimeZone::class + ) + ); + } + $this->dateTimeZoneClassName = $dateTimeZoneClassName; + } + + /** + * @param string $spec The date time zone specification + * + * @return \DateTimeZone + * + * @throws DateTimeZoneFactoryException If the \DateTimeZone cannot be created + */ + public function createDateTimeZone(string $spec): \DateTimeZone + { + try { + return new $this->dateTimeZoneClassName($spec); + } catch (\Exception $e) { + throw new DateTimeZoneFactoryException( + sprintf( + 'Failed to create a valid \DateTimeZone instance using \'%s\': %s', + $spec, + $e->getMessage() + ), + $e->getCode(), + $e + ); + } + } + + /** + * @param string|null|\DateTimeZone $timeZone + * + * @return \DateTimeZone|null + * + * @throws DateTimeZoneFactoryException + */ + public function resolveDateTimeZone($timeZone): ?\DateTimeZone + { + if (null === $timeZone || empty($timeZone)) { + return null; + } + + if (is_string($timeZone)) { + $timeZone = $this->createDateTimeZone($timeZone); + } + + if (!$timeZone instanceof \DateTimeZone) { + throw new DateTimeZoneFactoryException( + sprintf( + 'The \'timeZone\' argument must be a \'string\'' + . 'or an object of type \'%s\'; \'%s\' provided in \'%s\'', + \DateTimeZone::class, + get_class($timeZone), + __FUNCTION__ + ) + ); + } + + return $timeZone; + } +} diff --git a/src/DateTimeZoneFactoryInterface.php b/src/DateTimeZoneFactoryInterface.php new file mode 100755 index 0000000..4520571 --- /dev/null +++ b/src/DateTimeZoneFactoryInterface.php @@ -0,0 +1,34 @@ + + * @package Arp\DateTime + */ +interface DateTimeZoneFactoryInterface +{ + /** + * Create a new \DateTimeZone instance using the provided specification. + * + * @param string $spec The date time zone specification. + * + * @return \DateTimeZone + * + * @throws DateTimeZoneFactoryException If the \DateTimeZone cannot be created. + */ + public function createDateTimeZone(string $spec): \DateTimeZone; + + /** + * @param string|null|\DateTimeZone $timeZone + * + * @return \DateTimeZone|null + * + * @throws DateTimeZoneFactoryException + */ + public function resolveDateTimeZone($timeZone): ?\DateTimeZone; +} diff --git a/src/Exception/DateTimeZoneFactoryException.php b/src/Exception/DateTimeZoneFactoryException.php new file mode 100755 index 0000000..58839c6 --- /dev/null +++ b/src/Exception/DateTimeZoneFactoryException.php @@ -0,0 +1,13 @@ + + * @package Arp\DateTime\Exception + */ +final class DateTimeZoneFactoryException extends DateTimeException +{ +} diff --git a/test/unit/DateFactoryTest.php b/test/unit/DateFactoryTest.php index 5c72ad1..92938fb 100755 --- a/test/unit/DateFactoryTest.php +++ b/test/unit/DateFactoryTest.php @@ -8,9 +8,10 @@ use Arp\DateTime\DateFactoryInterface; use Arp\DateTime\DateIntervalFactoryInterface; use Arp\DateTime\DateTimeFactoryInterface; -use Arp\DateTime\Exception\DateFactoryException; +use Arp\DateTime\DateTimeZoneFactoryInterface; use Arp\DateTime\Exception\DateIntervalFactoryException; use Arp\DateTime\Exception\DateTimeFactoryException; +use Arp\DateTime\Exception\DateTimeZoneFactoryException; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -27,6 +28,11 @@ final class DateFactoryTest extends TestCase */ private $dateTimeFactory; + /** + * @var DateTimeZoneFactoryInterface&MockObject + */ + private $dateTimeZoneFactory; + /** * @var DateIntervalFactoryInterface&MockObject */ @@ -38,456 +44,152 @@ final class DateFactoryTest extends TestCase public function setUp(): void { $this->dateTimeFactory = $this->createMock(DateTimeFactoryInterface::class); - + $this->dateTimeZoneFactory = $this->createMock(DateTimeZoneFactoryInterface::class); $this->dateIntervalFactory = $this->createMock(DateIntervalFactoryInterface::class); } /** * Ensure that the factory implements DateFactoryInterface + * + * @throws DateTimeFactoryException */ public function testImplementsDateFactoryInterface(): void { - $factory = new DateFactory($this->dateTimeFactory, $this->dateIntervalFactory); + $factory = new DateFactory($this->dateTimeFactory, $this->dateTimeZoneFactory, $this->dateIntervalFactory); $this->assertInstanceOf(DateFactoryInterface::class, $factory); } /** - * Assert that if the \DateTime instance cannot be created a DateTimeFactoryException will be thrown - * - * @throws DateFactoryException - */ - public function testCreateDateTimeWillThrowDateFactoryExceptionIfNotAbleToCreateADateTime(): void - { - $spec = 'foo'; - $timeZone = null; - $exceptionMessage = sprintf('Failed to create a valid \DateTime instance using \'%s\'', $spec); - - $dateTimeFactory = $this->createMockForCreateDateTime($exceptionMessage); - - $factory = new DateFactory($dateTimeFactory, $this->dateIntervalFactory); - - $this->expectException(DateFactoryException::class); - $this->expectExceptionMessage($exceptionMessage); - - $factory->createDateTime($spec, $timeZone); - } - - /** - * Ensure that calls to createDateTime() will return the valid configured \DateTime instance - * - * @param string|null $spec The date and time specification - * @param \DateTimeZone|string|null $timeZone The optional date time zone to test - * - * @dataProvider getCreateDateTimeData + * Assert the calls to createDateTime() will proxy to the internal DateTimeFactory * - * @throws DateFactoryException + * @throws DateTimeFactoryException * @throws \Exception */ - public function testCreateDateTime(?string $spec, $timeZone = null): void + public function testCreateDateTimeWillProxyToDateTimeFactory(): void { - $factory = new DateFactory($this->dateTimeFactory, $this->dateIntervalFactory); + $factory = new DateFactory($this->dateTimeFactory, $this->dateTimeZoneFactory, $this->dateIntervalFactory); - /** @var \DateTimeInterface $expectedDateTime */ - $expectedDateTime = new \DateTime( - $spec ?? 'now', - is_string($timeZone) ? new \DateTimeZone($timeZone) : $timeZone - ); + $spec = '2021-05-01 23:29:33'; + $timeZone = new \DateTimeZone('UTC'); + + $dateTime = new \DateTime($spec, $timeZone); $this->dateTimeFactory->expects($this->once()) ->method('createDateTime') ->with($spec, $timeZone) - ->willReturn($expectedDateTime); - - $dateTime = $factory->createDateTime($spec, $timeZone); + ->willReturn($dateTime); - $this->assertSame($expectedDateTime, $dateTime); + $this->assertSame($dateTime, $factory->createDateTime($spec, $timeZone)); } /** - * @return array[] - */ - public function getCreateDateTimeData(): array - { - return [ - [ - null, - ], - [ - 'now', - ], - [ - 'now', - 'Europe/London', - ], - [ - '2019-05-14 12:33:00', - ], - [ - '2019-08-14 17:34:55', - 'UTC', - ], - [ - '2020-08-22 14:43:12', - null, - ], - [ - '2020-08-22 14:44:37', - new \DateTimeZone('Europe/London'), - ], - [ - '2000-01-01', - 'Pacific/Nauru', - ], - [ - 'now', - new \DateTimeZone('America/New_York'), - ], - ]; - } - - /** - * Assert that if the \DateTime instance cannot be created a DateTimeFactoryException will be thrown - * - * @param string $spec - * @param string $format - * @param null|string|\DateTimeZone $timeZone - * - * @dataProvider getCreateFromFormatWillThrowDateFactoryExceptionIfNotAbleToCreateADateTimeData + * Assert the calls to createFromFormat() will proxy to the internal DateTimeFactory * - * @throws DateFactoryException + * @throws DateTimeFactoryException */ - public function testCreateFromFormatWillThrowDateFactoryExceptionIfNotAbleToCreateADateTime( - string $spec, - string $format, - $timeZone = null - ): void { - $exceptionMessage = sprintf( - 'Failed to create a valid \DateTime instance using \'%s\' and format \'%s\'', - $spec, - $format - ); - - // Note that DateTimeInterface cannot be mocked by PHPUnit, so we can manually create a stub - $dateTimeFactory = $this->createMockForCreateFromFormat($exceptionMessage); - - $factory = new DateFactory($dateTimeFactory, $this->dateIntervalFactory); - - $this->expectException(DateFactoryException::class); - $this->expectExceptionMessage($exceptionMessage); - - $factory->createFromFormat($spec, $format, $timeZone); - } - - /** - * @return array[] - */ - public function getCreateFromFormatWillThrowDateFactoryExceptionIfNotAbleToCreateADateTimeData(): array + public function testCreateFromFormatWillProxyToDateTimeFactory(): void { - return [ - [ - 'foo', - 'xyz', - ], - ]; - } + $factory = new DateFactory($this->dateTimeFactory, $this->dateTimeZoneFactory, $this->dateIntervalFactory); - /** - * Assert that if providing an invalid $spec to createDateTimeZone() a DateFactoryException is thrown - * - * @param string $spec - * - * @dataProvider getCreateDateTimeZoneWillThrowDateFactoryExceptionIfSpecIsInvalidData - * - * @throws DateFactoryException - */ - public function testCreateDateTimeZoneWillThrowDateFactoryExceptionIfSpecIsInvalid(string $spec): void - { - $factory = new DateFactory($this->dateTimeFactory, $this->dateIntervalFactory); + $spec = '2021-05-01 23:29:33'; + $format = 'Y-m-d H:i:s'; + $timeZone = new \DateTimeZone('UTC'); - $exceptionCode = 456; - $exceptionMessage = 'This is a test exception message'; - $exception = new DateTimeFactoryException($exceptionMessage, $exceptionCode); + $dateTime = \DateTime::createFromFormat($format, $spec, $timeZone); $this->dateTimeFactory->expects($this->once()) - ->method('createDateTimeZone') - ->with($spec) - ->willThrowException($exception); + ->method('createFromFormat') + ->with($spec, $format, $timeZone) + ->willReturn($dateTime); - $this->expectException(DateFactoryException::class); - $this->expectExceptionMessage($exceptionMessage); - $this->expectExceptionCode($exceptionCode); - - $factory->createDateTimeZone($spec); - } - - /** - * @return array[] - */ - public function getCreateDateTimeZoneWillThrowDateFactoryExceptionIfSpecIsInvalidData(): array - { - return [ - [ - 'foo', - ], - [ - '123', - ], - ]; + $this->assertSame($dateTime, $factory->createFromFormat($spec, $format, $timeZone)); } /** - * @param string $spec + * Assert the calls to createDateTimeZone() will proxy to the internal DateTimeZoneFactory * - * @dataProvider getCreateDateTimeZoneData - * - * @throws DateFactoryException + * @throws DateTimeZoneFactoryException + * @throws DateTimeFactoryException */ - public function testCreateDateTimeZone(string $spec): void + public function testCreateDateTimeZoneWillProxyToDateTimeZoneFactory(): void { - $factory = new DateFactory($this->dateTimeFactory, $this->dateIntervalFactory); + $factory = new DateFactory($this->dateTimeFactory, $this->dateTimeZoneFactory, $this->dateIntervalFactory); - $dateTimeZone = new \DateTimeZone($spec); + $spec = 'UTC'; + $timeZone = new \DateTimeZone($spec); - $this->dateTimeFactory->expects($this->once()) + $this->dateTimeZoneFactory->expects($this->once()) ->method('createDateTimeZone') ->with($spec) - ->willReturn($dateTimeZone); + ->willReturn($timeZone); - $this->assertSame($dateTimeZone, $factory->createDateTimeZone($spec)); + $this->assertSame($timeZone, $factory->createDateTimeZone($spec)); } /** - * @return array[] - */ - public function getCreateDateTimeZoneData(): array - { - return [ - [ - 'UTC', - ], - [ - 'Europe/London', - ], - [ - 'Europe/Amsterdam', - ], - [ - 'Europe/Rome', - ], - [ - 'Atlantic/Bermuda', - ], - [ - 'Atlantic/Azores', - ], - [ - 'Antarctica/DumontDUrville', - ], - ]; - } - - /** - * Assert that calls to creatDateInterval() will return the expected DateInterval instance - * - * @param string $spec + * Assert the calls to resolveDateTimeZone() will proxy to the internal DateTimeZoneFactory * - * @dataProvider getCreateDateIntervalWillReturnANewDateIntervalToSpecData - * - * @throws DateFactoryException + * @throws DateTimeZoneFactoryException + * @throws DateTimeFactoryException */ - public function testCreateDateIntervalWillReturnANewDateIntervalToSpec(string $spec): void + public function testResolveDateTimeZoneWillProxyToDateTimeZoneFactory(): void { - $factory = new DateFactory($this->dateTimeFactory, $this->dateIntervalFactory); - - /** @var \DateInterval|MockObject $dateInterval */ - $dateInterval = $this->createMock(\DateInterval::class); + $factory = new DateFactory($this->dateTimeFactory, $this->dateTimeZoneFactory, $this->dateIntervalFactory); - $this->dateIntervalFactory->expects($this->once()) - ->method('createDateInterval') - ->willReturn($dateInterval); + $spec = 'UTC'; + $timeZone = new \DateTimeZone($spec); - $this->assertSame($dateInterval, $factory->createDateInterval($spec)); - } + $this->dateTimeZoneFactory->expects($this->once()) + ->method('resolveDateTimeZone') + ->with($spec) + ->willReturn($timeZone); - /** - * @return array[] - */ - public function getCreateDateIntervalWillReturnANewDateIntervalToSpecData(): array - { - return [ - ['P100D'], - ['P4Y1DT9H11M3S'], - ['P2Y4DT6H8M'], - ['P7Y8M'], - ]; + $this->assertSame($timeZone, $factory->resolveDateTimeZone($spec)); } /** - * Assert that an invalid $spec passed to createDateInterval() will raise a DateTimeFactoryException + * Assert the calls to createDateInterval() will proxy to the internal DateTimeIntervalFactory * - * @throws DateFactoryException + * @throws DateIntervalFactoryException + * @throws DateTimeFactoryException */ - public function testDateIntervalWillThrowDateTimeFactoryExceptionIfUnableToCreateADateInterval(): void + public function testCreateDateIntervalWillProxyToDateTimeIntervalFactory(): void { - $spec = 'Hello'; + $factory = new DateFactory($this->dateTimeFactory, $this->dateTimeZoneFactory, $this->dateIntervalFactory); - $factory = new DateFactory($this->dateTimeFactory, $this->dateIntervalFactory); - - $exceptionCode = 123; - $exceptionMessage = 'This is a test exception message'; - $exception = new DateIntervalFactoryException($exceptionMessage, $exceptionCode); + $spec = 'P1D'; + $dateInterval = new \DateInterval('P1D'); $this->dateIntervalFactory->expects($this->once()) ->method('createDateInterval') - ->willThrowException($exception); - - $this->expectDeprecationMessage(DateTimeFactoryException::class); - $this->expectExceptionMessage($exceptionMessage); - $this->expectExceptionCode($exceptionCode); - - $factory->createDateInterval($spec); - } - - /** - * Assert that the calls to diff will return a valid DateInterval - * - * @param \DateTime $origin - * @param \DateTime $target - * @param bool $absolute - * - * @dataProvider getDiffWillReturnDateIntervalData - * - * @throws DateFactoryException - */ - public function testDiffWillReturnDateInterval(\DateTime $origin, \DateTime $target, bool $absolute = false): void - { - $dateInterval = $origin->diff($target); - - $factory = new DateFactory($this->dateTimeFactory, $this->dateIntervalFactory); - - $this->dateIntervalFactory->expects($this->once()) - ->method('diff') - ->with($origin, $target, $absolute) + ->with($spec) ->willReturn($dateInterval); - $this->assertSame($dateInterval, $factory->diff($origin, $target, $absolute)); - } - - /** - * @return array[] - */ - public function getDiffWillReturnDateIntervalData(): array - { - return [ - [ - new \DateTime('1984-01-01'), - new \DateTime('2020-01-01'), - ], - [ - new \DateTime('2017-08-12'), - new \DateTime('2019-01-19'), - true, - ], - [ - new \DateTime('2020-01-01 13:33:47'), - new \DateTime('2020-08-30 01:25:33'), - false, - ], - ]; + $this->assertSame($dateInterval, $factory->createDateInterval($spec)); } /** - * Assert that a DateTimeFactoryException is thrown when unable to diff the provided dates + * Assert the calls to diff() will proxy to the internal DateTimeIntervalFactory * - * @throws DateFactoryException + * @throws DateIntervalFactoryException + * @throws DateTimeFactoryException */ - public function testDateTimeFactoryExceptionWillBeThrownIfDiffFails(): void + public function testDiffWillProxyToDateTimeIntervalFactory(): void { - $factory = new DateFactory($this->dateTimeFactory, $this->dateIntervalFactory); + $factory = new DateFactory($this->dateTimeFactory, $this->dateTimeZoneFactory, $this->dateIntervalFactory); - $origin = new \DateTime(); - $target = new \DateTime(); + $origin = new \DateTime('2021-01-01'); + $target = new \DateTime('2021-01-10 13:14:15'); + $absolute = false; - $exceptionCode = 123; - $exceptionMessage = 'This is a test exception message'; - $exception = new DateIntervalFactoryException($exceptionMessage, $exceptionCode); + $dateDiff = $origin->diff($target, $absolute); $this->dateIntervalFactory->expects($this->once()) ->method('diff') - ->with($origin, $target, false) - ->willThrowException($exception); - - $this->expectException(DateFactoryException::class); - $this->expectExceptionMessage($exceptionMessage); - $this->expectExceptionCode($exceptionCode); - - $factory->diff($origin, $target); - } - - /** - * @param string $exceptionMessage - * - * @return DateTimeFactoryInterface - */ - private function createMockForCreateDateTime(string $exceptionMessage): DateTimeFactoryInterface - { - return new class ($exceptionMessage) implements DateTimeFactoryInterface { - private string $exceptionMessage; - - public function __construct(string $exceptionMessage) - { - $this->exceptionMessage = $exceptionMessage; - } - - public function createFromFormat(string $spec, string $format, $timeZone = null): \DateTimeInterface - { - /** @phpstan-ignore-next-line */ - return \DateTime::createFromFormat($spec, $format); - } - - public function createDateTimeZone(string $spec): \DateTimeZone - { - return new \DateTimeZone($spec); - } - - public function createDateTime(string $spec = null, $timeZone = null): \DateTimeInterface - { - throw new DateTimeFactoryException($this->exceptionMessage); - } - }; - } + ->with($origin, $target, $absolute) + ->willReturn($dateDiff); - /** - * @param string $exceptionMessage - * - * @return DateTimeFactoryInterface - */ - private function createMockForCreateFromFormat(string $exceptionMessage): DateTimeFactoryInterface - { - return new class ($exceptionMessage) implements DateTimeFactoryInterface { - private string $exceptionMessage; - - public function __construct(string $exceptionMessage) - { - $this->exceptionMessage = $exceptionMessage; - } - - public function createFromFormat(string $spec, string $format, $timeZone = null): \DateTimeInterface - { - throw new DateTimeFactoryException($this->exceptionMessage); - } - - public function createDateTimeZone(string $spec): \DateTimeZone - { - return new \DateTimeZone($spec); - } - - public function createDateTime(string $spec = null, $timeZone = null): \DateTimeInterface - { - /** @phpstan-ignore-next-line */ - return new \DateTime($spec, $timeZone); - } - }; + $this->assertSame($dateDiff, $factory->diff($origin, $target, $absolute)); } } diff --git a/test/unit/DateTimeFactoryTest.php b/test/unit/DateTimeFactoryTest.php index ea33e68..abaa59a 100755 --- a/test/unit/DateTimeFactoryTest.php +++ b/test/unit/DateTimeFactoryTest.php @@ -6,7 +6,10 @@ use Arp\DateTime\DateTimeFactory; use Arp\DateTime\DateTimeFactoryInterface; +use Arp\DateTime\DateTimeZoneFactoryInterface; use Arp\DateTime\Exception\DateTimeFactoryException; +use Arp\DateTime\Exception\DateTimeZoneFactoryException; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -17,6 +20,19 @@ */ final class DateTimeFactoryTest extends TestCase { + /** + * @var DateTimeZoneFactoryInterface&MockObject + */ + private $dateTimeZoneFactory; + + /** + * Prepare the test case dependencies + */ + public function setUp(): void + { + $this->dateTimeZoneFactory = $this->createMock(DateTimeZoneFactoryInterface::class); + } + /** * Ensure that the factory implements DateTimeFactoryInterface */ @@ -40,37 +56,12 @@ public function testDateTimeFactoryExceptionIsThrownWhenProvidingInvalidDateTime $this->expectException(DateTimeFactoryException::class); $this->expectExceptionMessage( sprintf( - 'The \'dateTimeClassName\' must the fully qualified class name' - . ' of a class that implements \'%s\'; \'%s\' provided', - \DateTimeInterface::class, - $dateTimeClassName - ) - ); - - new DateTimeFactory($dateTimeClassName); - } - - /** - * Assert that a DateTimeFactoryException is thrown if trying to create the class without a valid - * $dateTimeZoneClassName constructor argument - * - * @throws DateTimeFactoryException - */ - public function testDateTimeFactoryExceptionIsThrownWhenProvidingInvalidDateTimeZoneClassName(): void - { - $dateTimeZoneClassName = \stdClass::class; - - $this->expectException(DateTimeFactoryException::class); - $this->expectExceptionMessage( - sprintf( - 'The \'dateTimeZoneClassName\' must the fully qualified class name' - . ' of a class that implements \'%s\'; \'%s\' provided', - \DateTimeZone::class, - $dateTimeZoneClassName + 'The \'dateTimeClassName\' parameter must be a class name that implements \'%s\'', + \DateTimeInterface::class ) ); - new DateTimeFactory(null, $dateTimeZoneClassName); + new DateTimeFactory($this->dateTimeZoneFactory, $dateTimeClassName); } /** @@ -146,7 +137,7 @@ public function getCreateDateTimeData(): array */ public function testCreateDateTimeWillThrowDateTimeFactoryExceptionForInvalidDateTimeSpec(): void { - $factory = new DateTimeFactory(); + $factory = new DateTimeFactory($this->dateTimeZoneFactory); $spec = 'foo'; // invalid argument @@ -185,7 +176,7 @@ public function testCreateFromFormatWillThrowDateTimeFactoryExceptionForInvalidD string $format, $timeZone = null ): void { - $factory = new DateTimeFactory(); + $factory = new DateTimeFactory($this->dateTimeZoneFactory); $this->expectException(DateTimeFactoryException::class); $this->expectExceptionMessage( @@ -220,21 +211,29 @@ public function getCreateFromFormatWillThrowDateTimeFactoryExceptionForInvalidDa */ public function testCreateDateTimeWillThrowDateTimeFactoryExceptionForInvalidDateTimeZone(): void { - $factory = new DateTimeFactory(); + $factory = new DateTimeFactory($this->dateTimeZoneFactory); $spec = 'now'; $timeZone = new \stdClass(); - $errorMessage = sprintf( - 'The \'timeZone\' argument must be a \'string\'' - . 'or an object of type \'%s\'; \'%s\' provided in \'%s\'', - \DateTimeZone::class, - get_class($timeZone), - 'resolveDateTimeZone' - ); + $exceptionMessage = 'This is a test exception'; + $exceptionCode = 123; + $exception = new DateTimeZoneFactoryException($exceptionMessage, $exceptionCode); + + $this->dateTimeZoneFactory->expects($this->once()) + ->method('resolveDateTimeZone') + ->with($timeZone) + ->willThrowException($exception); $this->expectException(DateTimeFactoryException::class); - $this->expectExceptionMessage($errorMessage); + $this->expectExceptionCode($exceptionCode); + $this->expectExceptionMessage( + sprintf( + 'Failed to create a valid \DateTime instance using \'%s\': %s', + $spec, + $exceptionMessage + ) + ); /** @phpstan-ignore-next-line */ $factory->createDateTime($spec, /** @scrutinizer ignore-type */ $timeZone); @@ -253,18 +252,23 @@ public function testCreateDateTimeWillThrowDateTimeFactoryExceptionForInvalidDat */ public function testCreateFromFormat(string $spec, string $format, $timeZone = null): void { - $factory = new DateTimeFactory(); + $factory = new DateTimeFactory($this->dateTimeZoneFactory); + + $dateTimeZone = is_string($timeZone) ? new \DateTimeZone($timeZone) : $timeZone; /** @var \DateTimeInterface $expectedDateTime */ $expectedDateTime = \DateTime::createFromFormat( $format, $spec ?? 'now', - is_string($timeZone) ? new \DateTimeZone($timeZone) : $timeZone + $dateTimeZone ); - $dateTime = $factory->createFromFormat($spec, $format, $timeZone); + $this->dateTimeZoneFactory->expects($this->once()) + ->method('resolveDateTimeZone') + ->with($timeZone) + ->willReturn($dateTimeZone); - $this->assertDateTime($expectedDateTime, $dateTime); + $this->assertDateTime($expectedDateTime, $factory->createFromFormat($spec, $format, $timeZone)); } /** @@ -296,102 +300,6 @@ public function getCreateFromFormatData(): array ]; } - /** - * Ensure a \DateTimeZone instance is returned according to the provided $spec and $options - * - * @param string $spec - * - * @dataProvider getCreateDateTimeZoneData - * - * @throws DateTimeFactoryException - */ - public function testCreateDateTimeZone(string $spec): void - { - $factory = new DateTimeFactory(); - - $dateTimeZone = $factory->createDateTimeZone($spec); - - $this->assertSame($spec, $dateTimeZone->getName()); - } - - /** - * @see https://www.php.net/manual/en/timezones.europe.php - * - * @return array - */ - public function getCreateDateTimeZoneData(): array - { - return [ - [ - 'UTC', - ], - [ - 'Europe/London', - ], - [ - 'Europe/Amsterdam', - ], - [ - 'Europe/Rome', - ], - [ - 'Atlantic/Bermuda', - ], - [ - 'Atlantic/Azores', - ], - [ - 'Antarctica/DumontDUrville', - ], - ]; - } - - /** - * Ensure that if providing an invalid $spec argument to createDateTimeZone() a new DateTimeFactoryException - * is thrown - * - * @param string $spec The invalid timezone specification - * - * @dataProvider getCreateDateTimeZoneWillThrowDateTimeFactoryExceptionIfSpecIsInvalidData - * - * @throws DateTimeFactoryException - */ - public function testCreateDateTimeZoneWillThrowDateTimeFactoryExceptionIfSpecIsInvalid(string $spec): void - { - $factory = new DateTimeFactory(); - - $exceptionMessage = sprintf('DateTimeZone::__construct(): Unknown or bad timezone (%s)', $spec); - - $this->expectException(DateTimeFactoryException::class); - $this->expectExceptionMessage( - sprintf( - 'Failed to create a valid \DateTimeZone instance using \'%s\': %s', - $spec, - $exceptionMessage - ) - ); - - $factory->createDateTimeZone($spec); - } - - /** - * @return array - */ - public function getCreateDateTimeZoneWillThrowDateTimeFactoryExceptionIfSpecIsInvalidData(): array - { - return [ - [ - 'skjdvbnksd', - ], - [ - '2345234', - ], - [ - 'Europe/MyEmpire', - ], - ]; - } - /** * @param \DateTimeInterface $expectedDateTime * @param \DateTimeInterface $dateTime diff --git a/test/unit/DateTimeZoneFactoryTest.php b/test/unit/DateTimeZoneFactoryTest.php new file mode 100755 index 0000000..eeafdad --- /dev/null +++ b/test/unit/DateTimeZoneFactoryTest.php @@ -0,0 +1,150 @@ + + * @package ArpTest\DateTime + */ +final class DateTimeZoneFactoryTest extends TestCase +{ + /** + * Assert the factory implement DateTimeZoneFactoryInterface + */ + public function testImplementsDateTimeZoneFactoryInterface(): void + { + $factory = new DateTimeZoneFactory(); + + $this->assertInstanceOf(DateTimeZoneFactoryInterface::class, $factory); + } + + /** + * Assert that a DateTimeZoneFactoryException is thrown if trying to create the class without a valid + * $dateTimeZoneClassName constructor argument + * + * @throws DateTimeZoneFactoryException + */ + public function testDateTimeZoneFactoryExceptionIsThrownWhenProvidingInvalidDateTimeZoneClassName(): void + { + $dateTimeZoneClassName = \stdClass::class; + + $this->expectException(DateTimeZoneFactoryException::class); + $this->expectExceptionMessage( + sprintf( + 'The \'dateTimeZoneClassName\' parameter must be a class name that implements \'%s\'', + \DateTimeZone::class + ) + ); + + new DateTimeZoneFactory($dateTimeZoneClassName); + } + + /** + * Assert that if providing an invalid $spec to createDateTimeZone() a DateTimeZoneFactoryException is thrown + * + * @param string $spec + * + * @dataProvider getCreateDateTimeZoneWillThrowDateTimeZoneFactoryExceptionIfSpecIsInvalidData + * + * @throws DateTimeZoneFactoryException + */ + public function testCreateDateTimeZoneWillThrowDateTimeZoneFactoryExceptionIfSpecIsInvalid(string $spec): void + { + $factory = new DateTimeZoneFactory(); + + $exceptionMessage = ''; + $exceptionCode = 123; + try { + new \DateTimeZone($spec); + } catch (\Exception $e) { + $exceptionMessage = $e->getMessage(); + $exceptionCode = $e->getCode(); + } + + $this->expectException(DateTimeZoneFactoryException::class); + $this->expectExceptionCode($exceptionCode); + $this->expectExceptionMessage( + sprintf( + 'Failed to create a valid \DateTimeZone instance using \'%s\': %s', + $spec, + $exceptionMessage + ) + ); + + $factory->createDateTimeZone($spec); + } + + /** + * @return array[] + */ + public function getCreateDateTimeZoneWillThrowDateTimeZoneFactoryExceptionIfSpecIsInvalidData(): array + { + return [ + [ + 'foo', + ], + [ + '123', + ], + ]; + } + + /** + * Ensure a \DateTimeZone instance is returned according to the provided $spec + * + * @param string $spec + * + * @dataProvider getCreateDateTimeZoneData + * + * @throws DateTimeZoneFactoryException + */ + public function testCreateDateTimeZone(string $spec): void + { + $factory = new DateTimeZoneFactory(); + + $dateTimeZone = $factory->createDateTimeZone($spec); + + $this->assertSame($spec, $dateTimeZone->getName()); + } + + /** + * @see https://www.php.net/manual/en/timezones.europe.php + * + * @return array + */ + public function getCreateDateTimeZoneData(): array + { + return [ + [ + 'UTC', + ], + [ + 'Europe/London', + ], + [ + 'Europe/Amsterdam', + ], + [ + 'Europe/Rome', + ], + [ + 'Atlantic/Bermuda', + ], + [ + 'Atlantic/Azores', + ], + [ + 'Antarctica/DumontDUrville', + ], + ]; + } +} From f29fac8617ef6985d8fc5bf693e9acf0d12a843f Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Sat, 1 May 2021 23:11:41 +0000 Subject: [PATCH 02/14] Moved resolveDateTimeZone() from DateTimeZoneFactory and added it as a private method to DateTimeFactory --- src/DateFactory.php | 12 ----- src/DateTimeFactory.php | 37 ++++++++++---- src/DateTimeZoneFactory.php | 32 ------------ src/DateTimeZoneFactoryInterface.php | 9 ---- test/unit/DateFactoryTest.php | 21 -------- test/unit/DateTimeFactoryTest.php | 76 ++++++++++++---------------- 6 files changed, 61 insertions(+), 126 deletions(-) diff --git a/src/DateFactory.php b/src/DateFactory.php index c79d0eb..20f635d 100755 --- a/src/DateFactory.php +++ b/src/DateFactory.php @@ -85,18 +85,6 @@ public function createDateTimeZone(string $spec): \DateTimeZone return $this->dateTimeZoneFactory->createDateTimeZone($spec); } - /** - * @param \DateTimeZone|string|null $timeZone - * - * @return \DateTimeZone|null - * - * @throws DateTimeZoneFactoryException - */ - public function resolveDateTimeZone($timeZone): ?\DateTimeZone - { - return $this->dateTimeZoneFactory->resolveDateTimeZone($timeZone); - } - /** * @param string $spec * diff --git a/src/DateTimeFactory.php b/src/DateTimeFactory.php index 4ef8d68..3a21895 100755 --- a/src/DateTimeFactory.php +++ b/src/DateTimeFactory.php @@ -59,10 +59,7 @@ public function __construct( public function createDateTime(?string $spec = null, $timeZone = null): \DateTimeInterface { try { - return new $this->dateTimeClassName( - $spec ?? 'now', - $this->dateTimeZoneFactory->resolveDateTimeZone($timeZone) - ); + return new $this->dateTimeClassName($spec ?? 'now', $this->resolveDateTimeZone($timeZone)); } catch (\Exception $e) { throw new DateTimeFactoryException( sprintf( @@ -91,11 +88,7 @@ public function createFromFormat(string $spec, string $format, $timeZone = null) $factory = [$this->dateTimeClassName, 'createFromFormat']; try { - $dateTime = $factory( - $format, - $spec, - $this->dateTimeZoneFactory->resolveDateTimeZone($timeZone) - ); + $dateTime = $factory($format, $spec, $this->resolveDateTimeZone($timeZone)); } catch (\Exception $e) { throw new DateTimeFactoryException( sprintf( @@ -121,4 +114,30 @@ public function createFromFormat(string $spec, string $format, $timeZone = null) return $dateTime; } + + /** + * @param mixed|string|\DateTimeZone|null $timeZone + * + * @return \DateTimeZone|null + * + * @throws DateTimeFactoryException + */ + private function resolveDateTimeZone($timeZone): ?\DateTimeZone + { + if (empty($timeZone) || (!is_string($timeZone) && !$timeZone instanceof \DateTimeZone)) { + return null; + } + + try { + return is_string($timeZone) + ? $this->dateTimeZoneFactory->createDateTimeZone($timeZone) + : $timeZone; + } catch (DateTimeZoneFactoryException $e) { + throw new DateTimeFactoryException( + sprintf('Failed to create date time zone: %s', $e->getMessage()), + $e->getCode(), + $e + ); + } + } } diff --git a/src/DateTimeZoneFactory.php b/src/DateTimeZoneFactory.php index 05097a5..c1ca28a 100755 --- a/src/DateTimeZoneFactory.php +++ b/src/DateTimeZoneFactory.php @@ -59,36 +59,4 @@ public function createDateTimeZone(string $spec): \DateTimeZone ); } } - - /** - * @param string|null|\DateTimeZone $timeZone - * - * @return \DateTimeZone|null - * - * @throws DateTimeZoneFactoryException - */ - public function resolveDateTimeZone($timeZone): ?\DateTimeZone - { - if (null === $timeZone || empty($timeZone)) { - return null; - } - - if (is_string($timeZone)) { - $timeZone = $this->createDateTimeZone($timeZone); - } - - if (!$timeZone instanceof \DateTimeZone) { - throw new DateTimeZoneFactoryException( - sprintf( - 'The \'timeZone\' argument must be a \'string\'' - . 'or an object of type \'%s\'; \'%s\' provided in \'%s\'', - \DateTimeZone::class, - get_class($timeZone), - __FUNCTION__ - ) - ); - } - - return $timeZone; - } } diff --git a/src/DateTimeZoneFactoryInterface.php b/src/DateTimeZoneFactoryInterface.php index 4520571..3a2f7c5 100755 --- a/src/DateTimeZoneFactoryInterface.php +++ b/src/DateTimeZoneFactoryInterface.php @@ -22,13 +22,4 @@ interface DateTimeZoneFactoryInterface * @throws DateTimeZoneFactoryException If the \DateTimeZone cannot be created. */ public function createDateTimeZone(string $spec): \DateTimeZone; - - /** - * @param string|null|\DateTimeZone $timeZone - * - * @return \DateTimeZone|null - * - * @throws DateTimeZoneFactoryException - */ - public function resolveDateTimeZone($timeZone): ?\DateTimeZone; } diff --git a/test/unit/DateFactoryTest.php b/test/unit/DateFactoryTest.php index 92938fb..0889abc 100755 --- a/test/unit/DateFactoryTest.php +++ b/test/unit/DateFactoryTest.php @@ -127,27 +127,6 @@ public function testCreateDateTimeZoneWillProxyToDateTimeZoneFactory(): void $this->assertSame($timeZone, $factory->createDateTimeZone($spec)); } - /** - * Assert the calls to resolveDateTimeZone() will proxy to the internal DateTimeZoneFactory - * - * @throws DateTimeZoneFactoryException - * @throws DateTimeFactoryException - */ - public function testResolveDateTimeZoneWillProxyToDateTimeZoneFactory(): void - { - $factory = new DateFactory($this->dateTimeFactory, $this->dateTimeZoneFactory, $this->dateIntervalFactory); - - $spec = 'UTC'; - $timeZone = new \DateTimeZone($spec); - - $this->dateTimeZoneFactory->expects($this->once()) - ->method('resolveDateTimeZone') - ->with($spec) - ->willReturn($timeZone); - - $this->assertSame($timeZone, $factory->resolveDateTimeZone($spec)); - } - /** * Assert the calls to createDateInterval() will proxy to the internal DateTimeIntervalFactory * diff --git a/test/unit/DateTimeFactoryTest.php b/test/unit/DateTimeFactoryTest.php index abaa59a..fa02556 100755 --- a/test/unit/DateTimeFactoryTest.php +++ b/test/unit/DateTimeFactoryTest.php @@ -105,27 +105,27 @@ public function getCreateDateTimeData(): array [ 'now', - 'Europe/London' + 'Europe/London', ], [ '2019-05-14 12:33:00', ], - [ - '2019-08-14 17:34:55', - 'UTC', - ], - - [ - '2020-08-22 14:43:12', - null, - ], - - [ - '2020-08-22 14:44:37', - new \DateTimeZone('Europe/London'), - ], +// [ +// '2019-08-14 17:34:55', +// 'UTC', +// ], + +// [ +// '2020-08-22 14:43:12', +// null, +// ], +// +// [ +// '2020-08-22 14:44:37', +// new \DateTimeZone('Europe/London'), +// ], ]; } @@ -214,29 +214,24 @@ public function testCreateDateTimeWillThrowDateTimeFactoryExceptionForInvalidDat $factory = new DateTimeFactory($this->dateTimeZoneFactory); $spec = 'now'; - $timeZone = new \stdClass(); + $timeZone = 'UTC'; $exceptionMessage = 'This is a test exception'; $exceptionCode = 123; $exception = new DateTimeZoneFactoryException($exceptionMessage, $exceptionCode); $this->dateTimeZoneFactory->expects($this->once()) - ->method('resolveDateTimeZone') + ->method('createDateTimeZone') ->with($timeZone) ->willThrowException($exception); $this->expectException(DateTimeFactoryException::class); $this->expectExceptionCode($exceptionCode); $this->expectExceptionMessage( - sprintf( - 'Failed to create a valid \DateTime instance using \'%s\': %s', - $spec, - $exceptionMessage - ) + sprintf('Failed to create date time zone: %s', $exceptionMessage), ); - /** @phpstan-ignore-next-line */ - $factory->createDateTime($spec, /** @scrutinizer ignore-type */ $timeZone); + $factory->createDateTime($spec, $timeZone); } /** @@ -263,11 +258,6 @@ public function testCreateFromFormat(string $spec, string $format, $timeZone = n $dateTimeZone ); - $this->dateTimeZoneFactory->expects($this->once()) - ->method('resolveDateTimeZone') - ->with($timeZone) - ->willReturn($dateTimeZone); - $this->assertDateTime($expectedDateTime, $factory->createFromFormat($spec, $format, $timeZone)); } @@ -283,20 +273,20 @@ public function getCreateFromFormatData(): array '2019-04-01', 'Y-m-d', ], - [ - '1976/01/14', - 'Y/m/d', - ], - [ - '2019-08-14 17:34:55', - 'Y-m-d H:i:s', - 'UTC', - ], - [ - '2010-10-26 11:19:32', - 'Y-m-d H:i:s', - 'Europe/London', - ], +// [ +// '1976/01/14', +// 'Y/m/d', +// ], +// [ +// '2019-08-14 17:34:55', +// 'Y-m-d H:i:s', +// 'UTC', +// ], +// [ +// '2010-10-26 11:19:32', +// 'Y-m-d H:i:s', +// 'Europe/London', +// ], ]; } From 14f5193edffdd406249fb7c016c647e78c7d32f1 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Sat, 1 May 2021 23:24:49 +0000 Subject: [PATCH 03/14] Reformat the argument order of createFromFormat() to match the PHP \DateTime::createFromFormat() order of , --- src/DateFactory.php | 6 +++--- src/DateTimeFactory.php | 19 +++-------------- src/DateTimeFactoryInterface.php | 4 ++-- test/unit/DateFactoryTest.php | 4 ++-- test/unit/DateTimeFactoryTest.php | 34 ++++++++++++++++++++++++++++++- 5 files changed, 43 insertions(+), 24 deletions(-) diff --git a/src/DateFactory.php b/src/DateFactory.php index 20f635d..08b5d11 100755 --- a/src/DateFactory.php +++ b/src/DateFactory.php @@ -60,17 +60,17 @@ public function createDateTime(?string $spec = null, $timeZone = null): \DateTim } /** - * @param string $spec * @param string $format + * @param string $spec * @param string|\DateTimeZone|null $timeZone * * @return \DateTimeInterface * * @throws DateTimeFactoryException */ - public function createFromFormat(string $spec, string $format, $timeZone = null): \DateTimeInterface + public function createFromFormat(string $format, string $spec, $timeZone = null): \DateTimeInterface { - return $this->dateTimeFactory->createFromFormat($spec, $format, $timeZone); + return $this->dateTimeFactory->createFromFormat($format, $spec, $timeZone); } /** diff --git a/src/DateTimeFactory.php b/src/DateTimeFactory.php index 3a21895..4569711 100755 --- a/src/DateTimeFactory.php +++ b/src/DateTimeFactory.php @@ -74,33 +74,20 @@ public function createDateTime(?string $spec = null, $timeZone = null): \DateTim } /** - * @param string $spec The date and time specification * @param string $format The date and time format + * @param string $spec The date and time specification * @param string|\DateTimeZone|null $timeZone The date time zone; if omitted or null the PHP default will be used * * @return \DateTimeInterface * * @throws DateTimeFactoryException If the \DateTime instance cannot be created */ - public function createFromFormat(string $spec, string $format, $timeZone = null): \DateTimeInterface + public function createFromFormat(string $format, string $spec, $timeZone = null): \DateTimeInterface { /** @var callable $factory */ $factory = [$this->dateTimeClassName, 'createFromFormat']; - try { - $dateTime = $factory($format, $spec, $this->resolveDateTimeZone($timeZone)); - } catch (\Exception $e) { - throw new DateTimeFactoryException( - sprintf( - 'Failed to create a valid \DateTime instance from format \'%s\' using \'%s\': %s', - $format, - $spec, - $e->getMessage() - ), - $e->getCode(), - $e - ); - } + $dateTime = $factory($spec, $format, $this->resolveDateTimeZone($timeZone)); if (false === $dateTime || !$dateTime instanceof \DateTimeInterface) { throw new DateTimeFactoryException( diff --git a/src/DateTimeFactoryInterface.php b/src/DateTimeFactoryInterface.php index 600e7a2..b7317a7 100755 --- a/src/DateTimeFactoryInterface.php +++ b/src/DateTimeFactoryInterface.php @@ -27,13 +27,13 @@ public function createDateTime(?string $spec = null, $timeZone = null): \DateTim /** * Create a new \DateTimeInterface instance using the provided format * - * @param string $spec The date and time specification * @param string $format The date and time format + * @param string $spec The date and time specification * @param string|\DateTimeZone|null $timeZone The date time zone. If omitted or null the PHP default will be used * * @return \DateTimeInterface * * @throws DateTimeFactoryException If the \DateTimeInterface instance cannot be created */ - public function createFromFormat(string $spec, string $format, $timeZone = null): \DateTimeInterface; + public function createFromFormat(string $format, string $spec, $timeZone = null): \DateTimeInterface; } diff --git a/test/unit/DateFactoryTest.php b/test/unit/DateFactoryTest.php index 0889abc..5803031 100755 --- a/test/unit/DateFactoryTest.php +++ b/test/unit/DateFactoryTest.php @@ -100,10 +100,10 @@ public function testCreateFromFormatWillProxyToDateTimeFactory(): void $this->dateTimeFactory->expects($this->once()) ->method('createFromFormat') - ->with($spec, $format, $timeZone) + ->with($format, $spec, $timeZone) ->willReturn($dateTime); - $this->assertSame($dateTime, $factory->createFromFormat($spec, $format, $timeZone)); + $this->assertSame($dateTime, $factory->createFromFormat($format, $spec, $timeZone)); } /** diff --git a/test/unit/DateTimeFactoryTest.php b/test/unit/DateTimeFactoryTest.php index fa02556..fe0c2a9 100755 --- a/test/unit/DateTimeFactoryTest.php +++ b/test/unit/DateTimeFactoryTest.php @@ -159,6 +159,38 @@ public function testCreateDateTimeWillThrowDateTimeFactoryExceptionForInvalidDat $factory->createDateTime($spec); } + /** + * Assert that a DateTimeFactoryException will be thrown when providing a invalid \DateTimeZone object to + * createFromFormat() + * + * @throws DateTimeFactoryException + */ + public function testCreateFromFormatWillCatchAndReThrowException(): void + { + $factory = new DateTimeFactory($this->dateTimeZoneFactory); + + $spec = '2021-05-01 23:38:12'; + $format = 'Y-m-d H:i:s'; + $timeZone = 'UTC'; + + $exceptionMessage = 'This is a test exception'; + $exceptionCode = 123; + $exception = new DateTimeZoneFactoryException($exceptionMessage, $exceptionCode); + + $this->dateTimeZoneFactory->expects($this->once()) + ->method('createDateTimeZone') + ->with($timeZone) + ->willThrowException($exception); + + $this->expectException(DateTimeFactoryException::class); + $this->expectExceptionCode($exceptionCode); + $this->expectExceptionMessage( + sprintf('Failed to create date time zone: %s', $exceptionMessage), + ); + + $factory->createFromFormat($format, $spec, $timeZone); + } + /** * Assert that a DateTimeFactoryException will be thrown if providing an invalid $spec * argument to createFromFormat(). @@ -187,7 +219,7 @@ public function testCreateFromFormatWillThrowDateTimeFactoryExceptionForInvalidD ) ); - $factory->createFromFormat($spec, $format, $timeZone); + $factory->createFromFormat($format, $spec, $timeZone); } /** From 861d957af99af8af3ca46fc2556233eaf88bdba3 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Mon, 3 May 2021 14:23:04 +0000 Subject: [PATCH 04/14] Added new DateTimeImmutableFactory --- test/unit/DateTimeImmutableFactoryTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 test/unit/DateTimeImmutableFactoryTest.php diff --git a/test/unit/DateTimeImmutableFactoryTest.php b/test/unit/DateTimeImmutableFactoryTest.php new file mode 100755 index 0000000..66159a0 --- /dev/null +++ b/test/unit/DateTimeImmutableFactoryTest.php @@ -0,0 +1,18 @@ + + * @package ArpTest\DateTime + */ +final class DateTimeImmutableFactoryTest extends TestCase +{ + +} From 3b80ca15229c5c9a24ff9bf21100ffd378d1cb30 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Mon, 3 May 2021 14:45:14 +0000 Subject: [PATCH 05/14] Add addtional test cases for DateTimeImmutableFactory --- src/DateTimeImmutableFactory.php | 6 +- test/unit/DateTimeImmutableFactoryTest.php | 70 +++++++++++++++++++++- 2 files changed, 72 insertions(+), 4 deletions(-) diff --git a/src/DateTimeImmutableFactory.php b/src/DateTimeImmutableFactory.php index d3658ea..bf013f3 100755 --- a/src/DateTimeImmutableFactory.php +++ b/src/DateTimeImmutableFactory.php @@ -56,17 +56,17 @@ public function createDateTime(?string $spec = null, $timeZone = null): \DateTim } /** - * @param string $spec * @param string $format + * @param string $spec * @param null|string|\DateTimeZone $timeZone * * @return \DateTimeImmutable&\DateTimeInterface * * @throws DateTimeFactoryException */ - public function createFromFormat(string $spec, string $format, $timeZone = null): \DateTimeInterface + public function createFromFormat(string $format, string $spec, $timeZone = null): \DateTimeInterface { /** @phpstan-ignore-next-line */ - return $this->dateTimeFactory->createDateTime($spec, $timeZone); + return $this->dateTimeFactory->createFromFormat($format, $spec, $timeZone); } } diff --git a/test/unit/DateTimeImmutableFactoryTest.php b/test/unit/DateTimeImmutableFactoryTest.php index 66159a0..18ef906 100755 --- a/test/unit/DateTimeImmutableFactoryTest.php +++ b/test/unit/DateTimeImmutableFactoryTest.php @@ -4,15 +4,83 @@ namespace ArpTest\DateTime; +use Arp\DateTime\DateTimeFactoryInterface; +use Arp\DateTime\DateTimeImmutableFactory; +use Arp\DateTime\Exception\DateTimeFactoryException; use PHPUnit\Framework\TestCase; /** - * @covers \Arp\DateTime\DateTimeImmutableFactory + * @covers \Arp\DateTime\DateTimeImmutableFactory * * @author Alex Patterson * @package ArpTest\DateTime */ final class DateTimeImmutableFactoryTest extends TestCase { + /** + * Assert the class implements DateTimeFactoryInterface + */ + public function testImplementsDateTimeFactoryInterface(): void + { + $factory = new DateTimeImmutableFactory(); + $this->assertInstanceOf(DateTimeFactoryInterface::class, $factory); + } + + /** + * Assert that an exception will be thrown if the provided $dateTimeClassName option is a class that does not + * implement \DateTimeInterface. + */ + public function testCreateDateTimeWillThrowDateTimeFactoryExceptionIfDateTimeClassNameIsNotDateTimeImmutable(): void + { + $this->expectException(DateTimeFactoryException::class); + $this->expectExceptionMessage( + sprintf( + 'The \'dateTimeClassName\' parameter must be a class name that implements \'%s\'', + \DateTimeImmutable::class + ) + ); + + new DateTimeImmutableFactory(\DateTime::class); + } + + /** + * Assert that calls to createDateTime() will return a DateTimeImmutable instance, + * matching the provided $spec and $timeZone + * + * @param string|null $spec + * @param \DateTimeZone|string|null $timeZone + * + * @dataProvider getCreatDateTimeWillReturnDateTimeImmutableData + * + * @throws DateTimeFactoryException + * @throws \Exception + */ + public function testCreatDateTimeWillReturnDateTimeImmutable(?string $spec, $timeZone = null): void + { + $factory = new DateTimeImmutableFactory(); + + $immutableDateTime = $factory->createDateTime($spec, $timeZone); + + $this->assertInstanceOf(\DateTimeImmutable::class, $immutableDateTime); + } + + /** + * @return array + */ + public function getCreatDateTimeWillReturnDateTimeImmutableData(): array + { + return [ + [ + null, + ], + [ + 'now', + 'UTC', + ], + [ + '2021-05-01' + ] + ]; + } } From 70e1b29b8517055d85b46c6232ac2a95c78a3566 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Mon, 3 May 2021 14:57:34 +0000 Subject: [PATCH 06/14] Corrected broken test cases for DateTimeFactory --- src/DateTimeFactory.php | 2 +- test/unit/DateTimeFactoryTest.php | 38 +++++++++++++--------- test/unit/DateTimeImmutableFactoryTest.php | 38 ++++++++++++++++++++-- 3 files changed, 60 insertions(+), 18 deletions(-) diff --git a/src/DateTimeFactory.php b/src/DateTimeFactory.php index 4569711..aa9b39b 100755 --- a/src/DateTimeFactory.php +++ b/src/DateTimeFactory.php @@ -87,7 +87,7 @@ public function createFromFormat(string $format, string $spec, $timeZone = null) /** @var callable $factory */ $factory = [$this->dateTimeClassName, 'createFromFormat']; - $dateTime = $factory($spec, $format, $this->resolveDateTimeZone($timeZone)); + $dateTime = $factory($format, $spec, $this->resolveDateTimeZone($timeZone)); if (false === $dateTime || !$dateTime instanceof \DateTimeInterface) { throw new DateTimeFactoryException( diff --git a/test/unit/DateTimeFactoryTest.php b/test/unit/DateTimeFactoryTest.php index fe0c2a9..9b701b4 100755 --- a/test/unit/DateTimeFactoryTest.php +++ b/test/unit/DateTimeFactoryTest.php @@ -195,8 +195,8 @@ public function testCreateFromFormatWillCatchAndReThrowException(): void * Assert that a DateTimeFactoryException will be thrown if providing an invalid $spec * argument to createFromFormat(). * - * @param string $spec * @param string $format + * @param string $spec * @param \DateTimeZone|string|null $timeZone * * @dataProvider getCreateFromFormatWillThrowDateTimeFactoryExceptionForInvalidDateTimeData @@ -204,8 +204,8 @@ public function testCreateFromFormatWillCatchAndReThrowException(): void * @throws DateTimeFactoryException */ public function testCreateFromFormatWillThrowDateTimeFactoryExceptionForInvalidDateTimeSpec( - string $spec, string $format, + string $spec, $timeZone = null ): void { $factory = new DateTimeFactory($this->dateTimeZoneFactory); @@ -269,20 +269,28 @@ public function testCreateDateTimeWillThrowDateTimeFactoryExceptionForInvalidDat /** * Ensure that a \DateTime instance can be created from the provided format * - * @param string $spec * @param string $format + * @param string $spec * @param string|\DateTimeZone|null $timeZone * * @dataProvider getCreateFromFormatData * * @throws DateTimeFactoryException */ - public function testCreateFromFormat(string $spec, string $format, $timeZone = null): void + public function testCreateFromFormat(string $format, string $spec, $timeZone = null): void { $factory = new DateTimeFactory($this->dateTimeZoneFactory); $dateTimeZone = is_string($timeZone) ? new \DateTimeZone($timeZone) : $timeZone; + if (is_string($timeZone)) { + $dateTimeZone = new \DateTimeZone($timeZone); + $this->dateTimeZoneFactory->expects($this->once()) + ->method('createDateTimeZone') + ->with($timeZone) + ->willReturn($dateTimeZone); + } + /** @var \DateTimeInterface $expectedDateTime */ $expectedDateTime = \DateTime::createFromFormat( $format, @@ -290,7 +298,7 @@ public function testCreateFromFormat(string $spec, string $format, $timeZone = n $dateTimeZone ); - $this->assertDateTime($expectedDateTime, $factory->createFromFormat($spec, $format, $timeZone)); + $this->assertDateTime($expectedDateTime, $factory->createFromFormat($format, $spec, $timeZone)); } /** @@ -301,22 +309,22 @@ public function testCreateFromFormat(string $spec, string $format, $timeZone = n public function getCreateFromFormatData(): array { return [ - [ - '2019-04-01', - 'Y-m-d', - ], // [ -// '1976/01/14', -// 'Y/m/d', +// 'Y-m-d', +// '2019-04-01', // ], // [ -// '2019-08-14 17:34:55', -// 'Y-m-d H:i:s', -// 'UTC', +// 'Y/m/d', +// '1976/01/14', // ], + [ + 'Y-m-d H:i:s', + '2019-08-14 17:34:55', + 'UTC', + ], // [ -// '2010-10-26 11:19:32', // 'Y-m-d H:i:s', +// '2010-10-26 11:19:32', // 'Europe/London', // ], ]; diff --git a/test/unit/DateTimeImmutableFactoryTest.php b/test/unit/DateTimeImmutableFactoryTest.php index 18ef906..938683b 100755 --- a/test/unit/DateTimeImmutableFactoryTest.php +++ b/test/unit/DateTimeImmutableFactoryTest.php @@ -79,8 +79,42 @@ public function getCreatDateTimeWillReturnDateTimeImmutableData(): array 'UTC', ], [ - '2021-05-01' - ] + '2021-05-01', + ], + ]; + } + + /** + * @param string $format + * @param string $spec + * @param string|\DateTimeZone|null $timeZone + * + * @dataProvider getCreatFromFormatWillReturnDateTimeImmutableData + * + * @throws DateTimeFactoryException + */ + public function testCreatFromFormatWillReturnDateTimeImmutable(string $format, string $spec, $timeZone = null): void + { + $factory = new DateTimeImmutableFactory(); + + $this->assertInstanceOf(\DateTimeImmutable::class, $factory->createFromFormat($format, $spec, $timeZone)); + } + + /** + * @return array + */ + public function getCreatFromFormatWillReturnDateTimeImmutableData(): array + { + return [ + [ + 'Y/m/d H:i:s', + '2021/05/03 14:36:47', + ], + [ + 'Y-d-m H:i:s', + '1999-01-12 11:06:01', + 'UTC', + ], ]; } } From 7dcda852e5f03ce99eb389016473f3fab6053335 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Mon, 3 May 2021 14:58:27 +0000 Subject: [PATCH 07/14] Update composer.lock --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 63dae03..693978c 100644 --- a/composer.lock +++ b/composer.lock @@ -1561,16 +1561,16 @@ }, { "name": "psr/log", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { @@ -1594,7 +1594,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -1605,9 +1605,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.3" + "source": "https://github.com/php-fig/log/tree/1.1.4" }, - "time": "2020-03-23T09:12:05+00:00" + "time": "2021-05-03T11:20:27+00:00" }, { "name": "sebastian/cli-parser", From 6b34902170531c2a183dd8687446b9cf3e8873a0 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Fri, 7 May 2021 17:25:49 +0000 Subject: [PATCH 08/14] Remove commented unit test case data --- test/unit/DateTimeFactoryTest.php | 54 +++++++++++++++---------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/test/unit/DateTimeFactoryTest.php b/test/unit/DateTimeFactoryTest.php index 9b701b4..e528d4a 100755 --- a/test/unit/DateTimeFactoryTest.php +++ b/test/unit/DateTimeFactoryTest.php @@ -112,20 +112,20 @@ public function getCreateDateTimeData(): array '2019-05-14 12:33:00', ], -// [ -// '2019-08-14 17:34:55', -// 'UTC', -// ], - -// [ -// '2020-08-22 14:43:12', -// null, -// ], -// -// [ -// '2020-08-22 14:44:37', -// new \DateTimeZone('Europe/London'), -// ], + [ + '2019-08-14 17:34:55', + 'UTC', + ], + + [ + '2020-08-22 14:43:12', + null, + ], + + [ + '2020-08-22 14:44:37', + new \DateTimeZone('Europe/London'), + ], ]; } @@ -309,24 +309,24 @@ public function testCreateFromFormat(string $format, string $spec, $timeZone = n public function getCreateFromFormatData(): array { return [ -// [ -// 'Y-m-d', -// '2019-04-01', -// ], -// [ -// 'Y/m/d', -// '1976/01/14', -// ], + [ + 'Y-m-d', + '2019-04-01', + ], + [ + 'Y/m/d', + '1976/01/14', + ], [ 'Y-m-d H:i:s', '2019-08-14 17:34:55', 'UTC', ], -// [ -// 'Y-m-d H:i:s', -// '2010-10-26 11:19:32', -// 'Europe/London', -// ], + [ + 'Y-m-d H:i:s', + '2010-10-26 11:19:32', + 'Europe/London', + ], ]; } From 20200bb2907758cb39d4a74ff39ffd35fac411dc Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Fri, 7 May 2021 22:20:55 +0000 Subject: [PATCH 09/14] Updated README.md with more examples of use --- README.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2b5969c..4962ff7 100755 --- a/README.md +++ b/README.md @@ -6,14 +6,14 @@ ## About -The library provides a number of factory interfaces which abstract the creation of native PHP DateTime classes, -`\DateTime`, `DateTimeImmutible`, `\DateInterval` and `\DateTimeZone`. +The library provides a number of factory interfaces which abstracts the creation of native PHP DateTime classes, +`\DateTime`, `\DateTimeImmutible`, `\DateInterval` and `\DateTimeZone`. ## Installation Installation via [composer](https://getcomposer.org). - require alex-patterson-webdev/date-time ^0.4 + require alex-patterson-webdev/date-time ^0.5 ## Theory @@ -54,6 +54,75 @@ The approach has a number of notable benefits - Unit testing and asserting date time values becomes very easy as we can now mock the return value of `$this->dateTimeFactory->createDateTime()`. - Rather than returning a boolean `false` when unable to create date objects, the factory classes will instead throw a `DateTimeException`. +## Date Creation + +The `DateTimeFactoryInterface` exposes two public methods, `createDateTime()` and `createFromFormat()`. The method signatures are +similar the PHP `\DateTime` methods. + +The `DateTimeFactoryInterface::createDateTime()` method can replace uses of [\DateTime::__construct](https://www.php.net/manual/en/datetime.construct.php). +The `DateTimeFactoryInterface::createFromFormat()` method can replace uses of [\DateTime::createFromFormat()](https://www.php.net/manual/en/datetime.createfromformat.php). + + interface DateTimeFactoryInterface + { + /** + * @throws DateTimeFactoryException + */ + public function createDateTime(?string $spec = null, $timeZone = null): \DateTimeInterface; + + /** + * @throws DateTimeFactoryException + */ + public function createFromFormat(string $format, string $spec, $timeZone = null): \DateTimeInterface; + } + +If you use the factory as a replacement to manually creating PHP object via `new \DateTime()`, or `\DateTime::createFromFormat()`, +there are a number of differences to consider. + +- The methods of the interface are defined as non-static and require a factory instance to invoke them +- A `DateTimeFactoryException` will be thrown if the `\DateTime` instance cannot be created +- The `$spec` parameter of `createDateTime()` accepts `null`. Passing `null` is equivalent to using the current date and time, i.e. `now` +- The `$timeZone` parameter accepts `string` or `\DateTimeZone` instance. If a [supported `DateTimeZone` string](https://www.php.net/manual/en/timezones.php) + is provided, the `\DateTimeZone` instance will be created internally + +### Implementations + +The package provides two default implementations of the `DateTimeFactoryInterface`, depending on the type of date time instance you wish to create. + +- `DateTimeFactory` can be used to create `\DateTime` instances. +- `DateTimeImmutableFactory` can be used to create `\DateTimeImmutible` instances + +Because both classes implement the `\DateTimeFactoryInterface`, they can be used in the same way. + + $dateTimeFactory = new \Arp\DateTime\DateTimeFactory(); + $dateTimeImmutableFactory = new \Arp\DateTime\DateTimeImmutableFactory(); + + try { + /** @var \DateTime $dateTimeZone **/ + $dateTime = $dateTimeFactory->createDateTime(); + + /** @var \DateTimeImmutable $dateTimeZone **/ + $dateTimeImmutable = $dateTimeImmutableFactory->createDateTime(); + } catch (\DateTimeFactoryException $e) { + // If the date times cannot be created + } + +### DateTimeZoneFactory + +`\DateTimeZone` instances can be created by a class implementing `DateTimeZoneFactoryInterface`. + + public function createDateTimeZone(string $spec): \DateTimeZone; + +The default implementation of the interface provided is `Arp\DateTime\DateTimeZoneFactory`. + + $dateTimeZoneFactory = new \Arp\DateTime\DateTimeZoneFactory(); + /** @var \DateTimeZone $dateTimeZone **/ + + try { + $dateTimeZone = $dateTimeZoneFactory->createDateTimeZone('UTC'); + } catch (\DateTimeZoneFactoryException $e) { + // The \DateTimeZone() could not be created + } + ## Unit tests Unit tests can be executed using PHPUnit from the application root directory. From 954eea2db1d85d498dba5f41aa3ef49b76a6e947 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Fri, 7 May 2021 22:45:33 +0000 Subject: [PATCH 10/14] Updated README --- README.md | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 4962ff7..5b28dbb 100755 --- a/README.md +++ b/README.md @@ -54,13 +54,10 @@ The approach has a number of notable benefits - Unit testing and asserting date time values becomes very easy as we can now mock the return value of `$this->dateTimeFactory->createDateTime()`. - Rather than returning a boolean `false` when unable to create date objects, the factory classes will instead throw a `DateTimeException`. -## Date Creation +## DateTimeFactoryInterface The `DateTimeFactoryInterface` exposes two public methods, `createDateTime()` and `createFromFormat()`. The method signatures are -similar the PHP `\DateTime` methods. - -The `DateTimeFactoryInterface::createDateTime()` method can replace uses of [\DateTime::__construct](https://www.php.net/manual/en/datetime.construct.php). -The `DateTimeFactoryInterface::createFromFormat()` method can replace uses of [\DateTime::createFromFormat()](https://www.php.net/manual/en/datetime.createfromformat.php). +similar to the PHP `\DateTime` methods. interface DateTimeFactoryInterface { @@ -75,49 +72,54 @@ The `DateTimeFactoryInterface::createFromFormat()` method can replace uses of [\ public function createFromFormat(string $format, string $spec, $timeZone = null): \DateTimeInterface; } -If you use the factory as a replacement to manually creating PHP object via `new \DateTime()`, or `\DateTime::createFromFormat()`, -there are a number of differences to consider. +The `createDateTime()` method can replace uses of [\DateTime::__construct](https://www.php.net/manual/en/datetime.construct.php). +The `createFromFormat()` method can replace uses of [\DateTime::createFromFormat()](https://www.php.net/manual/en/datetime.createfromformat.php). + +There are however a number of differences to consider. -- The methods of the interface are defined as non-static and require a factory instance to invoke them -- A `DateTimeFactoryException` will be thrown if the `\DateTime` instance cannot be created -- The `$spec` parameter of `createDateTime()` accepts `null`. Passing `null` is equivalent to using the current date and time, i.e. `now` -- The `$timeZone` parameter accepts `string` or `\DateTimeZone` instance. If a [supported `DateTimeZone` string](https://www.php.net/manual/en/timezones.php) - is provided, the `\DateTimeZone` instance will be created internally +- The methods of the interface are defined as non-static and require a factory instance to invoke them. +- A `DateTimeFactoryException` will be thrown if the `\DateTime` instance cannot be created. +- The `$spec` parameter of `createDateTime()` accepts `null`. Passing `null` is equivalent to using the current date and time, i.e. `now`. +- The `$timeZone` can be either a `string` or `\DateTimeZone` instance. If a [supported `DateTimeZone` string](https://www.php.net/manual/en/timezones.php) + is provided, the `\DateTimeZone` instance will be created internally; otherwise a `DateTimeFactoryException` will be thrown. ### Implementations -The package provides two default implementations of the `DateTimeFactoryInterface`, depending on the type of date time instance you wish to create. +The package provides two default implementations of the `DateTimeFactoryInterface`. - `DateTimeFactory` can be used to create `\DateTime` instances. - `DateTimeImmutableFactory` can be used to create `\DateTimeImmutible` instances -Because both classes implement the `\DateTimeFactoryInterface`, they can be used in the same way. +Because both classes implement the `DateTimeFactoryInterface`, they can be used in the same way. $dateTimeFactory = new \Arp\DateTime\DateTimeFactory(); $dateTimeImmutableFactory = new \Arp\DateTime\DateTimeImmutableFactory(); try { - /** @var \DateTime $dateTimeZone **/ + /** @var \DateTime $dateTime **/ $dateTime = $dateTimeFactory->createDateTime(); - /** @var \DateTimeImmutable $dateTimeZone **/ + /** @var \DateTimeImmutable $dateTimeImmutable **/ $dateTimeImmutable = $dateTimeImmutableFactory->createDateTime(); } catch (\DateTimeFactoryException $e) { - // If the date times cannot be created + // if the date creation fails } ### DateTimeZoneFactory -`\DateTimeZone` instances can be created by a class implementing `DateTimeZoneFactoryInterface`. +`\DateTimeZone` instances can be created using any class that implements `Arp\DateTime\DateTimeZoneFactoryInterface`. + /* + * @throws DateTimeZoneFactoryException + */ public function createDateTimeZone(string $spec): \DateTimeZone; -The default implementation of the interface provided is `Arp\DateTime\DateTimeZoneFactory`. +The default implementation of the interface is `Arp\DateTime\DateTimeZoneFactory`. $dateTimeZoneFactory = new \Arp\DateTime\DateTimeZoneFactory(); - /** @var \DateTimeZone $dateTimeZone **/ try { + /** @var \DateTimeZone $dateTimeZone **/ $dateTimeZone = $dateTimeZoneFactory->createDateTimeZone('UTC'); } catch (\DateTimeZoneFactoryException $e) { // The \DateTimeZone() could not be created From 1409ec4f7126db54d98736b4c6de033566ec6cd9 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Sun, 6 Mar 2022 16:10:54 +0000 Subject: [PATCH 11/14] Renamed build configuration file for cs fixer and composer development package versions for PHP 8.1+ --- .php_cs.dist => .php-cs-fixer.dist | 1 - composer.json | 16 +- composer.lock | 1058 +++++++++++++++------------- phpstan.neon | 5 + 4 files changed, 574 insertions(+), 506 deletions(-) rename .php_cs.dist => .php-cs-fixer.dist (92%) create mode 100755 phpstan.neon diff --git a/.php_cs.dist b/.php-cs-fixer.dist similarity index 92% rename from .php_cs.dist rename to .php-cs-fixer.dist index ebf43bc..1d03e42 100755 --- a/.php_cs.dist +++ b/.php-cs-fixer.dist @@ -6,7 +6,6 @@ use PhpCsFixer\Finder; $rules = [ '@PSR12' => true, - 'class_definition' => false, ]; /** @var iterable $finder */ diff --git a/composer.json b/composer.json index 8fcb648..aeb9c4f 100755 --- a/composer.json +++ b/composer.json @@ -14,10 +14,11 @@ "php" : ">=7.4 || >=8.0" }, "require-dev": { + "phpspec/prophecy": "^1.15.0", "phpunit/phpunit": "^9.5", - "squizlabs/php_codesniffer": "^3.5", - "phpstan/phpstan": ">=0.12", - "friendsofphp/php-cs-fixer": "^2.18" + "squizlabs/php_codesniffer": "^3.6", + "phpstan/phpstan": "^1.4.8", + "friendsofphp/php-cs-fixer": "^3.6.0" }, "autoload": { "psr-4": { @@ -40,14 +41,13 @@ "@arp:check", "@arp:lint", "@arp:fix", - "@arp:analyse-max", + "@arp:analyse", "@arp:unit-test" ], "arp:check": "php vendor/bin/phpcs -s --standard=phpcs.xml --colors src/ test/", - "arp:lint": "php vendor/bin/php-cs-fixer fix --dry-run --verbose --config=.php_cs.dist", - "arp:fix": "php vendor/bin/php-cs-fixer fix --config=.php_cs.dist", - "arp:analyse": "php vendor/bin/phpstan analyse src/ test/ --level=7", - "arp:analyse-max": "php vendor/bin/phpstan analyse src/ test/ --level=8", + "arp:lint": "php vendor/bin/php-cs-fixer fix --dry-run --verbose --config=.php-cs-fixer.dist", + "arp:fix": "php vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist", + "arp:analyse": "php vendor/bin/phpstan analyse -c phpstan.neon --level=7", "arp:unit-test": "php vendor/bin/phpunit", "arp:unit-test-with-coverage": [ "@putenv XDEBUG_MODE=coverage", diff --git a/composer.lock b/composer.lock index 693978c..4657772 100644 --- a/composer.lock +++ b/composer.lock @@ -4,28 +4,99 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f7322a82c656a50d11747d752a8d52e0", + "content-hash": "b46017d7a3de72af8b0c8f8a61fe1b47", "packages": [], "packages-dev": [ + { + "name": "composer/pcre", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/e300eb6c535192decd27a85bc72a9290f0d6b3bd", + "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.0.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-02-25T20:21:48+00:00" + }, { "name": "composer/semver", - "version": "3.2.4", + "version": "3.2.9", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464" + "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", - "reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", + "url": "https://api.github.com/repos/composer/semver/zipball/a951f614bd64dcd26137bc9b7b2637ddcfc57649", + "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.54", + "phpstan/phpstan": "^1.4", "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", @@ -70,7 +141,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.4" + "source": "https://github.com/composer/semver/tree/3.2.9" }, "funding": [ { @@ -86,29 +157,31 @@ "type": "tidelift" } ], - "time": "2020-11-13T08:59:24+00:00" + "time": "2022-02-04T13:58:43+00:00" }, { "name": "composer/xdebug-handler", - "version": "2.0.0", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "31d57697eb1971712a08031cfaff5a846d10bdf5" + "reference": "ced299686f41dce890debac69273b47ffe98a40c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/31d57697eb1971712a08031cfaff5a846d10bdf5", - "reference": "31d57697eb1971712a08031cfaff5a846d10bdf5", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", + "reference": "ced299686f41dce890debac69273b47ffe98a40c", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" }, "require-dev": { - "phpstan/phpstan": "^0.12.55", - "symfony/phpunit-bridge": "^4.2 || ^5" + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^6.0" }, "type": "library", "autoload": { @@ -134,7 +207,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/2.0.0" + "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" }, "funding": [ { @@ -150,32 +223,34 @@ "type": "tidelift" } ], - "time": "2021-04-09T19:40:06+00:00" + "time": "2022-02-25T21:32:43+00:00" }, { "name": "doctrine/annotations", - "version": "1.12.1", + "version": "1.13.2", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "b17c5014ef81d212ac539f07a1001832df1b6d3b" + "reference": "5b668aef16090008790395c02c893b1ba13f7e08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/b17c5014ef81d212ac539f07a1001832df1b6d3b", - "reference": "b17c5014ef81d212ac539f07a1001832df1b6d3b", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08", + "reference": "5b668aef16090008790395c02c893b1ba13f7e08", "shasum": "" }, "require": { "doctrine/lexer": "1.*", "ext-tokenizer": "*", - "php": "^7.1 || ^8.0" + "php": "^7.1 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" }, "require-dev": { - "doctrine/cache": "1.*", + "doctrine/cache": "^1.11 || ^2.0", "doctrine/coding-standard": "^6.0 || ^8.1", "phpstan/phpstan": "^0.12.20", - "phpunit/phpunit": "^7.5 || ^9.1.5" + "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", + "symfony/cache": "^4.4 || ^5.2" }, "type": "library", "autoload": { @@ -218,35 +293,36 @@ ], "support": { "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.12.1" + "source": "https://github.com/doctrine/annotations/tree/1.13.2" }, - "time": "2021-02-21T21:00:45+00:00" + "time": "2021-08-05T19:00:23+00:00" }, { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { @@ -273,7 +349,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, "funding": [ { @@ -289,36 +365,32 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-03-03T08:28:38+00:00" }, { "name": "doctrine/lexer", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" @@ -353,7 +425,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.1" + "source": "https://github.com/doctrine/lexer/tree/1.2.3" }, "funding": [ { @@ -369,62 +441,60 @@ "type": "tidelift" } ], - "time": "2020-05-25T17:44:05+00:00" + "time": "2022-02-28T11:07:21+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.18.6", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "5fed214993e7863cef88a08f214344891299b9e4" + "reference": "1975e4453eb2726d1f50da0ce7fa91295029a4fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/5fed214993e7863cef88a08f214344891299b9e4", - "reference": "5fed214993e7863cef88a08f214344891299b9e4", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/1975e4453eb2726d1f50da0ce7fa91295029a4fa", + "reference": "1975e4453eb2726d1f50da0ce7fa91295029a4fa", "shasum": "" }, "require": { - "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.2 || ^2.0", - "doctrine/annotations": "^1.2", + "composer/semver": "^3.2", + "composer/xdebug-handler": "^3.0", + "doctrine/annotations": "^1.13", "ext-json": "*", "ext-tokenizer": "*", - "php": "^5.6 || ^7.0 || ^8.0", - "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.43 || ^4.1.6 || ^5.0", - "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", - "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", - "symfony/finder": "^3.0 || ^4.0 || ^5.0", - "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0", - "symfony/polyfill-php70": "^1.0", - "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0 || ^5.0", - "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" + "php": "^7.4 || ^8.0", + "php-cs-fixer/diff": "^2.0", + "symfony/console": "^5.4 || ^6.0", + "symfony/event-dispatcher": "^5.4 || ^6.0", + "symfony/filesystem": "^5.4 || ^6.0", + "symfony/finder": "^5.4 || ^6.0", + "symfony/options-resolver": "^5.4 || ^6.0", + "symfony/polyfill-mbstring": "^1.23", + "symfony/polyfill-php80": "^1.23", + "symfony/polyfill-php81": "^1.23", + "symfony/process": "^5.4 || ^6.0", + "symfony/stopwatch": "^5.4 || ^6.0" }, "require-dev": { - "justinrainbow/json-schema": "^5.0", - "keradus/cli-executor": "^1.4", - "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.4.2", - "php-cs-fixer/accessible-object": "^1.0", + "justinrainbow/json-schema": "^5.2", + "keradus/cli-executor": "^1.5", + "mikey179/vfsstream": "^1.6.10", + "php-coveralls/php-coveralls": "^2.5.2", + "php-cs-fixer/accessible-object": "^1.1", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", - "phpspec/prophecy-phpunit": "^1.1 || ^2.0", - "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.13 || ^9.5", + "phpspec/prophecy": "^1.15", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", "phpunitgoodpractices/polyfill": "^1.5", "phpunitgoodpractices/traits": "^1.9.1", - "sanmai/phpunit-legacy-adapter": "^6.4 || ^8.2.1", - "symfony/phpunit-bridge": "^5.2.1", - "symfony/yaml": "^3.0 || ^4.0 || ^5.0" + "symfony/phpunit-bridge": "^6.0", + "symfony/yaml": "^5.4 || ^6.0" }, "suggest": { "ext-dom": "For handling output formats in XML", - "ext-mbstring": "For handling non-UTF8 characters.", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", - "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." + "ext-mbstring": "For handling non-UTF8 characters." }, "bin": [ "php-cs-fixer" @@ -433,20 +503,7 @@ "autoload": { "psr-4": { "PhpCsFixer\\": "src/" - }, - "classmap": [ - "tests/Test/AbstractFixerTestCase.php", - "tests/Test/AbstractIntegrationCaseFactory.php", - "tests/Test/AbstractIntegrationTestCase.php", - "tests/Test/Assert/AssertTokensTrait.php", - "tests/Test/IntegrationCase.php", - "tests/Test/IntegrationCaseFactory.php", - "tests/Test/IntegrationCaseFactoryInterface.php", - "tests/Test/InternalIntegrationCaseFactory.php", - "tests/Test/IsIdenticalConstraint.php", - "tests/Test/TokensWithObservedTransformers.php", - "tests/TestCase.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -465,7 +522,7 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", - "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.18.6" + "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.6.0" }, "funding": [ { @@ -473,41 +530,42 @@ "type": "github" } ], - "time": "2021-04-19T19:45:11+00:00" + "time": "2022-02-07T18:02:40+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -523,7 +581,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" }, "funding": [ { @@ -531,20 +589,20 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-03T13:19:32+00:00" }, { "name": "nikic/php-parser", - "version": "v4.10.4", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -585,22 +643,22 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" }, - "time": "2020-12-20T10:01:03+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { @@ -645,22 +703,22 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.3" }, - "time": "2020-06-27T14:33:11+00:00" + "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -696,22 +754,22 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2021-02-23T14:00:09+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "php-cs-fixer/diff", - "version": "v1.3.1", + "version": "v2.0.2", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759" + "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/dbd31aeb251639ac0b9e7e29405c1441907f5759", - "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/29dc0d507e838c4580d018bd8b5cb412474f7ec3", + "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3", "shasum": "" }, "require": { @@ -739,21 +797,18 @@ { "name": "Kore Nordmann", "email": "mail@kore-nordmann.de" - }, - { - "name": "SpacePossum" } ], - "description": "sebastian/diff v2 backport support for PHP5.6", + "description": "sebastian/diff v3 backport support for PHP 5.6+", "homepage": "https://github.com/PHP-CS-Fixer", "keywords": [ "diff" ], "support": { "issues": "https://github.com/PHP-CS-Fixer/diff/issues", - "source": "https://github.com/PHP-CS-Fixer/diff/tree/v1.3.1" + "source": "https://github.com/PHP-CS-Fixer/diff/tree/v2.0.2" }, - "time": "2020-10-14T08:39:05+00:00" + "time": "2020-10-14T08:32:19+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -810,16 +865,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -830,7 +885,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -860,22 +916,22 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", "shasum": "" }, "require": { @@ -883,7 +939,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -909,39 +966,39 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2022-01-04T19:58:01+00:00" }, { "name": "phpspec/prophecy", - "version": "1.13.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -976,22 +1033,22 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.13.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" }, - "time": "2021-03-17T13:42:18+00:00" + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpstan/phpstan", - "version": "0.12.85", + "version": "1.4.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "20e6333c0067875ad7697cd8acdf245c6ef69d03" + "reference": "2a6d6704b17c4db6190cc3104056c0aad740cb15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/20e6333c0067875ad7697cd8acdf245c6ef69d03", - "reference": "20e6333c0067875ad7697cd8acdf245c6ef69d03", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2a6d6704b17c4db6190cc3104056c0aad740cb15", + "reference": "2a6d6704b17c4db6190cc3104056c0aad740cb15", "shasum": "" }, "require": { @@ -1007,7 +1064,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "0.12-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -1022,13 +1079,17 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.85" + "source": "https://github.com/phpstan/phpstan/tree/1.4.8" }, "funding": [ { "url": "https://github.com/ondrejmirtes", "type": "github" }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, { "url": "https://www.patreon.com/phpstan", "type": "patreon" @@ -1038,27 +1099,27 @@ "type": "tidelift" } ], - "time": "2021-04-27T14:13:16+00:00" + "time": "2022-03-04T13:03:56+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.6", + "version": "9.2.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f6293e1b30a2354e8428e004689671b83871edde" + "reference": "9f4d60b6afe5546421462b76cd4e633ebc364ab4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f6293e1b30a2354e8428e004689671b83871edde", - "reference": "f6293e1b30a2354e8428e004689671b83871edde", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f4d60b6afe5546421462b76cd4e633ebc364ab4", + "reference": "9f4d60b6afe5546421462b76cd4e633ebc364ab4", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.10.2", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1107,7 +1168,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.14" }, "funding": [ { @@ -1115,20 +1176,20 @@ "type": "github" } ], - "time": "2021-03-28T07:26:59+00:00" + "time": "2022-02-28T12:38:02+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { @@ -1167,7 +1228,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -1175,7 +1236,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { "name": "phpunit/php-invoker", @@ -1360,16 +1421,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.4", + "version": "9.5.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c73c6737305e779771147af66c96ca6a7ed8a741" + "reference": "5c5abcfaa2cbd44b2203995d7a339ef910fe0c8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c73c6737305e779771147af66c96ca6a7ed8a741", - "reference": "c73c6737305e779771147af66c96ca6a7ed8a741", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5c5abcfaa2cbd44b2203995d7a339ef910fe0c8f", + "reference": "5c5abcfaa2cbd44b2203995d7a339ef910fe0c8f", "shasum": "" }, "require": { @@ -1381,11 +1442,11 @@ "ext-xml": "*", "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.1", + "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -1399,7 +1460,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3", + "sebastian/type": "^2.3.4", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -1420,11 +1481,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1447,11 +1508,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.4" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.17" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { @@ -1459,24 +1520,73 @@ "type": "github" } ], - "time": "2021-03-23T07:16:29+00:00" + "time": "2022-03-05T16:54:31+00:00" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/master" + }, + "time": "2016-08-06T20:24:11+00:00" }, { "name": "psr/container", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", "autoload": { @@ -1505,9 +1615,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "psr/event-dispatcher", @@ -2038,16 +2148,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { @@ -2096,14 +2206,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" }, "funding": [ { @@ -2111,20 +2221,20 @@ "type": "github" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.2", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -2167,7 +2277,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -2175,7 +2285,7 @@ "type": "github" } ], - "time": "2020-10-26T15:55:19+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -2466,16 +2576,16 @@ }, { "name": "sebastian/type", - "version": "2.3.1", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", "shasum": "" }, "require": { @@ -2510,7 +2620,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" + "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" }, "funding": [ { @@ -2518,7 +2628,7 @@ "type": "github" } ], - "time": "2020-10-26T13:18:59+00:00" + "time": "2021-06-15T12:49:02+00:00" }, { "name": "sebastian/version", @@ -2575,16 +2685,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.0", + "version": "3.6.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625" + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5e4e71592f69da17871dba6e80dd51bce74a351a", + "reference": "5e4e71592f69da17871dba6e80dd51bce74a351a", "shasum": "" }, "require": { @@ -2627,31 +2737,33 @@ "source": "https://github.com/squizlabs/PHP_CodeSniffer", "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" }, - "time": "2021-04-09T00:54:41+00:00" + "time": "2021-12-12T21:44:58+00:00" }, { "name": "symfony/console", - "version": "v5.2.7", + "version": "v5.4.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "90374b8ed059325b49a29b55b3f8bb4062c87629" + "reference": "d8111acc99876953f52fe16d4c50eb60940d49ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/90374b8ed059325b49a29b55b3f8bb4062c87629", - "reference": "90374b8ed059325b49a29b55b3f8bb4062c87629", + "url": "https://api.github.com/repos/symfony/console/zipball/d8111acc99876953f52fe16d4c50eb60940d49ad", + "reference": "d8111acc99876953f52fe16d4c50eb60940d49ad", "shasum": "" }, "require": { "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { + "psr/log": ">=3", "symfony/dependency-injection": "<4.4", "symfony/dotenv": "<5.1", "symfony/event-dispatcher": "<4.4", @@ -2659,16 +2771,16 @@ "symfony/process": "<4.4" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -2708,7 +2820,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.2.7" + "source": "https://github.com/symfony/console/tree/v5.4.5" }, "funding": [ { @@ -2724,20 +2836,20 @@ "type": "tidelift" } ], - "time": "2021-04-19T14:07:32+00:00" + "time": "2022-02-24T12:45:35+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", "shasum": "" }, "require": { @@ -2746,7 +2858,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -2775,7 +2887,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" }, "funding": [ { @@ -2791,27 +2903,27 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2021-07-12T14:48:14+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.2.4", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "d08d6ec121a425897951900ab692b612a61d6240" + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d08d6ec121a425897951900ab692b612a61d6240", - "reference": "d08d6ec121a425897951900ab692b612a61d6240", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/dec8a9f58d20df252b9cd89f1c6c1530f747685d", + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/event-dispatcher-contracts": "^2", - "symfony/polyfill-php80": "^1.15" + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", + "symfony/polyfill-php80": "^1.16" }, "conflict": { "symfony/dependency-injection": "<4.4" @@ -2821,14 +2933,14 @@ "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/error-handler": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^4.4|^5.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/dependency-injection": "", @@ -2860,7 +2972,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.2.4" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.3" }, "funding": [ { @@ -2876,20 +2988,20 @@ "type": "tidelift" } ], - "time": "2021-02-18T17:12:37+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11" + "reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/69fee1ad2332a7cbab3aca13591953da9cdb7a11", - "reference": "69fee1ad2332a7cbab3aca13591953da9cdb7a11", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/66bea3b09be61613cd3b4043a65a8ec48cfa6d2a", + "reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a", "shasum": "" }, "require": { @@ -2902,7 +3014,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -2939,7 +3051,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.0" }, "funding": [ { @@ -2955,25 +3067,27 @@ "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2021-07-12T14:48:14+00:00" }, { "name": "symfony/filesystem", - "version": "v5.2.7", + "version": "v5.4.6", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "056e92acc21d977c37e6ea8e97374b2a6c8551b0" + "reference": "d53a45039974952af7f7ebc461ccdd4295e29440" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/056e92acc21d977c37e6ea8e97374b2a6c8551b0", - "reference": "056e92acc21d977c37e6ea8e97374b2a6c8551b0", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/d53a45039974952af7f7ebc461ccdd4295e29440", + "reference": "d53a45039974952af7f7ebc461ccdd4295e29440", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/polyfill-ctype": "~1.8" + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3001,7 +3115,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.2.7" + "source": "https://github.com/symfony/filesystem/tree/v5.4.6" }, "funding": [ { @@ -3017,24 +3131,26 @@ "type": "tidelift" } ], - "time": "2021-04-01T10:42:13+00:00" + "time": "2022-03-02T12:42:23+00:00" }, { "name": "symfony/finder", - "version": "v5.2.4", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "0d639a0943822626290d169965804f79400e6a04" + "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/0d639a0943822626290d169965804f79400e6a04", - "reference": "0d639a0943822626290d169965804f79400e6a04", + "url": "https://api.github.com/repos/symfony/finder/zipball/231313534dded84c7ecaa79d14bc5da4ccb69b7d", + "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d", "shasum": "" }, "require": { - "php": ">=7.2.5" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3062,7 +3178,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.2.4" + "source": "https://github.com/symfony/finder/tree/v5.4.3" }, "funding": [ { @@ -3078,27 +3194,27 @@ "type": "tidelift" } ], - "time": "2021-02-15T18:55:04+00:00" + "time": "2022-01-26T16:34:36+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.2.4", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce" + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce", - "reference": "5d0f633f9bbfcf7ec642a2b5037268e61b0a62ce", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/cc1147cb11af1b43f503ac18f31aa3bec213aba8", + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-php73": "~1.0", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3131,7 +3247,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.2.4" + "source": "https://github.com/symfony/options-resolver/tree/v5.4.3" }, "funding": [ { @@ -3147,32 +3263,35 @@ "type": "tidelift" } ], - "time": "2021-01-27T12:56:27+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.22.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3180,12 +3299,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3210,7 +3329,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" }, "funding": [ { @@ -3226,20 +3345,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.22.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170" + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5601e09b69f26c1828b13b6bb87cb07cddba3170", - "reference": "5601e09b69f26c1828b13b6bb87cb07cddba3170", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", "shasum": "" }, "require": { @@ -3251,7 +3370,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3259,12 +3378,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3291,7 +3410,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" }, "funding": [ { @@ -3307,20 +3426,20 @@ "type": "tidelift" } ], - "time": "2021-01-22T09:19:47+00:00" + "time": "2021-11-23T21:10:46+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.22.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248" + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/43a0283138253ed1d48d352ab6d0bdb3f809f248", - "reference": "43a0283138253ed1d48d352ab6d0bdb3f809f248", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", "shasum": "" }, "require": { @@ -3332,7 +3451,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3340,12 +3459,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -3375,7 +3494,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" }, "funding": [ { @@ -3391,32 +3510,35 @@ "type": "tidelift" } ], - "time": "2021-01-22T09:19:47+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.22.1", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "5232de97ee3b75b0360528dae24e73db49566ab1" + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/5232de97ee3b75b0360528dae24e73db49566ab1", - "reference": "5232de97ee3b75b0360528dae24e73db49566ab1", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3424,12 +3546,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3455,7 +3577,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" }, "funding": [ { @@ -3471,88 +3593,20 @@ "type": "tidelift" } ], - "time": "2021-01-22T09:19:47+00:00" + "time": "2021-11-30T18:21:41+00:00" }, { - "name": "symfony/polyfill-php70", - "version": "v1.20.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644", - "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "metapackage", - "extra": { - "branch-alias": { - "dev-main": "1.20-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php70/tree/v1.20.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-23T14:02:19+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.22.1", + "name": "symfony/polyfill-php73", + "version": "v1.25.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9" + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9", - "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", "shasum": "" }, "require": { @@ -3561,7 +3615,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3569,11 +3623,14 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, "files": [ "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3590,7 +3647,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -3599,7 +3656,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" }, "funding": [ { @@ -3615,20 +3672,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-06-05T21:20:04+00:00" }, { - "name": "symfony/polyfill-php73", - "version": "v1.22.1", + "name": "symfony/polyfill-php80", + "version": "v1.25.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", - "reference": "a678b42e92f86eca04b7fa4c0f6f19d097fb69e2", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", "shasum": "" }, "require": { @@ -3637,7 +3694,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3645,12 +3702,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -3660,6 +3717,10 @@ "MIT" ], "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -3669,7 +3730,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -3678,7 +3739,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" }, "funding": [ { @@ -3694,20 +3755,20 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2022-03-04T08:16:47+00:00" }, { - "name": "symfony/polyfill-php80", - "version": "v1.22.1", + "name": "symfony/polyfill-php81", + "version": "v1.25.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91" + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91", - "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", "shasum": "" }, "require": { @@ -3716,7 +3777,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3724,12 +3785,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -3739,10 +3800,6 @@ "MIT" ], "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -3752,7 +3809,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -3761,7 +3818,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.1" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" }, "funding": [ { @@ -3777,25 +3834,25 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-09-13T13:58:11+00:00" }, { "name": "symfony/process", - "version": "v5.2.7", + "version": "v5.4.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "98cb8eeb72e55d4196dd1e36f1f16e7b3a9a088e" + "reference": "95440409896f90a5f85db07a32b517ecec17fa4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/98cb8eeb72e55d4196dd1e36f1f16e7b3a9a088e", - "reference": "98cb8eeb72e55d4196dd1e36f1f16e7b3a9a088e", + "url": "https://api.github.com/repos/symfony/process/zipball/95440409896f90a5f85db07a32b517ecec17fa4c", + "reference": "95440409896f90a5f85db07a32b517ecec17fa4c", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-php80": "^1.16" }, "type": "library", "autoload": { @@ -3823,7 +3880,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.3.0-BETA1" + "source": "https://github.com/symfony/process/tree/v5.4.5" }, "funding": [ { @@ -3839,25 +3896,29 @@ "type": "tidelift" } ], - "time": "2021-04-08T10:27:02+00:00" + "time": "2022-01-30T18:16:22+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.4.0", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.1" + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -3865,7 +3926,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -3902,7 +3963,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.0" }, "funding": [ { @@ -3918,25 +3979,25 @@ "type": "tidelift" } ], - "time": "2021-04-01T10:43:52+00:00" + "time": "2021-11-04T16:48:04+00:00" }, { "name": "symfony/stopwatch", - "version": "v5.2.7", + "version": "v5.4.5", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "d99310c33e833def36419c284f60e8027d359678" + "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/d99310c33e833def36419c284f60e8027d359678", - "reference": "d99310c33e833def36419c284f60e8027d359678", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", + "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", "shasum": "" }, "require": { "php": ">=7.2.5", - "symfony/service-contracts": "^1.0|^2" + "symfony/service-contracts": "^1|^2|^3" }, "type": "library", "autoload": { @@ -3964,7 +4025,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.3.0-BETA1" + "source": "https://github.com/symfony/stopwatch/tree/v5.4.5" }, "funding": [ { @@ -3980,20 +4041,20 @@ "type": "tidelift" } ], - "time": "2021-03-29T15:28:41+00:00" + "time": "2022-02-18T16:06:09+00:00" }, { "name": "symfony/string", - "version": "v5.2.6", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572" + "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572", - "reference": "ad0bd91bce2054103f5eaa18ebeba8d3bc2a0572", + "url": "https://api.github.com/repos/symfony/string/zipball/92043b7d8383e48104e411bc9434b260dbeb5a10", + "reference": "92043b7d8383e48104e411bc9434b260dbeb5a10", "shasum": "" }, "require": { @@ -4004,20 +4065,23 @@ "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php80": "~1.15" }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/var-exporter": "^4.4|^5.0|^6.0" }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -4047,7 +4111,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.2.6" + "source": "https://github.com/symfony/string/tree/v5.4.3" }, "funding": [ { @@ -4063,20 +4127,20 @@ "type": "tidelift" } ], - "time": "2021-03-17T17:12:15+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { @@ -4105,7 +4169,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/master" + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" }, "funding": [ { @@ -4113,7 +4177,7 @@ "type": "github" } ], - "time": "2020-07-12T23:59:07+00:00" + "time": "2021-07-28T10:34:58+00:00" }, { "name": "webmozart/assert", @@ -4183,5 +4247,5 @@ "php": ">=7.4 || >=8.0" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.2.0" } diff --git a/phpstan.neon b/phpstan.neon new file mode 100755 index 0000000..8b4dc29 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,5 @@ +parameters: + level: 7 + paths: + - src/ + - test/ From cda95d2ecc0c3cc6f73b43d118e85e61ce53cae6 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Sun, 6 Mar 2022 16:29:30 +0000 Subject: [PATCH 12/14] Resolve various inspection failures fopr DatTimeFactory and DateTimeZoneFactory --- src/DateTimeFactory.php | 10 ++++++++-- src/DateTimeZoneFactory.php | 6 +++++- test/unit/DateTimeFactoryTest.php | 8 ++++---- test/unit/DateTimeZoneFactoryTest.php | 4 ++-- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/DateTimeFactory.php b/src/DateTimeFactory.php index aa9b39b..eeb1233 100755 --- a/src/DateTimeFactory.php +++ b/src/DateTimeFactory.php @@ -58,8 +58,14 @@ public function __construct( */ public function createDateTime(?string $spec = null, $timeZone = null): \DateTimeInterface { + $dateTimeZone = $this->resolveDateTimeZone($timeZone); + try { - return new $this->dateTimeClassName($spec ?? 'now', $this->resolveDateTimeZone($timeZone)); + /** @var \DateTimeInterface $dateTime */ + /** @noinspection PhpUnnecessaryLocalVariableInspection */ + /** @noinspection OneTimeUseVariablesInspection */ + $dateTime = new $this->dateTimeClassName($spec ?? 'now', $dateTimeZone); + return $dateTime; } catch (\Exception $e) { throw new DateTimeFactoryException( sprintf( @@ -89,7 +95,7 @@ public function createFromFormat(string $format, string $spec, $timeZone = null) $dateTime = $factory($format, $spec, $this->resolveDateTimeZone($timeZone)); - if (false === $dateTime || !$dateTime instanceof \DateTimeInterface) { + if (!$dateTime instanceof \DateTimeInterface) { throw new DateTimeFactoryException( sprintf( 'Failed to create a valid \DateTime instance using \'%s\' and format \'%s\'', diff --git a/src/DateTimeZoneFactory.php b/src/DateTimeZoneFactory.php index c1ca28a..9a02976 100755 --- a/src/DateTimeZoneFactory.php +++ b/src/DateTimeZoneFactory.php @@ -46,7 +46,11 @@ public function __construct(string $dateTimeZoneClassName = null) public function createDateTimeZone(string $spec): \DateTimeZone { try { - return new $this->dateTimeZoneClassName($spec); + /** @var \DateTimeZone $dateTimeZone */ + /** @noinspection PhpUnnecessaryLocalVariableInspection */ + /** @noinspection OneTimeUseVariablesInspection */ + $dateTimeZone = new $this->dateTimeZoneClassName($spec); + return $dateTimeZone; } catch (\Exception $e) { throw new DateTimeZoneFactoryException( sprintf( diff --git a/test/unit/DateTimeFactoryTest.php b/test/unit/DateTimeFactoryTest.php index e528d4a..d67638a 100755 --- a/test/unit/DateTimeFactoryTest.php +++ b/test/unit/DateTimeFactoryTest.php @@ -90,7 +90,7 @@ public function testCreateDateTime(?string $spec, $timeZone = null): void } /** - * @return array + * @return array */ public function getCreateDateTimeData(): array { @@ -223,7 +223,7 @@ public function testCreateFromFormatWillThrowDateTimeFactoryExceptionForInvalidD } /** - * @return array + * @return array */ public function getCreateFromFormatWillThrowDateTimeFactoryExceptionForInvalidDateTimeData(): array { @@ -294,7 +294,7 @@ public function testCreateFromFormat(string $format, string $spec, $timeZone = n /** @var \DateTimeInterface $expectedDateTime */ $expectedDateTime = \DateTime::createFromFormat( $format, - $spec ?? 'now', + $spec, $dateTimeZone ); @@ -304,7 +304,7 @@ public function testCreateFromFormat(string $format, string $spec, $timeZone = n /** * @see https://www.php.net/manual/en/timezones.europe.php * - * @return array + * @return array */ public function getCreateFromFormatData(): array { diff --git a/test/unit/DateTimeZoneFactoryTest.php b/test/unit/DateTimeZoneFactoryTest.php index eeafdad..7f1be7d 100755 --- a/test/unit/DateTimeZoneFactoryTest.php +++ b/test/unit/DateTimeZoneFactoryTest.php @@ -84,7 +84,7 @@ public function testCreateDateTimeZoneWillThrowDateTimeZoneFactoryExceptionIfSpe } /** - * @return array[] + * @return array */ public function getCreateDateTimeZoneWillThrowDateTimeZoneFactoryExceptionIfSpecIsInvalidData(): array { @@ -119,7 +119,7 @@ public function testCreateDateTimeZone(string $spec): void /** * @see https://www.php.net/manual/en/timezones.europe.php * - * @return array + * @return array */ public function getCreateDateTimeZoneData(): array { From debd77d61850b0d60bd907a064cd5f3bf9776976 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Sun, 6 Mar 2022 23:08:49 +0000 Subject: [PATCH 13/14] Remove all references to the DateIntervalFactoryInterface::diff() method as this will no longer be supported --- src/DateFactory.php | 14 ------- src/DateIntervalFactory.php | 24 +----------- src/DateIntervalFactoryInterface.php | 13 ------- test/unit/DateFactoryTest.php | 24 ------------ test/unit/DateIntervalFactoryTest.php | 53 --------------------------- 5 files changed, 1 insertion(+), 127 deletions(-) diff --git a/src/DateFactory.php b/src/DateFactory.php index 08b5d11..501330c 100755 --- a/src/DateFactory.php +++ b/src/DateFactory.php @@ -96,18 +96,4 @@ public function createDateInterval(string $spec): \DateInterval { return $this->dateIntervalFactory->createDateInterval($spec); } - - /** - * @param \DateTimeInterface $origin - * @param \DateTimeInterface $target - * @param bool $absolute - * - * @return \DateInterval - * - * @throws DateIntervalFactoryException - */ - public function diff(\DateTimeInterface $origin, \DateTimeInterface $target, bool $absolute = false): \DateInterval - { - return $this->dateIntervalFactory->diff($origin, $target, $absolute); - } } diff --git a/src/DateIntervalFactory.php b/src/DateIntervalFactory.php index fbfb3c5..176f067 100755 --- a/src/DateIntervalFactory.php +++ b/src/DateIntervalFactory.php @@ -27,7 +27,7 @@ public function createDateInterval(string $spec): \DateInterval { try { return new \DateInterval($spec); - } catch (\Throwable $e) { + } catch (\Exception $e) { $exceptionMessage = sprintf( 'Failed to create a valid \DateInterval instance using \'%s\': %s', $spec, @@ -36,26 +36,4 @@ public function createDateInterval(string $spec): \DateInterval throw new DateIntervalFactoryException($exceptionMessage, $e->getCode(), $e); } } - - /** - * Perform a diff of two dates and return the \DateInterval - * - * @param \DateTimeInterface $origin The origin date - * @param \DateTimeInterface $target The date to compare to - * @param bool $absolute If the interval is negative force it to be a positive value - * - * @return \DateInterval - * - * @throws DateIntervalFactoryException If the date diff cannot be performed - */ - public function diff(\DateTimeInterface $origin, \DateTimeInterface $target, bool $absolute = false): \DateInterval - { - $dateInterval = $origin->diff($target, $absolute); - - if (!$dateInterval instanceof \DateInterval) { - throw new DateIntervalFactoryException('Failed to create valid \DateInterval while performing date diff'); - } - - return $dateInterval; - } } diff --git a/src/DateIntervalFactoryInterface.php b/src/DateIntervalFactoryInterface.php index 6ebecfd..1c1efae 100755 --- a/src/DateIntervalFactoryInterface.php +++ b/src/DateIntervalFactoryInterface.php @@ -22,17 +22,4 @@ interface DateIntervalFactoryInterface * @throws DateIntervalFactoryException If the date interval cannot be created */ public function createDateInterval(string $spec): \DateInterval; - - /** - * Perform a diff of two dates and return the \DateInterval - * - * @param \DateTimeInterface $origin The origin date - * @param \DateTimeInterface $target The date to compare to - * @param bool $absolute If the interval is negative force it to be a positive value - * - * @return \DateInterval - * - * @throws DateIntervalFactoryException If the date diff cannot be performed - */ - public function diff(\DateTimeInterface $origin, \DateTimeInterface $target, bool $absolute = false): \DateInterval; } diff --git a/test/unit/DateFactoryTest.php b/test/unit/DateFactoryTest.php index 5803031..7204895 100755 --- a/test/unit/DateFactoryTest.php +++ b/test/unit/DateFactoryTest.php @@ -147,28 +147,4 @@ public function testCreateDateIntervalWillProxyToDateTimeIntervalFactory(): void $this->assertSame($dateInterval, $factory->createDateInterval($spec)); } - - /** - * Assert the calls to diff() will proxy to the internal DateTimeIntervalFactory - * - * @throws DateIntervalFactoryException - * @throws DateTimeFactoryException - */ - public function testDiffWillProxyToDateTimeIntervalFactory(): void - { - $factory = new DateFactory($this->dateTimeFactory, $this->dateTimeZoneFactory, $this->dateIntervalFactory); - - $origin = new \DateTime('2021-01-01'); - $target = new \DateTime('2021-01-10 13:14:15'); - $absolute = false; - - $dateDiff = $origin->diff($target, $absolute); - - $this->dateIntervalFactory->expects($this->once()) - ->method('diff') - ->with($origin, $target, $absolute) - ->willReturn($dateDiff); - - $this->assertSame($dateDiff, $factory->diff($origin, $target, $absolute)); - } } diff --git a/test/unit/DateIntervalFactoryTest.php b/test/unit/DateIntervalFactoryTest.php index 71b6f57..81e8782 100755 --- a/test/unit/DateIntervalFactoryTest.php +++ b/test/unit/DateIntervalFactoryTest.php @@ -7,7 +7,6 @@ use Arp\DateTime\DateIntervalFactory; use Arp\DateTime\DateIntervalFactoryInterface; use Arp\DateTime\Exception\DateIntervalFactoryException; -use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -106,56 +105,4 @@ public function getCreateDateIntervalWillThrowDateIntervalFactoryExceptionData() ['invalid'], ]; } - - /** - * Assert that a DateIntervalFactoryException is thrown when the date diff fails - * - * @throws DateIntervalFactoryException - */ - public function testDiffWillThrowDateIntervalFactoryExceptionIfDateIntervalCannotBeCreated(): void - { - $factory = new DateIntervalFactory(); - - /** @var \DateTime&MockObject $target */ - $target = $this->createMock(\DateTime::class); - - /** @var \DateTime&MockObject $origin */ - $origin = $this->createMock(\DateTime::class); - - $origin->expects($this->once()) - ->method('diff') - ->with($target, false) - ->willReturn(false); - - $this->expectException(DateIntervalFactoryException::class); - $this->expectExceptionMessage('Failed to create valid \DateInterval while performing date diff'); - - $factory->diff($origin, $target); - } - - /** - * Assert that a valid \DateInterval is returned from the calls to diff() - * - * @throws DateIntervalFactoryException - */ - public function testDiffWillReturnValidDateInterval(): void - { - $factory = new DateIntervalFactory(); - - /** @var \DateTime&MockObject $target */ - $target = $this->createMock(\DateTime::class); - - /** @var \DateTime&MockObject $origin */ - $origin = $this->createMock(\DateTime::class); - - /** @var \DateInterval&MockObject $dateInterval */ - $dateInterval = $this->createMock(\DateInterval::class); - - $origin->expects($this->once()) - ->method('diff') - ->with($target, false) - ->willReturn($dateInterval); - - $this->assertSame($dateInterval, $factory->diff($origin, $target)); - } } From 7b83c28ba2cd511790ea6590aaa228289ba3ff98 Mon Sep 17 00:00:00 2001 From: Alex Patterson Date: Sun, 6 Mar 2022 23:13:57 +0000 Subject: [PATCH 14/14] Updated exception condition check for DateIntervalFactoryTest and DateTimeFactoryTest as these have changed in PHP 8+ --- test/unit/DateIntervalFactoryTest.php | 7 ++----- test/unit/DateTimeFactoryTest.php | 11 ++--------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/test/unit/DateIntervalFactoryTest.php b/test/unit/DateIntervalFactoryTest.php index 81e8782..0b5f883 100755 --- a/test/unit/DateIntervalFactoryTest.php +++ b/test/unit/DateIntervalFactoryTest.php @@ -81,14 +81,11 @@ public function testCreateDateIntervalWillThrowDateIntervalFactoryException(stri { $factory = new DateIntervalFactory(); - $exceptionMessage = sprintf('DateInterval::__construct(): Unknown or bad format (%s)', $spec); - $this->expectException(DateIntervalFactoryException::class); $this->expectExceptionMessage( sprintf( - 'Failed to create a valid \DateInterval instance using \'%s\': %s', - $spec, - $exceptionMessage + 'Failed to create a valid \DateInterval instance using \'%s\':', + $spec ) ); diff --git a/test/unit/DateTimeFactoryTest.php b/test/unit/DateTimeFactoryTest.php index d67638a..9ddbbb2 100755 --- a/test/unit/DateTimeFactoryTest.php +++ b/test/unit/DateTimeFactoryTest.php @@ -141,18 +141,11 @@ public function testCreateDateTimeWillThrowDateTimeFactoryExceptionForInvalidDat $spec = 'foo'; // invalid argument - $exceptionMessage = sprintf( - 'DateTime::__construct(): Failed to parse time string (%s) at position 0 (%s)', - $spec, - $spec[0] - ); - $this->expectException(DateTimeFactoryException::class); $this->expectExceptionMessage( sprintf( - 'Failed to create a valid \DateTime instance using \'%s\': %s', - $spec, - $exceptionMessage + 'Failed to create a valid \DateTime instance using \'%s\':', + $spec ) );