Initialize Nest types library.
This commit is contained in:
commit
b18a91301c
18 changed files with 1076 additions and 0 deletions
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
# IDEA
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
# Composer
|
||||
vendor/
|
28
composer.json
Normal file
28
composer.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"version": "1.0",
|
||||
"name": "nest/types",
|
||||
"description": "Nest types implementation.",
|
||||
"type": "library",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Madeorsk",
|
||||
"email": "madeorsk@protonmail.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Nest\\Types\\": "src/"
|
||||
}
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://code.zeptotech.net/Nest/Core"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^8.3",
|
||||
"nest/core": "dev-main",
|
||||
"nesbot/carbon": "^3.8"
|
||||
}
|
||||
}
|
681
composer.lock
generated
Normal file
681
composer.lock
generated
Normal file
|
@ -0,0 +1,681 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "1d5fc4ac29420e3a75572e93b02d535b",
|
||||
"packages": [
|
||||
{
|
||||
"name": "carbonphp/carbon-doctrine-types",
|
||||
"version": "3.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/CarbonPHP/carbon-doctrine-types.git",
|
||||
"reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/18ba5ddfec8976260ead6e866180bd5d2f71aa1d",
|
||||
"reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.1"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/dbal": "<4.0.0 || >=5.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/dbal": "^4.0.0",
|
||||
"nesbot/carbon": "^2.71.0 || ^3.0.0",
|
||||
"phpunit/phpunit": "^10.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Carbon\\Doctrine\\": "src/Carbon/Doctrine/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "KyleKatarn",
|
||||
"email": "kylekatarnls@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Types to use Carbon in Doctrine",
|
||||
"keywords": [
|
||||
"carbon",
|
||||
"date",
|
||||
"datetime",
|
||||
"doctrine",
|
||||
"time"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues",
|
||||
"source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/3.2.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/kylekatarnls",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://opencollective.com/Carbon",
|
||||
"type": "open_collective"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/nesbot/carbon",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-02-09T16:56:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "3.8.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/briannesbitt/Carbon.git",
|
||||
"reference": "e1268cdbc486d97ce23fef2c666dc3c6b6de9947"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/e1268cdbc486d97ce23fef2c666dc3c6b6de9947",
|
||||
"reference": "e1268cdbc486d97ce23fef2c666dc3c6b6de9947",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"carbonphp/carbon-doctrine-types": "<100.0",
|
||||
"ext-json": "*",
|
||||
"php": "^8.1",
|
||||
"psr/clock": "^1.0",
|
||||
"symfony/clock": "^6.3 || ^7.0",
|
||||
"symfony/polyfill-mbstring": "^1.0",
|
||||
"symfony/translation": "^4.4.18 || ^5.2.1|| ^6.0 || ^7.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/clock-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/dbal": "^3.6.3 || ^4.0",
|
||||
"doctrine/orm": "^2.15.2 || ^3.0",
|
||||
"friendsofphp/php-cs-fixer": "^3.57.2",
|
||||
"kylekatarnls/multi-tester": "^2.5.3",
|
||||
"ondrejmirtes/better-reflection": "^6.25.0.4",
|
||||
"phpmd/phpmd": "^2.15.0",
|
||||
"phpstan/extension-installer": "^1.3.1",
|
||||
"phpstan/phpstan": "^1.11.2",
|
||||
"phpunit/phpunit": "^10.5.20",
|
||||
"squizlabs/php_codesniffer": "^3.9.0"
|
||||
},
|
||||
"bin": [
|
||||
"bin/carbon"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.x-dev",
|
||||
"dev-2.x": "2.x-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Carbon\\Laravel\\ServiceProvider"
|
||||
]
|
||||
},
|
||||
"phpstan": {
|
||||
"includes": [
|
||||
"extension.neon"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Carbon\\": "src/Carbon/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Brian Nesbitt",
|
||||
"email": "brian@nesbot.com",
|
||||
"homepage": "https://markido.com"
|
||||
},
|
||||
{
|
||||
"name": "kylekatarnls",
|
||||
"homepage": "https://github.com/kylekatarnls"
|
||||
}
|
||||
],
|
||||
"description": "An API extension for DateTime that supports 281 different languages.",
|
||||
"homepage": "https://carbon.nesbot.com",
|
||||
"keywords": [
|
||||
"date",
|
||||
"datetime",
|
||||
"time"
|
||||
],
|
||||
"support": {
|
||||
"docs": "https://carbon.nesbot.com/docs",
|
||||
"issues": "https://github.com/briannesbitt/Carbon/issues",
|
||||
"source": "https://github.com/briannesbitt/Carbon"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/sponsors/kylekatarnls",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://opencollective.com/Carbon#sponsor",
|
||||
"type": "opencollective"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-07T17:46:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nest/core",
|
||||
"version": "dev-main",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://code.zeptotech.net/Nest/Core",
|
||||
"reference": "22296b8d7c8b528089189a8d9500395424cb6468"
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.3"
|
||||
},
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Nest\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/Utils/Array.php",
|
||||
"src/Utils/Paths.php",
|
||||
"src/Utils/Reflection.php",
|
||||
"src/Utils/String.php"
|
||||
]
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Madeorsk",
|
||||
"email": "madeorsk@protonmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Nest framework core.",
|
||||
"time": "2024-11-08T11:12:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/clock",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/clock.git",
|
||||
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d",
|
||||
"reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.0 || ^8.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Clock\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "https://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for reading the clock.",
|
||||
"homepage": "https://github.com/php-fig/clock",
|
||||
"keywords": [
|
||||
"clock",
|
||||
"now",
|
||||
"psr",
|
||||
"psr-20",
|
||||
"time"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-fig/clock/issues",
|
||||
"source": "https://github.com/php-fig/clock/tree/1.0.0"
|
||||
},
|
||||
"time": "2022-11-25T14:36:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/clock",
|
||||
"version": "v7.1.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/clock.git",
|
||||
"reference": "97bebc53548684c17ed696bc8af016880f0f098d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/clock/zipball/97bebc53548684c17ed696bc8af016880f0f098d",
|
||||
"reference": "97bebc53548684c17ed696bc8af016880f0f098d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"psr/clock": "^1.0",
|
||||
"symfony/polyfill-php83": "^1.28"
|
||||
},
|
||||
"provide": {
|
||||
"psr/clock-implementation": "1.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"Resources/now.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Clock\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"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": "Decouples applications from the system clock",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"clock",
|
||||
"psr20",
|
||||
"time"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/clock/tree/v7.1.6"
|
||||
},
|
||||
"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": "2024-09-25T14:20:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341",
|
||||
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"provide": {
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "For best performance"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Mbstring\\": ""
|
||||
}
|
||||
},
|
||||
"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 for the Mbstring extension",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"mbstring",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.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": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php83",
|
||||
"version": "v1.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php83.git",
|
||||
"reference": "2fb86d65e2d424369ad2905e83b236a8805ba491"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/2fb86d65e2d424369ad2905e83b236a8805ba491",
|
||||
"reference": "2fb86d65e2d424369ad2905e83b236a8805ba491",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php83\\": ""
|
||||
},
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"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 8.3+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php83/tree/v1.31.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": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v7.1.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation.git",
|
||||
"reference": "b9f72ab14efdb6b772f85041fa12f820dee8d55f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/b9f72ab14efdb6b772f85041fa12f820dee8d55f",
|
||||
"reference": "b9f72ab14efdb6b772f85041fa12f820dee8d55f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"symfony/polyfill-mbstring": "~1.0",
|
||||
"symfony/translation-contracts": "^2.5|^3.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/config": "<6.4",
|
||||
"symfony/console": "<6.4",
|
||||
"symfony/dependency-injection": "<6.4",
|
||||
"symfony/http-client-contracts": "<2.5",
|
||||
"symfony/http-kernel": "<6.4",
|
||||
"symfony/service-contracts": "<2.5",
|
||||
"symfony/twig-bundle": "<6.4",
|
||||
"symfony/yaml": "<6.4"
|
||||
},
|
||||
"provide": {
|
||||
"symfony/translation-implementation": "2.3|3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"nikic/php-parser": "^4.18|^5.0",
|
||||
"psr/log": "^1|^2|^3",
|
||||
"symfony/config": "^6.4|^7.0",
|
||||
"symfony/console": "^6.4|^7.0",
|
||||
"symfony/dependency-injection": "^6.4|^7.0",
|
||||
"symfony/finder": "^6.4|^7.0",
|
||||
"symfony/http-client-contracts": "^2.5|^3.0",
|
||||
"symfony/http-kernel": "^6.4|^7.0",
|
||||
"symfony/intl": "^6.4|^7.0",
|
||||
"symfony/polyfill-intl-icu": "^1.21",
|
||||
"symfony/routing": "^6.4|^7.0",
|
||||
"symfony/service-contracts": "^2.5|^3",
|
||||
"symfony/yaml": "^6.4|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"Resources/functions.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Translation\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Provides tools to internationalize your application",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/translation/tree/v7.1.6"
|
||||
},
|
||||
"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": "2024-09-28T12:35:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation-contracts",
|
||||
"version": "v3.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation-contracts.git",
|
||||
"reference": "b9d2189887bb6b2e0367a9fc7136c5239ab9b05a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/b9d2189887bb6b2e0367a9fc7136c5239ab9b05a",
|
||||
"reference": "b9d2189887bb6b2e0367a9fc7136c5239ab9b05a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Contracts\\Translation\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Test/"
|
||||
]
|
||||
},
|
||||
"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": "Generic abstractions related to translation",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"abstractions",
|
||||
"contracts",
|
||||
"decoupling",
|
||||
"interfaces",
|
||||
"interoperability",
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/translation-contracts/tree/v3.5.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": "2024-04-18T09:32:20+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {
|
||||
"nest/core": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": "^8.3"
|
||||
},
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
40
src/Definitions/CarbonType.php
Normal file
40
src/Definitions/CarbonType.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types\Definitions;
|
||||
|
||||
use Nest\Types\Exceptions\InvalidSerializedValueException;
|
||||
use Nest\Types\Exceptions\InvalidStoredValueException;
|
||||
use Carbon\Carbon;
|
||||
use DateTimeInterface;
|
||||
use Override;
|
||||
|
||||
class CarbonType extends DateTimeType
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws InvalidSerializedValueException
|
||||
*/
|
||||
#[Override] public function deserialize(float|object|int|array|string $value): Carbon
|
||||
{
|
||||
if (!is_string($value))
|
||||
throw new InvalidSerializedValueException($this, $value);
|
||||
|
||||
return Carbon::createFromFormat(DateTimeInterface::ATOM, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws InvalidStoredValueException
|
||||
*/
|
||||
#[Override] public function fromSql(array|int|string $value): Carbon
|
||||
{
|
||||
if (is_array($value))
|
||||
throw new InvalidStoredValueException($this, $value);
|
||||
|
||||
if (is_int($value))
|
||||
// If it's an integer, we suppose that it's a unix timestamp.
|
||||
Carbon::createFromFormat("U", "$value");
|
||||
|
||||
return Carbon::createFromFormat(static::SQL_FORMAT, $value);
|
||||
}
|
||||
}
|
75
src/Definitions/DateTimeType.php
Normal file
75
src/Definitions/DateTimeType.php
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types\Definitions;
|
||||
|
||||
use Nest\Types\Exceptions\InvalidSerializedValueException;
|
||||
use Nest\Types\Exceptions\InvalidStoredValueException;
|
||||
use Nest\Types\Exceptions\ValueNotSerializableException;
|
||||
use Nest\Types\Exceptions\ValueNotStorableException;
|
||||
use Nest\Types\SerializableType;
|
||||
use Nest\Types\SqlType;
|
||||
use Nest\Types\Type;
|
||||
use DateTime;
|
||||
use DateTimeInterface;
|
||||
use Override;
|
||||
|
||||
class DateTimeType extends Type implements SerializableType, SqlType
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws ValueNotSerializableException
|
||||
*/
|
||||
#[Override] public function serialize(mixed $value): string
|
||||
{
|
||||
if (!($value instanceof DateTimeInterface))
|
||||
throw new ValueNotSerializableException($this, $value);
|
||||
|
||||
return $value->format(DateTimeInterface::ATOM);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws InvalidSerializedValueException
|
||||
*/
|
||||
#[Override] public function deserialize(float|object|int|array|string $value): DateTime
|
||||
{
|
||||
if (!is_string($value))
|
||||
throw new InvalidSerializedValueException($this, $value);
|
||||
|
||||
return DateTime::createFromFormat(DateTimeInterface::ATOM, $value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SQL datetime format.
|
||||
*/
|
||||
public const string SQL_FORMAT = "Y-m-d H:i:sO";
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws ValueNotStorableException
|
||||
*/
|
||||
#[Override] public function toSql(mixed $value): string
|
||||
{
|
||||
if (!($value instanceof DateTimeInterface))
|
||||
throw new ValueNotStorableException($this, $value);
|
||||
|
||||
return $value->format(static::SQL_FORMAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws InvalidStoredValueException
|
||||
*/
|
||||
#[Override] public function fromSql(array|int|string $value): DateTime
|
||||
{
|
||||
if (is_array($value))
|
||||
throw new InvalidStoredValueException($this, $value);
|
||||
|
||||
if (is_int($value))
|
||||
// If it's an integer, we suppose that it's a unix timestamp.
|
||||
DateTime::createFromFormat("U", "$value");
|
||||
|
||||
return DateTime::createFromFormat(static::SQL_FORMAT, $value);
|
||||
}
|
||||
}
|
7
src/Definitions/Integers/BigintType.php
Normal file
7
src/Definitions/Integers/BigintType.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types\Definitions\Integers;
|
||||
|
||||
class BigintType extends IntType
|
||||
{
|
||||
}
|
53
src/Definitions/Integers/IntType.php
Normal file
53
src/Definitions/Integers/IntType.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types\Definitions\Integers;
|
||||
|
||||
use Nest\Types\Exceptions\InvalidSerializedValueException;
|
||||
use Nest\Types\Exceptions\InvalidStoredValueException;
|
||||
use Nest\Types\SerializableType;
|
||||
use Nest\Types\SqlType;
|
||||
use Nest\Types\Type;
|
||||
use Override;
|
||||
|
||||
class IntType extends Type implements SerializableType, SqlType
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[Override] public function serialize(mixed $value): int
|
||||
{
|
||||
return intval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws InvalidSerializedValueException
|
||||
*/
|
||||
#[Override] public function deserialize(float|object|int|array|string $value): int
|
||||
{
|
||||
if (!is_int($value))
|
||||
throw new InvalidSerializedValueException($this, $value);
|
||||
|
||||
return intval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[Override] public function toSql(mixed $value): int
|
||||
{
|
||||
return intval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws InvalidStoredValueException
|
||||
*/
|
||||
#[Override] public function fromSql(array|int|string $value): int
|
||||
{
|
||||
if (is_array($value))
|
||||
throw new InvalidStoredValueException($this, $value);
|
||||
|
||||
return intval($value);
|
||||
}
|
||||
}
|
7
src/Definitions/Integers/TinyintType.php
Normal file
7
src/Definitions/Integers/TinyintType.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types\Definitions\Integers;
|
||||
|
||||
class TinyintType extends IntType
|
||||
{
|
||||
}
|
53
src/Definitions/StringType.php
Normal file
53
src/Definitions/StringType.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types\Definitions;
|
||||
|
||||
use Nest\Types\Exceptions\InvalidSerializedValueException;
|
||||
use Nest\Types\Exceptions\InvalidStoredValueException;
|
||||
use Nest\Types\SerializableType;
|
||||
use Nest\Types\SqlType;
|
||||
use Nest\Types\Type;
|
||||
use Override;
|
||||
|
||||
class StringType extends Type implements SerializableType, SqlType
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[Override] public function serialize(mixed $value): string
|
||||
{
|
||||
return (string) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws InvalidSerializedValueException
|
||||
*/
|
||||
#[Override] public function deserialize(float|object|int|array|string $value): string
|
||||
{
|
||||
if (!is_string($value))
|
||||
throw new InvalidSerializedValueException($this, $value);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[Override] public function toSql(mixed $value): string
|
||||
{
|
||||
return (string) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws InvalidStoredValueException
|
||||
*/
|
||||
#[Override] public function fromSql(array|int|string $value): string
|
||||
{
|
||||
if (is_array($value))
|
||||
throw new InvalidStoredValueException($this, $value);
|
||||
|
||||
return (string) $value;
|
||||
}
|
||||
}
|
22
src/Exceptions/IncompatibleTypeException.php
Normal file
22
src/Exceptions/IncompatibleTypeException.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types\Exceptions;
|
||||
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Exception thrown when a given type is incompatible (a required interface is not implemented).
|
||||
*/
|
||||
class IncompatibleTypeException extends TypeException
|
||||
{
|
||||
/**
|
||||
* @param string $typeClass Incompatible type class.
|
||||
* @param string $compatibilityInterface Not implemented interface.
|
||||
* @param int $code [optional] The Exception code.
|
||||
* @param null|Throwable $previous [optional] The previous throwable used for the exception chaining.
|
||||
*/
|
||||
public function __construct(public string $typeClass, public string $compatibilityInterface, int $code = 0, ?Throwable $previous = null)
|
||||
{
|
||||
parent::__construct("$this->typeClass does not implement required compatibility interface: $this->compatibilityInterface", $code, $previous);
|
||||
}
|
||||
}
|
17
src/Exceptions/InvalidSerializedValueException.php
Normal file
17
src/Exceptions/InvalidSerializedValueException.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types\Exceptions;
|
||||
|
||||
use Nest\Types\Type;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Exception for an invalid serialized value given to deserialize.
|
||||
*/
|
||||
class InvalidSerializedValueException extends TypeException
|
||||
{
|
||||
public function __construct(public Type $type, public mixed $value, ?Throwable $previous = null)
|
||||
{
|
||||
parent::__construct("Cannot deserialize value of type ".get_debug_type($this->value)." to ".get_class($this->type), previous: $previous);
|
||||
}
|
||||
}
|
17
src/Exceptions/InvalidStoredValueException.php
Normal file
17
src/Exceptions/InvalidStoredValueException.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types\Exceptions;
|
||||
|
||||
use Nest\Types\Type;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Exception for an invalid stored value given to deserialize.
|
||||
*/
|
||||
class InvalidStoredValueException extends TypeException
|
||||
{
|
||||
public function __construct(public Type $type, public mixed $value, ?Throwable $previous = null)
|
||||
{
|
||||
parent::__construct("Cannot read value of type ".get_debug_type($this->value)." to ".get_class($this->type), previous: $previous);
|
||||
}
|
||||
}
|
9
src/Exceptions/TypeException.php
Normal file
9
src/Exceptions/TypeException.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types\Exceptions;
|
||||
|
||||
use Nest\Exceptions\Exception;
|
||||
|
||||
class TypeException extends Exception
|
||||
{
|
||||
}
|
17
src/Exceptions/ValueNotSerializableException.php
Normal file
17
src/Exceptions/ValueNotSerializableException.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types\Exceptions;
|
||||
|
||||
use Nest\Types\Type;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Exception for an invalid deserialized value given to serialize.
|
||||
*/
|
||||
class ValueNotSerializableException extends TypeException
|
||||
{
|
||||
public function __construct(public Type $type, public mixed $value, ?Throwable $previous = null)
|
||||
{
|
||||
parent::__construct("Cannot serialize value of type ".get_debug_type($this->value)." to ".get_class($this->type), previous: $previous);
|
||||
}
|
||||
}
|
17
src/Exceptions/ValueNotStorableException.php
Normal file
17
src/Exceptions/ValueNotStorableException.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types\Exceptions;
|
||||
|
||||
use Nest\Types\Type;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Exception for an invalid value given to store in a database.
|
||||
*/
|
||||
class ValueNotStorableException extends TypeException
|
||||
{
|
||||
public function __construct(public Type $type, public mixed $value, ?Throwable $previous = null)
|
||||
{
|
||||
parent::__construct("Cannot store value of type ".get_debug_type($this->value)." to ".get_class($this->type), previous: $previous);
|
||||
}
|
||||
}
|
10
src/SerializableType.php
Normal file
10
src/SerializableType.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types;
|
||||
|
||||
interface SerializableType
|
||||
{
|
||||
public function serialize(mixed $value): string|int|float|object|array;
|
||||
|
||||
public function deserialize(string|int|float|object|array $value): mixed;
|
||||
}
|
10
src/SqlType.php
Normal file
10
src/SqlType.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types;
|
||||
|
||||
interface SqlType
|
||||
{
|
||||
public function fromSql(string|int|array $value): mixed;
|
||||
|
||||
public function toSql(mixed $value): string|int|array;
|
||||
}
|
7
src/Type.php
Normal file
7
src/Type.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Nest\Types;
|
||||
|
||||
abstract class Type
|
||||
{
|
||||
}
|
Loading…
Reference in a new issue