Skip to content

Commit

Permalink
feat: upgrade dependencies to support PHP8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Dec 11, 2023
1 parent c5e6003 commit ab50736
Show file tree
Hide file tree
Showing 333 changed files with 6,573 additions and 3,312 deletions.
503 changes: 318 additions & 185 deletions composer.lock

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

// autoload.php @generated by Composer

if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit9436c8305ecc1c29f9d13c239b2e3d81::getLoader();
10 changes: 6 additions & 4 deletions vendor/bin/carbon
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ if (PHP_VERSION_ID < 80000) {
}
}

if (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) {
include("phpvfscomposer://" . __DIR__ . '/..'.'/nesbot/carbon/bin/carbon');
exit(0);
if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/nesbot/carbon/bin/carbon');
}
}

include __DIR__ . '/..'.'/nesbot/carbon/bin/carbon';
return include __DIR__ . '/..'.'/nesbot/carbon/bin/carbon';
21 changes: 21 additions & 0 deletions vendor/carbonphp/carbon-doctrine-types/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Carbon

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
14 changes: 14 additions & 0 deletions vendor/carbonphp/carbon-doctrine-types/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# carbonphp/carbon-doctrine-types

Types to use Carbon in Doctrine

## Documentation

[Check how to use in the official Carbon documentation](https://carbon.nesbot.com/symfony/)

This package is an externalization of [src/Carbon/Doctrine](https://github.com/briannesbitt/Carbon/tree/2.71.0/src/Carbon/Doctrine)
from `nestbot/carbon` package.

Externalization allows to better deal with different versions of dbal. With
version 4.0 of dbal, it no longer sustainable to be compatible with all version
using a single code.
36 changes: 36 additions & 0 deletions vendor/carbonphp/carbon-doctrine-types/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "carbonphp/carbon-doctrine-types",
"description": "Types to use Carbon in Doctrine",
"type": "library",
"keywords": [
"date",
"time",
"DateTime",
"Carbon",
"Doctrine"
],
"require": {
"php": "^7.4 || ^8.0"
},
"require-dev": {
"doctrine/dbal": "^3.7.0",
"nesbot/carbon": "^2.71.0 || ^3.0.0",
"phpunit/phpunit": "^10.3"
},
"conflict": {
"doctrine/dbal": "<3.7.0 || >=4.0.0"
},
"license": "MIT",
"autoload": {
"psr-4": {
"Carbon\\Doctrine\\": "src/Carbon/Doctrine/"
}
},
"authors": [
{
"name": "KyleKatarn",
"email": "kylekatarnls@gmail.com"
}
],
"minimum-stability": "dev"
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<?php

/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Carbon\Doctrine;

use Doctrine\DBAL\Platforms\AbstractPlatform;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Carbon\Doctrine;

class CarbonImmutableType extends DateTimeImmutableType implements CarbonDoctrineType
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Carbon\Doctrine;

class CarbonType extends DateTimeType implements CarbonDoctrineType
{
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<?php

/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Carbon\Doctrine;

use Carbon\Carbon;
Expand All @@ -23,6 +14,14 @@
*/
trait CarbonTypeConverter
{
/**
* This property differentiates types installed by carbonphp/carbon-doctrine-types
* from the ones embedded previously in nesbot/carbon source directly.
*
* @readonly
*/
public bool $external = true;

/**
* @return class-string<T>
*/
Expand All @@ -31,20 +30,9 @@ protected function getCarbonClassName(): string
return Carbon::class;
}

/**
* @return string
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string
{
$precision = $fieldDeclaration['precision'] ?: 10;

if ($fieldDeclaration['secondPrecision'] ?? false) {
$precision = 0;
}

if ($precision === 10) {
$precision = DateTimeDefaultPrecision::get();
}
$precision = $fieldDeclaration['precision'] ?? DateTimeDefaultPrecision::get();

$type = parent::getSQLDeclaration($fieldDeclaration, $platform);

Expand Down Expand Up @@ -90,7 +78,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform)
if (!$date) {
throw ConversionException::conversionFailedFormat(
$value,
$this->getName(),
$this->getTypeName(),
'Y-m-d H:i:s.u or any format supported by '.$class.'::parse()',
$error
);
Expand All @@ -101,10 +89,8 @@ public function convertToPHPValue($value, AbstractPlatform $platform)

/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return string|null
*/
public function convertToDatabaseValue($value, AbstractPlatform $platform)
public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string
{
if ($value === null) {
return $value;
Expand All @@ -116,8 +102,16 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform)

throw ConversionException::conversionFailedInvalidType(
$value,
$this->getName(),
$this->getTypeName(),
['null', 'DateTime', 'Carbon']
);
}

private function getTypeName(): string
{
$chunks = explode('\\', static::class);
$type = preg_replace('/Type$/', '', end($chunks));

return strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $type));
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<?php

/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Carbon\Doctrine;

class DateTimeDefaultPrecision
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* Thanks to https://github.com/flaushi for his suggestion:
* https://github.com/doctrine/dbal/issues/2873#issuecomment-534956358
*/
namespace Carbon\Doctrine;

use Carbon\CarbonImmutable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

/**
* Thanks to https://github.com/flaushi for his suggestion:
* https://github.com/doctrine/dbal/issues/2873#issuecomment-534956358
*/
namespace Carbon\Doctrine;

use Carbon\Carbon;
Expand Down

0 comments on commit ab50736

Please sign in to comment.