Commit 263640a8 by 杨树贤

降级包

parent 28a77aa4
Showing with 5316 additions and 4471 deletions
......@@ -12,7 +12,10 @@
"predis/predis": "^1.1",
"vladimir-yuldashev/laravel-queue-rabbitmq": "5.2",
"maatwebsite/excel": "2.1.0",
"guzzlehttp/guzzle": "6.3"
"guzzlehttp/guzzle": "6.3",
"doctrine/inflector": "1.1.0",
"doctrine/instantiator": "1.0.2",
"phpdocumentor/reflection-docblock": "3.2.2"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
......@@ -55,6 +58,9 @@
},
"config": {
"preferred-install": "dist",
"platform-check": false
"platform-check": false,
"allow-plugins": {
"kylekatarnls/update-helper": true
}
}
}
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5838f7b8ccfd9204e310d51188dd56a7",
"content-hash": "5775f435235f4562361810bcd2f6e059",
"packages": [
{
"name": "classpreloader/classpreloader",
......@@ -107,51 +107,35 @@
},
{
"name": "doctrine/inflector",
"version": "1.3.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/inflector.git",
"reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1"
},
"version": "v1.1.0",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/ec3a55242203ffa6a4b27c58176da97ff0a7aec1",
"reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://mirrors.tencent.com/repository/composer/doctrine/inflector/v1.1.0/doctrine-inflector-v1.1.0.zip",
"reference": "90b2128806bfde671b6952ab8bea493942c1fdae",
"shasum": ""
},
"require": {
"php": "^7.1"
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "^6.2"
"phpunit/phpunit": "4.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector"
"psr-0": {
"Doctrine\\Common\\Inflector\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
......@@ -160,6 +144,10 @@
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
......@@ -176,7 +164,55 @@
"singularize",
"string"
],
"time": "2019-10-30T19:59:35+00:00"
"time": "2015-11-06T14:35:42+00:00"
},
{
"name": "doctrine/instantiator",
"version": "1.0.2",
"dist": {
"type": "zip",
"url": "https://mirrors.tencent.com/repository/composer/doctrine/instantiator/1.0.2/doctrine-instantiator-1.0.2.zip",
"reference": "26404e0c90565b614ee76b988b9bc8790d77f590",
"shasum": ""
},
"require": {
"php": "~5.3"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "2.0.*@ALPHA"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Instantiator\\": "src"
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com",
"homepage": "http://ocramius.github.com/"
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://github.com/doctrine/instantiator",
"keywords": [
"constructor",
"instantiate"
],
"time": "2014-08-25T15:09:25+00:00"
},
{
"name": "guzzlehttp/guzzle",
......@@ -1289,6 +1325,134 @@
"time": "2016-04-11T14:30:01+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "1.0.1",
"dist": {
"type": "zip",
"url": "https://mirrors.tencent.com/repository/composer/phpdocumentor/reflection-common/1.0.1/phpdocumentor-reflection-common-1.0.1.zip",
"reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src"
]
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"time": "2017-09-11T18:02:19+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "3.2.2",
"dist": {
"type": "zip",
"url": "https://mirrors.tencent.com/repository/composer/phpdocumentor/reflection-docblock/3.2.2/phpdocumentor-reflection-docblock-3.2.2.zip",
"reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0@dev",
"phpdocumentor/type-resolver": "^0.3.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^4.4"
},
"type": "library",
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2017-08-08T06:39:58+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "0.3.0",
"dist": {
"type": "zip",
"url": "https://mirrors.tencent.com/repository/composer/phpdocumentor/type-resolver/0.3.0/phpdocumentor-type-resolver-0.3.0.zip",
"reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773",
"shasum": ""
},
"require": {
"php": "^5.5 || ^7.0",
"phpdocumentor/reflection-common": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^5.2||^4.8.24"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"time": "2017-06-03T08:32:36+00:00"
},
{
"name": "phpoffice/phpexcel",
"version": "1.8.2",
"source": {
......@@ -2173,23 +2337,12 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14"
},
"version": "v1.19.0",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
"reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://mirrors.tencent.com/repository/composer/symfony/polyfill-ctype/v1.19.0/symfony-polyfill-ctype-v1.19.0.zip",
"reference": "aed596913b70fae57be53d86faa2e9ef85a2297b",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
......@@ -2200,18 +2353,21 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.15-dev"
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
......@@ -2233,7 +2389,7 @@
"polyfill",
"portable"
],
"time": "2020-02-27T09:26:54+00:00"
"time": "2020-10-23T09:01:57+00:00"
},
{
"name": "symfony/polyfill-mbstring",
......@@ -2855,71 +3011,52 @@
"environment"
],
"time": "2020-04-12T15:11:38+00:00"
}
],
"packages-dev": [
},
{
"name": "doctrine/instantiator",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "ae466f726242e637cebdd526a7d991b9433bacf1"
},
"name": "webmozart/assert",
"version": "1.9.1",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1",
"reference": "ae466f726242e637cebdd526a7d991b9433bacf1",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://mirrors.tencent.com/repository/composer/webmozart/assert/1.9.1/webmozart-assert-1.9.1.zip",
"reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389",
"shasum": ""
},
"require": {
"php": "^7.1"
"php": "^5.3.3 || ^7.0 || ^8.0",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"phpstan/phpstan": "<0.12.20",
"vimeo/psalm": "<3.9.1"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"ext-pdo": "*",
"ext-phar": "*",
"phpbench/phpbench": "^0.13",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-shim": "^0.11",
"phpunit/phpunit": "^7.0"
"phpunit/phpunit": "^4.8.36 || ^7.5.13"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com",
"homepage": "http://ocramius.github.com/"
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"constructor",
"instantiate"
"assert",
"check",
"validate"
],
"time": "2019-10-21T16:45:58+00:00"
},
"time": "2020-07-08T17:02:28+00:00"
}
],
"packages-dev": [
{
"name": "fzaninotto/faker",
"version": "v1.9.1",
......@@ -3100,175 +3237,6 @@
"time": "2019-02-12T16:07:13+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a",
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"phpunit/phpunit": "~6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"time": "2018-08-07T13:53:10+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "4.3.4",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c",
"reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.0",
"phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0",
"phpdocumentor/type-resolver": "~0.4 || ^1.0.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"doctrine/instantiator": "^1.0.5",
"mockery/mockery": "^1.0",
"phpdocumentor/type-resolver": "0.4.*",
"phpunit/phpunit": "^6.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2019-12-28T18:55:12+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.1",
"phpdocumentor/reflection-common": "^2.0"
},
"require-dev": {
"ext-tokenizer": "^7.1",
"mockery/mockery": "~1",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"time": "2019-08-22T18:11:29+00:00"
},
{
"name": "phpspec/prophecy",
"version": "v1.10.3",
"source": {
......@@ -4293,60 +4261,6 @@
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2018-01-20T15:04:53+00:00"
},
{
"name": "webmozart/assert",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/webmozarts/assert.git",
"reference": "aed98a490f9a8f78468232db345ab9cf606cf598"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598",
"reference": "aed98a490f9a8f78468232db345ab9cf606cf598",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^5.3.3 || ^7.0",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"vimeo/psalm": "<3.6.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^7.5.13"
},
"type": "library",
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"time": "2020-02-14T12:15:55+00:00"
}
],
"aliases": [],
......@@ -4360,5 +4274,5 @@
"ext-curl": "*"
},
"platform-dev": [],
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.2.0"
}
......@@ -149,7 +149,7 @@ class ClassLoader
/**
* @return string[] Array of classname => path
* @psalm-var array<string, string>
* @psalm-return array<string, string>
*/
public function getClassMap()
{
......
......@@ -326,7 +326,9 @@ class InstalledVersions
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
......@@ -338,12 +340,17 @@ class InstalledVersions
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php';
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
$installed[] = self::$installed;
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed;
}
......
......@@ -10,21 +10,27 @@ return array(
'App\\Console\\Commands\\RemoveEmptyContact' => $baseDir . '/app/Console/Commands/RemoveEmptyContact.php',
'App\\Console\\Commands\\RepairChannelUser' => $baseDir . '/app/Console/Commands/RepairChannelUser.php',
'App\\Console\\Commands\\SetSupplierFollowUp' => $baseDir . '/app/Console/Commands/SetSupplierFollowUp.php',
'App\\Console\\Commands\\SyncAllSupplierToErp' => $baseDir . '/app/Console/Commands/SyncAllSupplierToErp.php',
'App\\Console\\Kernel' => $baseDir . '/app/Console/Kernel.php',
'App\\Events\\Event' => $baseDir . '/app/Events/Event.php',
'App\\Exceptions\\Handler' => $baseDir . '/app/Exceptions/Handler.php',
'App\\Http\\Controllers\\Api\\ChainApiController' => $baseDir . '/app/Http/Controllers/Api/ChainApiController.php',
'App\\Http\\Controllers\\Api\\CommonApiController' => $baseDir . '/app/Http/Controllers/Api/CommonApiController.php',
'App\\Http\\Controllers\\Api\\ExternalApiController' => $baseDir . '/app/Http/Controllers/Api/ExternalApiController.php',
'App\\Http\\Controllers\\Api\\LogApiController' => $baseDir . '/app/Http/Controllers/Api/LogApiController.php',
'App\\Http\\Controllers\\Api\\PurchaseRemarkApiController' => $baseDir . '/app/Http/Controllers/Api/PurchaseRemarkApiController.php',
'App\\Http\\Controllers\\Api\\ShippingCostRulerApiController' => $baseDir . '/app/Http/Controllers/Api/ShippingCostRulerApiController.php',
'App\\Http\\Controllers\\Api\\SkuApiController' => $baseDir . '/app/Http/Controllers/Api/SkuApiController.php',
'App\\Http\\Controllers\\Api\\SkuStatisticsApiController' => $baseDir . '/app/Http/Controllers/Api/SkuStatisticsApiController.php',
'App\\Http\\Controllers\\Api\\SkuUploadLogApiController' => $baseDir . '/app/Http/Controllers/Api/SkuUploadLogApiController.php',
'App\\Http\\Controllers\\Api\\SupplierAccountApiController' => $baseDir . '/app/Http/Controllers/Api/SupplierAccountApiController.php',
'App\\Http\\Controllers\\Api\\SupplierApiController' => $baseDir . '/app/Http/Controllers/Api/SupplierApiController.php',
'App\\Http\\Controllers\\Api\\SupplierApplyApiController' => $baseDir . '/app/Http/Controllers/Api/SupplierApplyApiController.php',
'App\\Http\\Controllers\\Api\\SupplierAttachmentApiController' => $baseDir . '/app/Http/Controllers/Api/SupplierAttachmentApiController.php',
'App\\Http\\Controllers\\Api\\SupplierContactApiController' => $baseDir . '/app/Http/Controllers/Api/SupplierContactApiController.php',
'App\\Http\\Controllers\\Api\\SupplierExaminationApiController' => $baseDir . '/app/Http/Controllers/Api/SupplierExaminationApiController.php',
'App\\Http\\Controllers\\Api\\SupplierLogApiController' => $baseDir . '/app/Http/Controllers/Api/SupplierLogApiController.php',
'App\\Http\\Controllers\\Api\\SupplierMemoApiController' => $baseDir . '/app/Http/Controllers/Api/SupplierMemoApiController.php',
'App\\Http\\Controllers\\Api\\SupplierReceiptApiController' => $baseDir . '/app/Http/Controllers/Api/SupplierReceiptApiController.php',
'App\\Http\\Controllers\\Api\\SupplierShareApplyApiController' => $baseDir . '/app/Http/Controllers/Api/SupplierShareApplyApiController.php',
'App\\Http\\Controllers\\Api\\SupplierStatisticsApiController' => $baseDir . '/app/Http/Controllers/Api/SupplierStatisticsApiController.php',
......@@ -33,23 +39,31 @@ return array(
'App\\Http\\Controllers\\Auth\\AuthController' => $baseDir . '/app/Http/Controllers/Auth/AuthController.php',
'App\\Http\\Controllers\\Auth\\PasswordController' => $baseDir . '/app/Http/Controllers/Auth/PasswordController.php',
'App\\Http\\Controllers\\BaseController' => $baseDir . '/app/Http/Controllers/BaseController.php',
'App\\Http\\Controllers\\ChainController' => $baseDir . '/app/Http/Controllers/ChainController.php',
'App\\Http\\Controllers\\Controller' => $baseDir . '/app/Http/Controllers/Controller.php',
'App\\Http\\Controllers\\ExampleController' => $baseDir . '/app/Http/Controllers/ExampleController.php',
'App\\Http\\Controllers\\Filter\\ChainFilter' => $baseDir . '/app/Http/Controllers/Filter/ChainFilter.php',
'App\\Http\\Controllers\\Filter\\LogFilter' => $baseDir . '/app/Http/Controllers/Filter/LogFilter.php',
'App\\Http\\Controllers\\Filter\\SkuListFilter' => $baseDir . '/app/Http/Controllers/Filter/SkuListFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierAccountFilter' => $baseDir . '/app/Http/Controllers/Filter/SupplierAccountFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierApplyFilter' => $baseDir . '/app/Http/Controllers/Filter/SupplierApplyFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierExaminationFilter' => $baseDir . '/app/Http/Controllers/Filter/SupplierExaminationFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierFilter' => $baseDir . '/app/Http/Controllers/Filter/SupplierFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierLogFilter' => $baseDir . '/app/Http/Controllers/Filter/SupplierLogFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierMemoFilter' => $baseDir . '/app/Http/Controllers/Filter/SupplierMemoFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierSyncLogFilter' => $baseDir . '/app/Http/Controllers/Filter/SupplierSyncLogFilter.php',
'App\\Http\\Controllers\\IndexController' => $baseDir . '/app/Http/Controllers/IndexController.php',
'App\\Http\\Controllers\\LogController' => $baseDir . '/app/Http/Controllers/LogController.php',
'App\\Http\\Controllers\\PurchaseRemarkController' => $baseDir . '/app/Http/Controllers/PurchaseRemarkController.php',
'App\\Http\\Controllers\\ShippingCostRulerController' => $baseDir . '/app/Http/Controllers/ShippingCostRulerController.php',
'App\\Http\\Controllers\\SkuController' => $baseDir . '/app/Http/Controllers/SkuController.php',
'App\\Http\\Controllers\\SupplierAccountController' => $baseDir . '/app/Http/Controllers/SupplierAccountController.php',
'App\\Http\\Controllers\\SupplierApplyController' => $baseDir . '/app/Http/Controllers/SupplierApplyController.php',
'App\\Http\\Controllers\\SupplierAttachmentController' => $baseDir . '/app/Http/Controllers/SupplierAttachmentController.php',
'App\\Http\\Controllers\\SupplierContactController' => $baseDir . '/app/Http/Controllers/SupplierContactController.php',
'App\\Http\\Controllers\\SupplierController' => $baseDir . '/app/Http/Controllers/SupplierController.php',
'App\\Http\\Controllers\\SupplierExaminationController' => $baseDir . '/app/Http/Controllers/SupplierExaminationController.php',
'App\\Http\\Controllers\\SupplierMemoController' => $baseDir . '/app/Http/Controllers/SupplierMemoController.php',
'App\\Http\\Controllers\\SupplierReceiptController' => $baseDir . '/app/Http/Controllers/SupplierReceiptController.php',
'App\\Http\\Controllers\\SupplierShareApplyController' => $baseDir . '/app/Http/Controllers/SupplierShareApplyController.php',
'App\\Http\\Controllers\\SupplierSyncLogController' => $baseDir . '/app/Http/Controllers/SupplierSyncLogController.php',
......@@ -67,29 +81,36 @@ return array(
'App\\Http\\Requests\\Request' => $baseDir . '/app/Http/Requests/Request.php',
'App\\Http\\Services\\AdminUserService' => $baseDir . '/app/Http/Services/AdminUserService.php',
'App\\Http\\Services\\BlacklistService' => $baseDir . '/app/Http/Services/BlacklistService.php',
'App\\Http\\Services\\ChainService' => $baseDir . '/app/Http/Services/ChainService.php',
'App\\Http\\Services\\CompanyService' => $baseDir . '/app/Http/Services/CompanyService.php',
'App\\Http\\Services\\DataService' => $baseDir . '/app/Http/Services/DataService.php',
'App\\Http\\Services\\DealImageService' => $baseDir . '/app/Http/Services/DealImageService.php',
'App\\Http\\Services\\DepartmentService' => $baseDir . '/app/Http/Services/DepartmentService.php',
'App\\Http\\Services\\IndexService' => $baseDir . '/app/Http/Services/IndexService.php',
'App\\Http\\Services\\LogService' => $baseDir . '/app/Http/Services/LogService.php',
'App\\Http\\Services\\MessageService' => $baseDir . '/app/Http/Services/MessageService.php',
'App\\Http\\Services\\PriceService' => $baseDir . '/app/Http/Services/PriceService.php',
'App\\Http\\Services\\PurchaseRemarkService' => $baseDir . '/app/Http/Services/PurchaseRemarkService.php',
'App\\Http\\Services\\QueueDeliveryService' => $baseDir . '/app/Http/Services/QueueDeliveryService.php',
'App\\Http\\Services\\QueueService' => $baseDir . '/app/Http/Services/QueueService.php',
'App\\Http\\Services\\RegionService' => $baseDir . '/app/Http/Services/RegionService.php',
'App\\Http\\Services\\RoleService' => $baseDir . '/app/Http/Services/RoleService.php',
'App\\Http\\Services\\ShippingCostRulerService' => $baseDir . '/app/Http/Services/ShippingCostRulerService.php',
'App\\Http\\Services\\SkuService' => $baseDir . '/app/Http/Services/SkuService.php',
'App\\Http\\Services\\SkuStatisticsService' => $baseDir . '/app/Http/Services/SkuStatisticsService.php',
'App\\Http\\Services\\SkuUploadItemService' => $baseDir . '/app/Http/Services/SkuUploadItemService.php',
'App\\Http\\Services\\SkuUploadLogService' => $baseDir . '/app/Http/Services/SkuUploadLogService.php',
'App\\Http\\Services\\StandardBrandService' => $baseDir . '/app/Http/Services/StandardBrandService.php',
'App\\Http\\Services\\StatisticsSkuUploadService' => $baseDir . '/app/Http/Services/StatisticsSkuUploadService.php',
'App\\Http\\Services\\SupplierAccountService' => $baseDir . '/app/Http/Services/SupplierAccountService.php',
'App\\Http\\Services\\SupplierAddressService' => $baseDir . '/app/Http/Services/SupplierAddressService.php',
'App\\Http\\Services\\SupplierApplyService' => $baseDir . '/app/Http/Services/SupplierApplyService.php',
'App\\Http\\Services\\SupplierAttachmentService' => $baseDir . '/app/Http/Services/SupplierAttachmentService.php',
'App\\Http\\Services\\SupplierAuditService' => $baseDir . '/app/Http/Services/SupplierAuditService.php',
'App\\Http\\Services\\SupplierContactService' => $baseDir . '/app/Http/Services/SupplierContactService.php',
'App\\Http\\Services\\SupplierExaminationService' => $baseDir . '/app/Http/Services/SupplierExaminationService.php',
'App\\Http\\Services\\SupplierExtraFeeService' => $baseDir . '/app/Http/Services/SupplierExtraFeeService.php',
'App\\Http\\Services\\SupplierMemoService' => $baseDir . '/app/Http/Services/SupplierMemoService.php',
'App\\Http\\Services\\SupplierPayTypeService' => $baseDir . '/app/Http/Services/SupplierPayTypeService.php',
'App\\Http\\Services\\SupplierReceiptService' => $baseDir . '/app/Http/Services/SupplierReceiptService.php',
'App\\Http\\Services\\SupplierSearchTagService' => $baseDir . '/app/Http/Services/SupplierSearchTagService.php',
......@@ -98,17 +119,23 @@ return array(
'App\\Http\\Services\\SupplierSkuAuditRulerService' => $baseDir . '/app/Http/Services/SupplierSkuAuditRulerService.php',
'App\\Http\\Services\\SupplierSkuUploadRulerService' => $baseDir . '/app/Http/Services/SupplierSkuUploadRulerService.php',
'App\\Http\\Services\\SupplierStatisticsService' => $baseDir . '/app/Http/Services/SupplierStatisticsService.php',
'App\\Http\\Services\\SupplierSubAccountService' => $baseDir . '/app/Http/Services/SupplierSubAccountService.php',
'App\\Http\\Services\\SupplierTagService' => $baseDir . '/app/Http/Services/SupplierTagService.php',
'App\\Http\\Services\\SyncSupplierService' => $baseDir . '/app/Http/Services/SyncSupplierService.php',
'App\\Http\\Services\\ViewCheckService' => $baseDir . '/app/Http/Services/ViewCheckService.php',
'App\\Http\\Transformers\\ChainTransformer' => $baseDir . '/app/Http/Transformers/ChainTransformer.php',
'App\\Http\\Transformers\\LogTransformer' => $baseDir . '/app/Http/Transformers/LogTransformer.php',
'App\\Http\\Transformers\\PurchaseRemarkTransformer' => $baseDir . '/app/Http/Transformers/PurchaseRemarkTransformer.php',
'App\\Http\\Transformers\\ReceiptTransformer' => $baseDir . '/app/Http/Transformers/ReceiptTransformer.php',
'App\\Http\\Transformers\\ShippingCostRulerTransformer' => $baseDir . '/app/Http/Transformers/ShippingCostRulerTransformer.php',
'App\\Http\\Transformers\\SkuUploadLogTransformer' => $baseDir . '/app/Http/Transformers/SkuUploadLogTransformer.php',
'App\\Http\\Transformers\\SupplierAccountTransformer' => $baseDir . '/app/Http/Transformers/SupplierAccountTransformer.php',
'App\\Http\\Transformers\\SupplierApplyTransformer' => $baseDir . '/app/Http/Transformers/SupplierApplyTransformer.php',
'App\\Http\\Transformers\\SupplierAttachmentTransformer' => $baseDir . '/app/Http/Transformers/SupplierAttachmentTransformer.php',
'App\\Http\\Transformers\\SupplierContactTransformer' => $baseDir . '/app/Http/Transformers/SupplierContactTransformer.php',
'App\\Http\\Transformers\\SupplierExaminationTransformer' => $baseDir . '/app/Http/Transformers/SupplierExaminationTransformer.php',
'App\\Http\\Transformers\\SupplierLogTransformer' => $baseDir . '/app/Http/Transformers/SupplierLogTransformer.php',
'App\\Http\\Transformers\\SupplierMemoTransformer' => $baseDir . '/app/Http/Transformers/SupplierMemoTransformer.php',
'App\\Http\\Transformers\\SupplierShareApplyTransformer' => $baseDir . '/app/Http/Transformers/SupplierShareApplyTransformer.php',
'App\\Http\\Transformers\\SupplierSyncLogTransformer' => $baseDir . '/app/Http/Transformers/SupplierSyncLogTransformer.php',
'App\\Http\\Transformers\\SupplierTransformer' => $baseDir . '/app/Http/Transformers/SupplierTransformer.php',
......@@ -121,13 +148,20 @@ return array(
'App\\Http\\Validators\\SupplierValidator' => $baseDir . '/app/Http/Validators/SupplierValidator.php',
'App\\Http\\Validators\\Validator' => $baseDir . '/app/Http/Validators/Validator.php',
'App\\Jobs\\Job' => $baseDir . '/app/Jobs/Job.php',
'App\\Model\\BigData\\DataManageModel' => $baseDir . '/app/Model/BigData/DataManageModel.php',
'App\\Model\\BrandModel' => $baseDir . '/app/Model/BrandModel.php',
'App\\Model\\ChainCheckModel' => $baseDir . '/app/Model/ChainCheckModel.php',
'App\\Model\\ChainModel' => $baseDir . '/app/Model/ChainModel.php',
'App\\Model\\DepartmentModel' => $baseDir . '/app/Model/DepartmentModel.php',
'App\\Model\\IntracodeModel' => $baseDir . '/app/Model/IntracodeModel.php',
'App\\Model\\LogModel' => $baseDir . '/app/Model/LogModel.php',
'App\\Model\\PurchaseRemarkModel' => $baseDir . '/app/Model/PurchaseRemarkModel.php',
'App\\Model\\Purchase\\PurchaseOrderModel' => $baseDir . '/app/Model/Purchase/PurchaseOrderModel.php',
'App\\Model\\Purchase\\StockInItemModel' => $baseDir . '/app/Model/Purchase/StockInItemModel.php',
'App\\Model\\Purchase\\StockInModel' => $baseDir . '/app/Model/Purchase/StockInModel.php',
'App\\Model\\RedisModel' => $baseDir . '/app/Model/RedisModel.php',
'App\\Model\\RegionModel' => $baseDir . '/app/Model/RegionModel.php',
'App\\Model\\ShippingCostRulerModel' => $baseDir . '/app/Model/ShippingCostRulerModel.php',
'App\\Model\\SkuUploadItem' => $baseDir . '/app/Model/SkuUploadItem.php',
'App\\Model\\SkuUploadLogModel' => $baseDir . '/app/Model/SkuUploadLogModel.php',
'App\\Model\\SpuBrandModel' => $baseDir . '/app/Model/SpuBrandModel.php',
......@@ -135,6 +169,7 @@ return array(
'App\\Model\\StandardBrandModel' => $baseDir . '/app/Model/StandardBrandModel.php',
'App\\Model\\SupplierAccountModel' => $baseDir . '/app/Model/SupplierAccountModel.php',
'App\\Model\\SupplierAddressModel' => $baseDir . '/app/Model/SupplierAddressModel.php',
'App\\Model\\SupplierApplyModel' => $baseDir . '/app/Model/SupplierApplyModel.php',
'App\\Model\\SupplierAttachmentModel' => $baseDir . '/app/Model/SupplierAttachmentModel.php',
'App\\Model\\SupplierAttachmentsModel' => $baseDir . '/app/Model/SupplierAttachmentsModel.php',
'App\\Model\\SupplierBlacklistModel' => $baseDir . '/app/Model/SupplierBlacklistModel.php',
......@@ -143,10 +178,12 @@ return array(
'App\\Model\\SupplierExaminationModel' => $baseDir . '/app/Model/SupplierExaminationModel.php',
'App\\Model\\SupplierExtendModel' => $baseDir . '/app/Model/SupplierExtendModel.php',
'App\\Model\\SupplierLogModel' => $baseDir . '/app/Model/SupplierLogModel.php',
'App\\Model\\SupplierMemoModel' => $baseDir . '/app/Model/SupplierMemoModel.php',
'App\\Model\\SupplierPayTypeModel' => $baseDir . '/app/Model/SupplierPayTypeModel.php',
'App\\Model\\SupplierReceiptModel' => $baseDir . '/app/Model/SupplierReceiptModel.php',
'App\\Model\\SupplierShareApplyModel' => $baseDir . '/app/Model/SupplierShareApplyModel.php',
'App\\Model\\SupplierSyncModel' => $baseDir . '/app/Model/SupplierSyncModel.php',
'App\\Model\\TagsModel' => $baseDir . '/app/Model/TagsModel.php',
'App\\Model\\UserDepartmentModel' => $baseDir . '/app/Model/UserDepartmentModel.php',
'App\\Model\\UserInfoModel' => $baseDir . '/app/Model/UserInfoModel.php',
'App\\Presenters\\BrandSelectorPresenter' => $baseDir . '/app/Presenters/BrandSelectorPresenter.php',
......@@ -161,6 +198,7 @@ return array(
'App\\Presenters\\MultiSelectorPresenter' => $baseDir . '/app/Presenters/MultiSelectorPresenter.php',
'App\\Presenters\\RegionSelectorPresenter' => $baseDir . '/app/Presenters/RegionSelectorPresenter.php',
'App\\Presenters\\SingleSelectPresenter' => $baseDir . '/app/Presenters/SingleSelectPresenter.php',
'App\\Presenters\\StandardBrandNameListPresenter' => $baseDir . '/app/Presenters/StandardBrandNameListPresenter.php',
'App\\Presenters\\StatusPresenter' => $baseDir . '/app/Presenters/StatusPresenter.php',
'App\\Presenters\\TimeIntervalPresenter' => $baseDir . '/app/Presenters/TimeIntervalPresenter.php',
'App\\Providers\\AppServiceProvider' => $baseDir . '/app/Providers/AppServiceProvider.php',
......@@ -3539,13 +3577,13 @@ return array(
'VladimirYuldashev\\LaravelQueueRabbitMQ\\Queue\\Jobs\\RabbitMQJob' => $vendorDir . '/vladimir-yuldashev/laravel-queue-rabbitmq/src/VladimirYuldashev/LaravelQueueRabbitMQ/Queue/Jobs/RabbitMQJob.php',
'VladimirYuldashev\\LaravelQueueRabbitMQ\\Queue\\RabbitMQQueue' => $vendorDir . '/vladimir-yuldashev/laravel-queue-rabbitmq/src/VladimirYuldashev/LaravelQueueRabbitMQ/Queue/RabbitMQQueue.php',
'Webmozart\\Assert\\Assert' => $vendorDir . '/webmozart/assert/src/Assert.php',
'Webmozart\\Assert\\Mixin' => $vendorDir . '/webmozart/assert/src/Mixin.php',
'XdgBaseDir\\Xdg' => $vendorDir . '/dnoegel/php-xdg-base-dir/src/Xdg.php',
'phpDocumentor\\Reflection\\DocBlock' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock.php',
'phpDocumentor\\Reflection\\DocBlockFactory' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlockFactory.php',
'phpDocumentor\\Reflection\\DocBlockFactoryInterface' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlockFactoryInterface.php',
'phpDocumentor\\Reflection\\DocBlock\\Description' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Description.php',
'phpDocumentor\\Reflection\\DocBlock\\DescriptionFactory' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/DescriptionFactory.php',
'phpDocumentor\\Reflection\\DocBlock\\ExampleFinder' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/ExampleFinder.php',
'phpDocumentor\\Reflection\\DocBlock\\Serializer' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Serializer.php',
'phpDocumentor\\Reflection\\DocBlock\\StandardTagFactory' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php',
'phpDocumentor\\Reflection\\DocBlock\\Tag' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tag.php',
......@@ -3567,14 +3605,10 @@ return array(
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Property' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Property.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\PropertyRead' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyRead.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\PropertyWrite' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyWrite.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Fqsen' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Fqsen.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Reference' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Reference.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Url' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Url.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Return_' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Return_.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\See' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/See.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Since' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Since.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Source' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Source.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\TagWithType' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/TagWithType.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Throws' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Throws.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Uses' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Uses.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Var_' => $vendorDir . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Var_.php',
......@@ -3588,23 +3622,21 @@ return array(
'phpDocumentor\\Reflection\\ProjectFactory' => $vendorDir . '/phpdocumentor/reflection-common/src/ProjectFactory.php',
'phpDocumentor\\Reflection\\Type' => $vendorDir . '/phpdocumentor/type-resolver/src/Type.php',
'phpDocumentor\\Reflection\\TypeResolver' => $vendorDir . '/phpdocumentor/type-resolver/src/TypeResolver.php',
'phpDocumentor\\Reflection\\Types\\AbstractList' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/AbstractList.php',
'phpDocumentor\\Reflection\\Types\\Array_' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Array_.php',
'phpDocumentor\\Reflection\\Types\\Boolean' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Boolean.php',
'phpDocumentor\\Reflection\\Types\\Callable_' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Callable_.php',
'phpDocumentor\\Reflection\\Types\\Collection' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Collection.php',
'phpDocumentor\\Reflection\\Types\\Compound' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Compound.php',
'phpDocumentor\\Reflection\\Types\\Context' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Context.php',
'phpDocumentor\\Reflection\\Types\\ContextFactory' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/ContextFactory.php',
'phpDocumentor\\Reflection\\Types\\Float_' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Float_.php',
'phpDocumentor\\Reflection\\Types\\Integer' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Integer.php',
'phpDocumentor\\Reflection\\Types\\Iterable_' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Iterable_.php',
'phpDocumentor\\Reflection\\Types\\Mixed_' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Mixed_.php',
'phpDocumentor\\Reflection\\Types\\Mixed' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Mixed.php',
'phpDocumentor\\Reflection\\Types\\Null_' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Null_.php',
'phpDocumentor\\Reflection\\Types\\Nullable' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Nullable.php',
'phpDocumentor\\Reflection\\Types\\Object_' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Object_.php',
'phpDocumentor\\Reflection\\Types\\Parent_' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Parent_.php',
'phpDocumentor\\Reflection\\Types\\Resource_' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Resource_.php',
'phpDocumentor\\Reflection\\Types\\Resource' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Resource.php',
'phpDocumentor\\Reflection\\Types\\Scalar' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Scalar.php',
'phpDocumentor\\Reflection\\Types\\Self_' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Self_.php',
'phpDocumentor\\Reflection\\Types\\Static_' => $vendorDir . '/phpdocumentor/type-resolver/src/Types/Static_.php',
......
......@@ -7,16 +7,16 @@ $baseDir = dirname($vendorDir);
return array(
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'1d1b89d124cc9cb8219922c9d5569199' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest.php',
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
'bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
'1d1b89d124cc9cb8219922c9d5569199' => $vendorDir . '/hamcrest/hamcrest-php/hamcrest/Hamcrest.php',
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
'e7223560d890eab89cda23685e711e2c' => $vendorDir . '/psy/psysh/src/Psy/functions.php',
'2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'f0906e6318348a765ffb6eb24e0d0938' => $vendorDir . '/laravel/framework/src/Illuminate/Foundation/helpers.php',
'58571171fd5812e6e447dce228f52f4d' => $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php',
......
......@@ -12,4 +12,6 @@ return array(
'Mockery' => array($vendorDir . '/mockery/mockery/library'),
'Maatwebsite\\Excel\\' => array($vendorDir . '/maatwebsite/excel/src'),
'JakubOnderka\\PhpConsoleHighlighter' => array($vendorDir . '/jakub-onderka/php-console-highlighter/src'),
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src'),
'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'),
);
......@@ -44,8 +44,6 @@ return array(
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'),
'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Common/Inflector'),
'Cron\\' => array($vendorDir . '/mtdowling/cron-expression/src/Cron'),
'ClassPreloader\\' => array($vendorDir . '/classpreloader/classpreloader/src'),
'App\\' => array($baseDir . '/app'),
......
......@@ -63,11 +63,16 @@ class ComposerAutoloaderInit2a46e5674e69fd121680370ab820bf2e
}
}
/**
* @param string $fileIdentifier
* @param string $file
* @return void
*/
function composerRequire2a46e5674e69fd121680370ab820bf2e($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}
......@@ -8,16 +8,16 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'1d1b89d124cc9cb8219922c9d5569199' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
'bd9634f2d41831496de0d3dfe4c94881' => __DIR__ . '/..' . '/symfony/polyfill-php56/bootstrap.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
'1d1b89d124cc9cb8219922c9d5569199' => __DIR__ . '/..' . '/hamcrest/hamcrest-php/hamcrest/Hamcrest.php',
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
'e7223560d890eab89cda23685e711e2c' => __DIR__ . '/..' . '/psy/psysh/src/Psy/functions.php',
'2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'f0906e6318348a765ffb6eb24e0d0938' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Foundation/helpers.php',
'58571171fd5812e6e447dce228f52f4d' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php',
......@@ -101,8 +101,6 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
'D' =>
array (
'Dotenv\\' => 7,
'Doctrine\\Instantiator\\' => 22,
'Doctrine\\Common\\Inflector\\' => 26,
),
'C' =>
array (
......@@ -270,14 +268,6 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
array (
0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src',
),
'Doctrine\\Instantiator\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator',
),
'Doctrine\\Common\\Inflector\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/inflector/lib/Doctrine/Common/Inflector',
),
'Cron\\' =>
array (
0 => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron',
......@@ -336,6 +326,17 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
0 => __DIR__ . '/..' . '/jakub-onderka/php-console-highlighter/src',
),
),
'D' =>
array (
'Doctrine\\Instantiator\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/instantiator/src',
),
'Doctrine\\Common\\Inflector\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/inflector/lib',
),
),
);
public static $classMap = array (
......@@ -343,21 +344,27 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
'App\\Console\\Commands\\RemoveEmptyContact' => __DIR__ . '/../..' . '/app/Console/Commands/RemoveEmptyContact.php',
'App\\Console\\Commands\\RepairChannelUser' => __DIR__ . '/../..' . '/app/Console/Commands/RepairChannelUser.php',
'App\\Console\\Commands\\SetSupplierFollowUp' => __DIR__ . '/../..' . '/app/Console/Commands/SetSupplierFollowUp.php',
'App\\Console\\Commands\\SyncAllSupplierToErp' => __DIR__ . '/../..' . '/app/Console/Commands/SyncAllSupplierToErp.php',
'App\\Console\\Kernel' => __DIR__ . '/../..' . '/app/Console/Kernel.php',
'App\\Events\\Event' => __DIR__ . '/../..' . '/app/Events/Event.php',
'App\\Exceptions\\Handler' => __DIR__ . '/../..' . '/app/Exceptions/Handler.php',
'App\\Http\\Controllers\\Api\\ChainApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/ChainApiController.php',
'App\\Http\\Controllers\\Api\\CommonApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/CommonApiController.php',
'App\\Http\\Controllers\\Api\\ExternalApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/ExternalApiController.php',
'App\\Http\\Controllers\\Api\\LogApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/LogApiController.php',
'App\\Http\\Controllers\\Api\\PurchaseRemarkApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/PurchaseRemarkApiController.php',
'App\\Http\\Controllers\\Api\\ShippingCostRulerApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/ShippingCostRulerApiController.php',
'App\\Http\\Controllers\\Api\\SkuApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SkuApiController.php',
'App\\Http\\Controllers\\Api\\SkuStatisticsApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SkuStatisticsApiController.php',
'App\\Http\\Controllers\\Api\\SkuUploadLogApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SkuUploadLogApiController.php',
'App\\Http\\Controllers\\Api\\SupplierAccountApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SupplierAccountApiController.php',
'App\\Http\\Controllers\\Api\\SupplierApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SupplierApiController.php',
'App\\Http\\Controllers\\Api\\SupplierApplyApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SupplierApplyApiController.php',
'App\\Http\\Controllers\\Api\\SupplierAttachmentApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SupplierAttachmentApiController.php',
'App\\Http\\Controllers\\Api\\SupplierContactApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SupplierContactApiController.php',
'App\\Http\\Controllers\\Api\\SupplierExaminationApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SupplierExaminationApiController.php',
'App\\Http\\Controllers\\Api\\SupplierLogApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SupplierLogApiController.php',
'App\\Http\\Controllers\\Api\\SupplierMemoApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SupplierMemoApiController.php',
'App\\Http\\Controllers\\Api\\SupplierReceiptApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SupplierReceiptApiController.php',
'App\\Http\\Controllers\\Api\\SupplierShareApplyApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SupplierShareApplyApiController.php',
'App\\Http\\Controllers\\Api\\SupplierStatisticsApiController' => __DIR__ . '/../..' . '/app/Http/Controllers/Api/SupplierStatisticsApiController.php',
......@@ -366,23 +373,31 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
'App\\Http\\Controllers\\Auth\\AuthController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/AuthController.php',
'App\\Http\\Controllers\\Auth\\PasswordController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/PasswordController.php',
'App\\Http\\Controllers\\BaseController' => __DIR__ . '/../..' . '/app/Http/Controllers/BaseController.php',
'App\\Http\\Controllers\\ChainController' => __DIR__ . '/../..' . '/app/Http/Controllers/ChainController.php',
'App\\Http\\Controllers\\Controller' => __DIR__ . '/../..' . '/app/Http/Controllers/Controller.php',
'App\\Http\\Controllers\\ExampleController' => __DIR__ . '/../..' . '/app/Http/Controllers/ExampleController.php',
'App\\Http\\Controllers\\Filter\\ChainFilter' => __DIR__ . '/../..' . '/app/Http/Controllers/Filter/ChainFilter.php',
'App\\Http\\Controllers\\Filter\\LogFilter' => __DIR__ . '/../..' . '/app/Http/Controllers/Filter/LogFilter.php',
'App\\Http\\Controllers\\Filter\\SkuListFilter' => __DIR__ . '/../..' . '/app/Http/Controllers/Filter/SkuListFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierAccountFilter' => __DIR__ . '/../..' . '/app/Http/Controllers/Filter/SupplierAccountFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierApplyFilter' => __DIR__ . '/../..' . '/app/Http/Controllers/Filter/SupplierApplyFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierExaminationFilter' => __DIR__ . '/../..' . '/app/Http/Controllers/Filter/SupplierExaminationFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierFilter' => __DIR__ . '/../..' . '/app/Http/Controllers/Filter/SupplierFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierLogFilter' => __DIR__ . '/../..' . '/app/Http/Controllers/Filter/SupplierLogFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierMemoFilter' => __DIR__ . '/../..' . '/app/Http/Controllers/Filter/SupplierMemoFilter.php',
'App\\Http\\Controllers\\Filter\\SupplierSyncLogFilter' => __DIR__ . '/../..' . '/app/Http/Controllers/Filter/SupplierSyncLogFilter.php',
'App\\Http\\Controllers\\IndexController' => __DIR__ . '/../..' . '/app/Http/Controllers/IndexController.php',
'App\\Http\\Controllers\\LogController' => __DIR__ . '/../..' . '/app/Http/Controllers/LogController.php',
'App\\Http\\Controllers\\PurchaseRemarkController' => __DIR__ . '/../..' . '/app/Http/Controllers/PurchaseRemarkController.php',
'App\\Http\\Controllers\\ShippingCostRulerController' => __DIR__ . '/../..' . '/app/Http/Controllers/ShippingCostRulerController.php',
'App\\Http\\Controllers\\SkuController' => __DIR__ . '/../..' . '/app/Http/Controllers/SkuController.php',
'App\\Http\\Controllers\\SupplierAccountController' => __DIR__ . '/../..' . '/app/Http/Controllers/SupplierAccountController.php',
'App\\Http\\Controllers\\SupplierApplyController' => __DIR__ . '/../..' . '/app/Http/Controllers/SupplierApplyController.php',
'App\\Http\\Controllers\\SupplierAttachmentController' => __DIR__ . '/../..' . '/app/Http/Controllers/SupplierAttachmentController.php',
'App\\Http\\Controllers\\SupplierContactController' => __DIR__ . '/../..' . '/app/Http/Controllers/SupplierContactController.php',
'App\\Http\\Controllers\\SupplierController' => __DIR__ . '/../..' . '/app/Http/Controllers/SupplierController.php',
'App\\Http\\Controllers\\SupplierExaminationController' => __DIR__ . '/../..' . '/app/Http/Controllers/SupplierExaminationController.php',
'App\\Http\\Controllers\\SupplierMemoController' => __DIR__ . '/../..' . '/app/Http/Controllers/SupplierMemoController.php',
'App\\Http\\Controllers\\SupplierReceiptController' => __DIR__ . '/../..' . '/app/Http/Controllers/SupplierReceiptController.php',
'App\\Http\\Controllers\\SupplierShareApplyController' => __DIR__ . '/../..' . '/app/Http/Controllers/SupplierShareApplyController.php',
'App\\Http\\Controllers\\SupplierSyncLogController' => __DIR__ . '/../..' . '/app/Http/Controllers/SupplierSyncLogController.php',
......@@ -400,29 +415,36 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
'App\\Http\\Requests\\Request' => __DIR__ . '/../..' . '/app/Http/Requests/Request.php',
'App\\Http\\Services\\AdminUserService' => __DIR__ . '/../..' . '/app/Http/Services/AdminUserService.php',
'App\\Http\\Services\\BlacklistService' => __DIR__ . '/../..' . '/app/Http/Services/BlacklistService.php',
'App\\Http\\Services\\ChainService' => __DIR__ . '/../..' . '/app/Http/Services/ChainService.php',
'App\\Http\\Services\\CompanyService' => __DIR__ . '/../..' . '/app/Http/Services/CompanyService.php',
'App\\Http\\Services\\DataService' => __DIR__ . '/../..' . '/app/Http/Services/DataService.php',
'App\\Http\\Services\\DealImageService' => __DIR__ . '/../..' . '/app/Http/Services/DealImageService.php',
'App\\Http\\Services\\DepartmentService' => __DIR__ . '/../..' . '/app/Http/Services/DepartmentService.php',
'App\\Http\\Services\\IndexService' => __DIR__ . '/../..' . '/app/Http/Services/IndexService.php',
'App\\Http\\Services\\LogService' => __DIR__ . '/../..' . '/app/Http/Services/LogService.php',
'App\\Http\\Services\\MessageService' => __DIR__ . '/../..' . '/app/Http/Services/MessageService.php',
'App\\Http\\Services\\PriceService' => __DIR__ . '/../..' . '/app/Http/Services/PriceService.php',
'App\\Http\\Services\\PurchaseRemarkService' => __DIR__ . '/../..' . '/app/Http/Services/PurchaseRemarkService.php',
'App\\Http\\Services\\QueueDeliveryService' => __DIR__ . '/../..' . '/app/Http/Services/QueueDeliveryService.php',
'App\\Http\\Services\\QueueService' => __DIR__ . '/../..' . '/app/Http/Services/QueueService.php',
'App\\Http\\Services\\RegionService' => __DIR__ . '/../..' . '/app/Http/Services/RegionService.php',
'App\\Http\\Services\\RoleService' => __DIR__ . '/../..' . '/app/Http/Services/RoleService.php',
'App\\Http\\Services\\ShippingCostRulerService' => __DIR__ . '/../..' . '/app/Http/Services/ShippingCostRulerService.php',
'App\\Http\\Services\\SkuService' => __DIR__ . '/../..' . '/app/Http/Services/SkuService.php',
'App\\Http\\Services\\SkuStatisticsService' => __DIR__ . '/../..' . '/app/Http/Services/SkuStatisticsService.php',
'App\\Http\\Services\\SkuUploadItemService' => __DIR__ . '/../..' . '/app/Http/Services/SkuUploadItemService.php',
'App\\Http\\Services\\SkuUploadLogService' => __DIR__ . '/../..' . '/app/Http/Services/SkuUploadLogService.php',
'App\\Http\\Services\\StandardBrandService' => __DIR__ . '/../..' . '/app/Http/Services/StandardBrandService.php',
'App\\Http\\Services\\StatisticsSkuUploadService' => __DIR__ . '/../..' . '/app/Http/Services/StatisticsSkuUploadService.php',
'App\\Http\\Services\\SupplierAccountService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierAccountService.php',
'App\\Http\\Services\\SupplierAddressService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierAddressService.php',
'App\\Http\\Services\\SupplierApplyService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierApplyService.php',
'App\\Http\\Services\\SupplierAttachmentService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierAttachmentService.php',
'App\\Http\\Services\\SupplierAuditService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierAuditService.php',
'App\\Http\\Services\\SupplierContactService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierContactService.php',
'App\\Http\\Services\\SupplierExaminationService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierExaminationService.php',
'App\\Http\\Services\\SupplierExtraFeeService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierExtraFeeService.php',
'App\\Http\\Services\\SupplierMemoService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierMemoService.php',
'App\\Http\\Services\\SupplierPayTypeService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierPayTypeService.php',
'App\\Http\\Services\\SupplierReceiptService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierReceiptService.php',
'App\\Http\\Services\\SupplierSearchTagService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierSearchTagService.php',
......@@ -431,17 +453,23 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
'App\\Http\\Services\\SupplierSkuAuditRulerService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierSkuAuditRulerService.php',
'App\\Http\\Services\\SupplierSkuUploadRulerService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierSkuUploadRulerService.php',
'App\\Http\\Services\\SupplierStatisticsService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierStatisticsService.php',
'App\\Http\\Services\\SupplierSubAccountService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierSubAccountService.php',
'App\\Http\\Services\\SupplierTagService' => __DIR__ . '/../..' . '/app/Http/Services/SupplierTagService.php',
'App\\Http\\Services\\SyncSupplierService' => __DIR__ . '/../..' . '/app/Http/Services/SyncSupplierService.php',
'App\\Http\\Services\\ViewCheckService' => __DIR__ . '/../..' . '/app/Http/Services/ViewCheckService.php',
'App\\Http\\Transformers\\ChainTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/ChainTransformer.php',
'App\\Http\\Transformers\\LogTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/LogTransformer.php',
'App\\Http\\Transformers\\PurchaseRemarkTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/PurchaseRemarkTransformer.php',
'App\\Http\\Transformers\\ReceiptTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/ReceiptTransformer.php',
'App\\Http\\Transformers\\ShippingCostRulerTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/ShippingCostRulerTransformer.php',
'App\\Http\\Transformers\\SkuUploadLogTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/SkuUploadLogTransformer.php',
'App\\Http\\Transformers\\SupplierAccountTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/SupplierAccountTransformer.php',
'App\\Http\\Transformers\\SupplierApplyTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/SupplierApplyTransformer.php',
'App\\Http\\Transformers\\SupplierAttachmentTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/SupplierAttachmentTransformer.php',
'App\\Http\\Transformers\\SupplierContactTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/SupplierContactTransformer.php',
'App\\Http\\Transformers\\SupplierExaminationTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/SupplierExaminationTransformer.php',
'App\\Http\\Transformers\\SupplierLogTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/SupplierLogTransformer.php',
'App\\Http\\Transformers\\SupplierMemoTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/SupplierMemoTransformer.php',
'App\\Http\\Transformers\\SupplierShareApplyTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/SupplierShareApplyTransformer.php',
'App\\Http\\Transformers\\SupplierSyncLogTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/SupplierSyncLogTransformer.php',
'App\\Http\\Transformers\\SupplierTransformer' => __DIR__ . '/../..' . '/app/Http/Transformers/SupplierTransformer.php',
......@@ -454,13 +482,20 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
'App\\Http\\Validators\\SupplierValidator' => __DIR__ . '/../..' . '/app/Http/Validators/SupplierValidator.php',
'App\\Http\\Validators\\Validator' => __DIR__ . '/../..' . '/app/Http/Validators/Validator.php',
'App\\Jobs\\Job' => __DIR__ . '/../..' . '/app/Jobs/Job.php',
'App\\Model\\BigData\\DataManageModel' => __DIR__ . '/../..' . '/app/Model/BigData/DataManageModel.php',
'App\\Model\\BrandModel' => __DIR__ . '/../..' . '/app/Model/BrandModel.php',
'App\\Model\\ChainCheckModel' => __DIR__ . '/../..' . '/app/Model/ChainCheckModel.php',
'App\\Model\\ChainModel' => __DIR__ . '/../..' . '/app/Model/ChainModel.php',
'App\\Model\\DepartmentModel' => __DIR__ . '/../..' . '/app/Model/DepartmentModel.php',
'App\\Model\\IntracodeModel' => __DIR__ . '/../..' . '/app/Model/IntracodeModel.php',
'App\\Model\\LogModel' => __DIR__ . '/../..' . '/app/Model/LogModel.php',
'App\\Model\\PurchaseRemarkModel' => __DIR__ . '/../..' . '/app/Model/PurchaseRemarkModel.php',
'App\\Model\\Purchase\\PurchaseOrderModel' => __DIR__ . '/../..' . '/app/Model/Purchase/PurchaseOrderModel.php',
'App\\Model\\Purchase\\StockInItemModel' => __DIR__ . '/../..' . '/app/Model/Purchase/StockInItemModel.php',
'App\\Model\\Purchase\\StockInModel' => __DIR__ . '/../..' . '/app/Model/Purchase/StockInModel.php',
'App\\Model\\RedisModel' => __DIR__ . '/../..' . '/app/Model/RedisModel.php',
'App\\Model\\RegionModel' => __DIR__ . '/../..' . '/app/Model/RegionModel.php',
'App\\Model\\ShippingCostRulerModel' => __DIR__ . '/../..' . '/app/Model/ShippingCostRulerModel.php',
'App\\Model\\SkuUploadItem' => __DIR__ . '/../..' . '/app/Model/SkuUploadItem.php',
'App\\Model\\SkuUploadLogModel' => __DIR__ . '/../..' . '/app/Model/SkuUploadLogModel.php',
'App\\Model\\SpuBrandModel' => __DIR__ . '/../..' . '/app/Model/SpuBrandModel.php',
......@@ -468,6 +503,7 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
'App\\Model\\StandardBrandModel' => __DIR__ . '/../..' . '/app/Model/StandardBrandModel.php',
'App\\Model\\SupplierAccountModel' => __DIR__ . '/../..' . '/app/Model/SupplierAccountModel.php',
'App\\Model\\SupplierAddressModel' => __DIR__ . '/../..' . '/app/Model/SupplierAddressModel.php',
'App\\Model\\SupplierApplyModel' => __DIR__ . '/../..' . '/app/Model/SupplierApplyModel.php',
'App\\Model\\SupplierAttachmentModel' => __DIR__ . '/../..' . '/app/Model/SupplierAttachmentModel.php',
'App\\Model\\SupplierAttachmentsModel' => __DIR__ . '/../..' . '/app/Model/SupplierAttachmentsModel.php',
'App\\Model\\SupplierBlacklistModel' => __DIR__ . '/../..' . '/app/Model/SupplierBlacklistModel.php',
......@@ -476,10 +512,12 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
'App\\Model\\SupplierExaminationModel' => __DIR__ . '/../..' . '/app/Model/SupplierExaminationModel.php',
'App\\Model\\SupplierExtendModel' => __DIR__ . '/../..' . '/app/Model/SupplierExtendModel.php',
'App\\Model\\SupplierLogModel' => __DIR__ . '/../..' . '/app/Model/SupplierLogModel.php',
'App\\Model\\SupplierMemoModel' => __DIR__ . '/../..' . '/app/Model/SupplierMemoModel.php',
'App\\Model\\SupplierPayTypeModel' => __DIR__ . '/../..' . '/app/Model/SupplierPayTypeModel.php',
'App\\Model\\SupplierReceiptModel' => __DIR__ . '/../..' . '/app/Model/SupplierReceiptModel.php',
'App\\Model\\SupplierShareApplyModel' => __DIR__ . '/../..' . '/app/Model/SupplierShareApplyModel.php',
'App\\Model\\SupplierSyncModel' => __DIR__ . '/../..' . '/app/Model/SupplierSyncModel.php',
'App\\Model\\TagsModel' => __DIR__ . '/../..' . '/app/Model/TagsModel.php',
'App\\Model\\UserDepartmentModel' => __DIR__ . '/../..' . '/app/Model/UserDepartmentModel.php',
'App\\Model\\UserInfoModel' => __DIR__ . '/../..' . '/app/Model/UserInfoModel.php',
'App\\Presenters\\BrandSelectorPresenter' => __DIR__ . '/../..' . '/app/Presenters/BrandSelectorPresenter.php',
......@@ -494,6 +532,7 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
'App\\Presenters\\MultiSelectorPresenter' => __DIR__ . '/../..' . '/app/Presenters/MultiSelectorPresenter.php',
'App\\Presenters\\RegionSelectorPresenter' => __DIR__ . '/../..' . '/app/Presenters/RegionSelectorPresenter.php',
'App\\Presenters\\SingleSelectPresenter' => __DIR__ . '/../..' . '/app/Presenters/SingleSelectPresenter.php',
'App\\Presenters\\StandardBrandNameListPresenter' => __DIR__ . '/../..' . '/app/Presenters/StandardBrandNameListPresenter.php',
'App\\Presenters\\StatusPresenter' => __DIR__ . '/../..' . '/app/Presenters/StatusPresenter.php',
'App\\Presenters\\TimeIntervalPresenter' => __DIR__ . '/../..' . '/app/Presenters/TimeIntervalPresenter.php',
'App\\Providers\\AppServiceProvider' => __DIR__ . '/../..' . '/app/Providers/AppServiceProvider.php',
......@@ -3872,13 +3911,13 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
'VladimirYuldashev\\LaravelQueueRabbitMQ\\Queue\\Jobs\\RabbitMQJob' => __DIR__ . '/..' . '/vladimir-yuldashev/laravel-queue-rabbitmq/src/VladimirYuldashev/LaravelQueueRabbitMQ/Queue/Jobs/RabbitMQJob.php',
'VladimirYuldashev\\LaravelQueueRabbitMQ\\Queue\\RabbitMQQueue' => __DIR__ . '/..' . '/vladimir-yuldashev/laravel-queue-rabbitmq/src/VladimirYuldashev/LaravelQueueRabbitMQ/Queue/RabbitMQQueue.php',
'Webmozart\\Assert\\Assert' => __DIR__ . '/..' . '/webmozart/assert/src/Assert.php',
'Webmozart\\Assert\\Mixin' => __DIR__ . '/..' . '/webmozart/assert/src/Mixin.php',
'XdgBaseDir\\Xdg' => __DIR__ . '/..' . '/dnoegel/php-xdg-base-dir/src/Xdg.php',
'phpDocumentor\\Reflection\\DocBlock' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock.php',
'phpDocumentor\\Reflection\\DocBlockFactory' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlockFactory.php',
'phpDocumentor\\Reflection\\DocBlockFactoryInterface' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlockFactoryInterface.php',
'phpDocumentor\\Reflection\\DocBlock\\Description' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Description.php',
'phpDocumentor\\Reflection\\DocBlock\\DescriptionFactory' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/DescriptionFactory.php',
'phpDocumentor\\Reflection\\DocBlock\\ExampleFinder' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/ExampleFinder.php',
'phpDocumentor\\Reflection\\DocBlock\\Serializer' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Serializer.php',
'phpDocumentor\\Reflection\\DocBlock\\StandardTagFactory' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/StandardTagFactory.php',
'phpDocumentor\\Reflection\\DocBlock\\Tag' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tag.php',
......@@ -3900,14 +3939,10 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Property' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Property.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\PropertyRead' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyRead.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\PropertyWrite' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/PropertyWrite.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Fqsen' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Fqsen.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Reference' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Reference.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Reference\\Url' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Url.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Return_' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Return_.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\See' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/See.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Since' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Since.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Source' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Source.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\TagWithType' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/TagWithType.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Throws' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Throws.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Uses' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Uses.php',
'phpDocumentor\\Reflection\\DocBlock\\Tags\\Var_' => __DIR__ . '/..' . '/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Var_.php',
......@@ -3921,23 +3956,21 @@ class ComposerStaticInit2a46e5674e69fd121680370ab820bf2e
'phpDocumentor\\Reflection\\ProjectFactory' => __DIR__ . '/..' . '/phpdocumentor/reflection-common/src/ProjectFactory.php',
'phpDocumentor\\Reflection\\Type' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Type.php',
'phpDocumentor\\Reflection\\TypeResolver' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/TypeResolver.php',
'phpDocumentor\\Reflection\\Types\\AbstractList' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/AbstractList.php',
'phpDocumentor\\Reflection\\Types\\Array_' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Array_.php',
'phpDocumentor\\Reflection\\Types\\Boolean' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Boolean.php',
'phpDocumentor\\Reflection\\Types\\Callable_' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Callable_.php',
'phpDocumentor\\Reflection\\Types\\Collection' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Collection.php',
'phpDocumentor\\Reflection\\Types\\Compound' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Compound.php',
'phpDocumentor\\Reflection\\Types\\Context' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Context.php',
'phpDocumentor\\Reflection\\Types\\ContextFactory' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/ContextFactory.php',
'phpDocumentor\\Reflection\\Types\\Float_' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Float_.php',
'phpDocumentor\\Reflection\\Types\\Integer' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Integer.php',
'phpDocumentor\\Reflection\\Types\\Iterable_' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Iterable_.php',
'phpDocumentor\\Reflection\\Types\\Mixed_' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Mixed_.php',
'phpDocumentor\\Reflection\\Types\\Mixed' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Mixed.php',
'phpDocumentor\\Reflection\\Types\\Null_' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Null_.php',
'phpDocumentor\\Reflection\\Types\\Nullable' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Nullable.php',
'phpDocumentor\\Reflection\\Types\\Object_' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Object_.php',
'phpDocumentor\\Reflection\\Types\\Parent_' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Parent_.php',
'phpDocumentor\\Reflection\\Types\\Resource_' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Resource_.php',
'phpDocumentor\\Reflection\\Types\\Resource' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Resource.php',
'phpDocumentor\\Reflection\\Types\\Scalar' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Scalar.php',
'phpDocumentor\\Reflection\\Types\\Self_' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Self_.php',
'phpDocumentor\\Reflection\\Types\\Static_' => __DIR__ . '/..' . '/phpdocumentor/type-resolver/src/Types/Static_.php',
......
......@@ -107,54 +107,38 @@
},
{
"name": "doctrine/inflector",
"version": "1.3.1",
"version_normalized": "1.3.1.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/inflector.git",
"reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1"
},
"version": "v1.1.0",
"version_normalized": "1.1.0.0",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/ec3a55242203ffa6a4b27c58176da97ff0a7aec1",
"reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://mirrors.tencent.com/repository/composer/doctrine/inflector/v1.1.0/doctrine-inflector-v1.1.0.zip",
"reference": "90b2128806bfde671b6952ab8bea493942c1fdae",
"shasum": ""
},
"require": {
"php": "^7.1"
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "^6.2"
"phpunit/phpunit": "4.*"
},
"time": "2019-10-30T19:59:35+00:00",
"time": "2015-11-06T14:35:42+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
"dev-master": "1.1.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector"
"psr-0": {
"Doctrine\\Common\\Inflector\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
......@@ -163,6 +147,10 @@
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
......@@ -183,51 +171,37 @@
},
{
"name": "doctrine/instantiator",
"version": "1.3.0",
"version_normalized": "1.3.0.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "ae466f726242e637cebdd526a7d991b9433bacf1"
},
"version": "1.0.2",
"version_normalized": "1.0.2.0",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1",
"reference": "ae466f726242e637cebdd526a7d991b9433bacf1",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://mirrors.tencent.com/repository/composer/doctrine/instantiator/1.0.2/doctrine-instantiator-1.0.2.zip",
"reference": "26404e0c90565b614ee76b988b9bc8790d77f590",
"shasum": ""
},
"require": {
"php": "^7.1"
"php": "~5.3"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
"phpbench/phpbench": "^0.13",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-shim": "^0.11",
"phpunit/phpunit": "^7.0"
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "2.0.*@ALPHA"
},
"time": "2019-10-21T16:45:58+00:00",
"time": "2014-08-25T15:09:25+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
"psr-0": {
"Doctrine\\Instantiator\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
......@@ -239,7 +213,7 @@
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
"homepage": "https://github.com/doctrine/instantiator",
"keywords": [
"constructor",
"instantiate"
......@@ -1594,45 +1568,35 @@
},
{
"name": "phpdocumentor/reflection-common",
"version": "2.0.0",
"version_normalized": "2.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a"
},
"version": "1.0.1",
"version_normalized": "1.0.1.0",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a",
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://mirrors.tencent.com/repository/composer/phpdocumentor/reflection-common/1.0.1/phpdocumentor-reflection-common-1.0.1.zip",
"reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "~6"
"phpunit/phpunit": "^4.6"
},
"time": "2018-08-07T13:53:10+00:00",
"time": "2017-09-11T18:02:19+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src/"
"phpDocumentor\\Reflection\\": [
"src"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
......@@ -1655,44 +1619,26 @@
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "4.3.4",
"version_normalized": "4.3.4.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c"
},
"version": "3.2.2",
"version_normalized": "3.2.2.0",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c",
"reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://mirrors.tencent.com/repository/composer/phpdocumentor/reflection-docblock/3.2.2/phpdocumentor-reflection-docblock-3.2.2.zip",
"reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157",
"shasum": ""
},
"require": {
"php": "^7.0",
"phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0",
"phpdocumentor/type-resolver": "~0.4 || ^1.0.0",
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0@dev",
"phpdocumentor/type-resolver": "^0.3.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"doctrine/instantiator": "^1.0.5",
"mockery/mockery": "^1.0",
"phpdocumentor/type-resolver": "0.4.*",
"phpunit/phpunit": "^6.4"
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^4.4"
},
"time": "2019-12-28T18:55:12+00:00",
"time": "2017-08-08T06:39:58+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
......@@ -1701,7 +1647,6 @@
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
......@@ -1716,48 +1661,37 @@
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.0.1",
"version_normalized": "1.0.1.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9"
},
"version": "0.3.0",
"version_normalized": "0.3.0.0",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
"reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://mirrors.tencent.com/repository/composer/phpdocumentor/type-resolver/0.3.0/phpdocumentor-type-resolver-0.3.0.zip",
"reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773",
"shasum": ""
},
"require": {
"php": "^7.1",
"phpdocumentor/reflection-common": "^2.0"
"php": "^5.5 || ^7.0",
"phpdocumentor/reflection-common": "^1.0"
},
"require-dev": {
"ext-tokenizer": "^7.1",
"mockery/mockery": "~1",
"phpunit/phpunit": "^7.0"
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^5.2||^4.8.24"
},
"time": "2019-08-22T18:11:29+00:00",
"time": "2017-06-03T08:32:36+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src"
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
......@@ -1767,7 +1701,6 @@
"email": "me@mikevanriel.com"
}
],
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"install-path": "../phpdocumentor/type-resolver"
},
{
......@@ -3710,24 +3643,13 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.15.0",
"version_normalized": "1.15.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14"
},
"version": "v1.19.0",
"version_normalized": "1.19.0.0",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
"reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://mirrors.tencent.com/repository/composer/symfony/polyfill-ctype/v1.19.0/symfony-polyfill-ctype-v1.19.0.zip",
"reference": "aed596913b70fae57be53d86faa2e9ef85a2297b",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
......@@ -3735,23 +3657,26 @@
"suggest": {
"ext-ctype": "For best performance"
},
"time": "2020-02-27T09:26:54+00:00",
"time": "2020-10-23T09:01:57+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.15-dev"
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
......@@ -4492,36 +4417,26 @@
},
{
"name": "webmozart/assert",
"version": "1.7.0",
"version_normalized": "1.7.0.0",
"source": {
"type": "git",
"url": "https://github.com/webmozarts/assert.git",
"reference": "aed98a490f9a8f78468232db345ab9cf606cf598"
},
"version": "1.9.1",
"version_normalized": "1.9.1.0",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598",
"reference": "aed98a490f9a8f78468232db345ab9cf606cf598",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
"url": "https://mirrors.tencent.com/repository/composer/webmozart/assert/1.9.1/webmozart-assert-1.9.1.zip",
"reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0",
"php": "^5.3.3 || ^7.0 || ^8.0",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"vimeo/psalm": "<3.6.0"
"phpstan/phpstan": "<0.12.20",
"vimeo/psalm": "<3.9.1"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^7.5.13"
},
"time": "2020-02-14T12:15:55+00:00",
"time": "2020-07-08T17:02:28+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
......@@ -4529,7 +4444,6 @@
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
......@@ -4550,13 +4464,9 @@
],
"dev": true,
"dev-package-names": [
"doctrine/instantiator",
"fzaninotto/faker",
"hamcrest/hamcrest-php",
"mockery/mockery",
"phpdocumentor/reflection-common",
"phpdocumentor/reflection-docblock",
"phpdocumentor/type-resolver",
"phpspec/prophecy",
"phpunit/php-code-coverage",
"phpunit/php-file-iterator",
......@@ -4573,7 +4483,6 @@
"sebastian/recursion-context",
"sebastian/version",
"symfony/dom-crawler",
"symfony/yaml",
"webmozart/assert"
"symfony/yaml"
]
}
......@@ -5,7 +5,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '6a65bded842127cb11c4764e987e1d101a8b986c',
'reference' => '28a77aa4f4c9c4ee2d223a5fcd2492be745919f7',
'name' => 'laravel/laravel',
'dev' => true,
),
......@@ -41,22 +41,22 @@
'dev_requirement' => false,
),
'doctrine/inflector' => array(
'pretty_version' => '1.3.1',
'version' => '1.3.1.0',
'pretty_version' => 'v1.1.0',
'version' => '1.1.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/inflector',
'aliases' => array(),
'reference' => 'ec3a55242203ffa6a4b27c58176da97ff0a7aec1',
'reference' => '90b2128806bfde671b6952ab8bea493942c1fdae',
'dev_requirement' => false,
),
'doctrine/instantiator' => array(
'pretty_version' => '1.3.0',
'version' => '1.3.0.0',
'pretty_version' => '1.0.2',
'version' => '1.0.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/instantiator',
'aliases' => array(),
'reference' => 'ae466f726242e637cebdd526a7d991b9433bacf1',
'dev_requirement' => true,
'reference' => '26404e0c90565b614ee76b988b9bc8790d77f590',
'dev_requirement' => false,
),
'fzaninotto/faker' => array(
'pretty_version' => 'v1.9.1',
......@@ -328,7 +328,7 @@
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '6a65bded842127cb11c4764e987e1d101a8b986c',
'reference' => '28a77aa4f4c9c4ee2d223a5fcd2492be745919f7',
'dev_requirement' => false,
),
'league/flysystem' => array(
......@@ -413,31 +413,31 @@
'dev_requirement' => false,
),
'phpdocumentor/reflection-common' => array(
'pretty_version' => '2.0.0',
'version' => '2.0.0.0',
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../phpdocumentor/reflection-common',
'aliases' => array(),
'reference' => '63a995caa1ca9e5590304cd845c15ad6d482a62a',
'dev_requirement' => true,
'reference' => '21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6',
'dev_requirement' => false,
),
'phpdocumentor/reflection-docblock' => array(
'pretty_version' => '4.3.4',
'version' => '4.3.4.0',
'pretty_version' => '3.2.2',
'version' => '3.2.2.0',
'type' => 'library',
'install_path' => __DIR__ . '/../phpdocumentor/reflection-docblock',
'aliases' => array(),
'reference' => 'da3fd972d6bafd628114f7e7e036f45944b62e9c',
'dev_requirement' => true,
'reference' => '4aada1f93c72c35e22fb1383b47fee43b8f1d157',
'dev_requirement' => false,
),
'phpdocumentor/type-resolver' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'pretty_version' => '0.3.0',
'version' => '0.3.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../phpdocumentor/type-resolver',
'aliases' => array(),
'reference' => '2e32a6d48972b2c1976ed5d8967145b6cec4a4a9',
'dev_requirement' => true,
'reference' => 'fb3933512008d8162b3cdf9e18dba9309b7c3773',
'dev_requirement' => false,
),
'phpoffice/phpexcel' => array(
'pretty_version' => '1.8.2',
......@@ -722,12 +722,12 @@
'dev_requirement' => false,
),
'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.15.0',
'version' => '1.15.0.0',
'pretty_version' => 'v1.19.0',
'version' => '1.19.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
'aliases' => array(),
'reference' => '4719fa9c18b0464d399f1a63bf624b42b6fa8d14',
'reference' => 'aed596913b70fae57be53d86faa2e9ef85a2297b',
'dev_requirement' => false,
),
'symfony/polyfill-mbstring' => array(
......@@ -842,13 +842,13 @@
'dev_requirement' => false,
),
'webmozart/assert' => array(
'pretty_version' => '1.7.0',
'version' => '1.7.0.0',
'pretty_version' => '1.9.1',
'version' => '1.9.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../webmozart/assert',
'aliases' => array(),
'reference' => 'aed98a490f9a8f78468232db345ab9cf606cf598',
'dev_requirement' => true,
'reference' => 'bafc69caeb4d49c39fd0779086c03a3738cbb389',
'dev_requirement' => false,
),
),
);
vendor/
composer.lock
composer.phar
phpunit.xml
language: php
sudo: false
cache:
directory:
- $HOME/.composer/cache
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
install:
- composer install -n
script:
- phpunit
......@@ -13,20 +13,17 @@
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
],
"require": {
"php": "^7.1"
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "^6.2"
"phpunit/phpunit": "4.*"
},
"autoload": {
"psr-4": { "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" }
},
"autoload-dev": {
"psr-4": { "Doctrine\\Tests\\Common\\Inflector\\": "tests/Doctrine/Tests/Common/Inflector" }
"psr-0": { "Doctrine\\Common\\Inflector\\": "lib/" }
},
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
"dev-master": "1.1.x-dev"
}
}
}
Introduction
============
The Doctrine Inflector has static methods for inflecting text.
The features include pluralization, singularization,
converting between camelCase and under_score and capitalizing
words.
All you need to use the Inflector is the ``Doctrine\Common\Inflector\Inflector``
class.
Installation
============
You can install the Inflector with composer:
.. code-block::
$ composer require doctrine/inflector
Here are the available methods that you can use:
Tableize
========
Converts ``ModelName`` to ``model_name``:
.. code-block:: php
echo Inflector::tableize('ModelName'); // model_name
Classify
========
Converts ``model_name`` to ``ModelName``:
.. code-block:: php
echo Inflector::classify('model_name'); // ModelName
Camelize
========
This method uses `Classify`_ and then converts the first character to lowercase:
.. code-block:: php
echo Inflector::camelize('model_name'); // modelName
ucwords
=======
Takes a string and capitalizes all of the words, like PHP's built-in
ucwords function. This extends that behavior, however, by allowing the
word delimiters to be configured, rather than only separating on
whitespace.
Here is an example:
.. code-block:: php
$string = 'top-o-the-morning to all_of_you!';
echo Inflector::ucwords($string); // Top-O-The-Morning To All_of_you!
echo Inflector::ucwords($string, '-_ '); // Top-O-The-Morning To All_Of_You!
Pluralize
=========
Returns a word in plural form.
.. code-block:: php
echo Inflector::pluralize('browser'); // browsers
Singularize
===========
.. code-block:: php
echo Inflector::singularize('browsers'); // browser
Rules
=====
Customize the rules for pluralization and singularization:
.. code-block:: php
Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
Inflector::rules('plural', [
'rules' => ['/^(inflect)ors$/i' => '\1ables'],
'uninflected' => ['dontinflectme'],
'irregular' => ['red' => 'redlings']
]);
The arguments for the ``rules`` method are:
- ``$type`` - The type of inflection, either ``plural`` or ``singular``
- ``$rules`` - An array of rules to be added.
- ``$reset`` - If true, will unset default inflections for all new rules that are being defined in $rules.
Reset
=====
Clears Inflectors inflected value caches, and resets the inflection
rules to the initial values.
.. code-block:: php
Inflector::reset();
Slugify
=======
You can easily use the Inflector to create a slug from a string of text
by using the `tableize`_ method and replacing underscores with hyphens:
.. code-block:: php
public static function slugify(string $text) : string
{
return str_replace('_', '-', Inflector::tableize($text));
}
......@@ -38,7 +38,7 @@ class Inflector
/**
* Plural inflector rules.
*
* @var string[][]
* @var array
*/
private static $plural = array(
'rules' => array(
......@@ -49,11 +49,10 @@ class Inflector
'/(matr|vert|ind)(ix|ex)$/i' => '\1ices',
'/(x|ch|ss|sh)$/i' => '\1es',
'/([^aeiouy]|qu)y$/i' => '\1ies',
'/(hive|gulf)$/i' => '\1s',
'/(hive)$/i' => '\1s',
'/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
'/sis$/i' => 'ses',
'/([ti])um$/i' => '\1a',
'/(c)riterion$/i' => '\1riteria',
'/(p)erson$/i' => '\1eople',
'/(m)an$/i' => '\1en',
'/(c)hild$/i' => '\1hildren',
......@@ -68,16 +67,7 @@ class Inflector
'/$/' => 's',
),
'uninflected' => array(
'.*[nrlm]ese',
'.*deer',
'.*fish',
'.*measles',
'.*ois',
'.*pox',
'.*sheep',
'people',
'cookie',
'police',
'.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', 'people', 'cookie'
),
'irregular' => array(
'atlas' => 'atlases',
......@@ -85,9 +75,7 @@ class Inflector
'beef' => 'beefs',
'brother' => 'brothers',
'cafe' => 'cafes',
'canvas' => 'canvases',
'chateau' => 'chateaux',
'niveau' => 'niveaux',
'child' => 'children',
'cookie' => 'cookies',
'corpus' => 'corpuses',
......@@ -100,16 +88,13 @@ class Inflector
'foot' => 'feet',
'fungus' => 'fungi',
'ganglion' => 'ganglions',
'gas' => 'gases',
'genie' => 'genies',
'genus' => 'genera',
'goose' => 'geese',
'graffito' => 'graffiti',
'hippopotamus' => 'hippopotami',
'hoof' => 'hoofs',
'human' => 'humans',
'iris' => 'irises',
'larva' => 'larvae',
'leaf' => 'leaves',
'loaf' => 'loaves',
'man' => 'men',
......@@ -127,7 +112,6 @@ class Inflector
'octopus' => 'octopuses',
'opus' => 'opuses',
'ox' => 'oxen',
'passerby' => 'passersby',
'penis' => 'penises',
'person' => 'people',
'plateau' => 'plateaux',
......@@ -142,7 +126,6 @@ class Inflector
'tornado' => 'tornadoes',
'trilby' => 'trilbys',
'turf' => 'turfs',
'valve' => 'valves',
'volcano' => 'volcanoes',
)
);
......@@ -150,7 +133,7 @@ class Inflector
/**
* Singular inflector rules.
*
* @var string[][]
* @var array
*/
private static $singular = array(
'rules' => array(
......@@ -178,12 +161,9 @@ class Inflector
'/(tive)s$/i' => '\1',
'/(hive)s$/i' => '\1',
'/(drive)s$/i' => '\1',
'/(dive)s$/i' => '\1',
'/(olive)s$/i' => '\1',
'/([^fo])ves$/i' => '\1fe',
'/(^analy)ses$/i' => '\1sis',
'/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
'/(c)riteria$/i' => '\1riterion',
'/([ti])a$/i' => '\1um',
'/(p)eople$/i' => '\1\2erson',
'/(m)en$/i' => '\1an',
......@@ -203,27 +183,17 @@ class Inflector
'.*pox',
'.*sheep',
'.*ss',
'data',
'police',
'pants',
'clothes',
),
'irregular' => array(
'abuses' => 'abuse',
'avalanches' => 'avalanche',
'caches' => 'cache',
'criteria' => 'criterion',
'curves' => 'curve',
'emphases' => 'emphasis',
'foes' => 'foe',
'geese' => 'goose',
'graves' => 'grave',
'hoaxes' => 'hoax',
'media' => 'medium',
'neuroses' => 'neurosis',
'waves' => 'wave',
'oases' => 'oasis',
'valves' => 'valve',
'criteria' => 'criterion',
'curves' => 'curve',
'emphases' => 'emphasis',
'foes' => 'foe',
'hoaxes' => 'hoax',
'media' => 'medium',
'neuroses' => 'neurosis',
'waves' => 'wave',
'oases' => 'oasis',
)
);
......@@ -233,18 +203,18 @@ class Inflector
* @var array
*/
private static $uninflected = array(
'.*?media', 'Amoyese', 'audio', 'bison', 'Borghese', 'bream', 'breeches',
'britches', 'buffalo', 'cantus', 'carp', 'chassis', 'clippers', 'cod', 'coitus', 'compensation', 'Congoese',
'contretemps', 'coreopsis', 'corps', 'data', 'debris', 'deer', 'diabetes', 'djinn', 'education', 'eland',
'elk', 'emoji', 'equipment', 'evidence', 'Faroese', 'feedback', 'fish', 'flounder', 'Foochowese',
'Furniture', 'furniture', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'gold',
'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings', 'jackanapes', 'jedi',
'Kiplingese', 'knowledge', 'Kongoese', 'love', 'Lucchese', 'Luggage', 'mackerel', 'Maltese', 'metadata',
'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese', 'nutrition', 'offspring',
'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'plankton', 'pliers', 'pokemon', 'police', 'Portuguese',
'proceedings', 'rabies', 'rain', 'rhinoceros', 'rice', 'salmon', 'Sarawakese', 'scissors', 'sea[- ]bass',
'series', 'Shavese', 'shears', 'sheep', 'siemens', 'species', 'staff', 'swine', 'traffic',
'trousers', 'trout', 'tuna', 'us', 'Vermontese', 'Wenchowese', 'wheat', 'whiting', 'wildebeest', 'Yengeese'
'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus',
'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps',
'debris', 'diabetes', 'djinn', 'eland', 'elk', 'equipment', 'Faroese', 'flounder',
'Foochowese', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti',
'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings',
'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'mackerel', 'Maltese', '.*?media',
'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese',
'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese',
'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors',
'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species', 'staff', 'swine',
'testes', 'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese', 'whiting',
'wildebeest', 'Yengeese'
);
/**
......@@ -263,24 +233,36 @@ class Inflector
/**
* Converts a word into the format for a Doctrine table name. Converts 'ModelName' to 'model_name'.
*
* @param string $word The word to tableize.
*
* @return string The tableized word.
*/
public static function tableize(string $word) : string
public static function tableize($word)
{
return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $word));
}
/**
* Converts a word into the format for a Doctrine class name. Converts 'table_name' to 'TableName'.
*
* @param string $word The word to classify.
*
* @return string The classified word.
*/
public static function classify(string $word) : string
public static function classify($word)
{
return str_replace([' ', '_', '-'], '', ucwords($word, ' _-'));
return str_replace(" ", "", ucwords(strtr($word, "_-", " ")));
}
/**
* Camelizes a word. This uses the classify() method and turns the first character to lowercase.
*
* @param string $word The word to camelize.
*
* @return string The camelized word.
*/
public static function camelize(string $word) : string
public static function camelize($word)
{
return lcfirst(self::classify($word));
}
......@@ -289,7 +271,7 @@ class Inflector
* Uppercases words with configurable delimeters between words.
*
* Takes a string and capitalizes all of the words, like PHP's built-in
* ucwords function. This extends that behavior, however, by allowing the
* ucwords function. This extends that behavior, however, by allowing the
* word delimeters to be configured, rather than only separating on
* whitespace.
*
......@@ -310,16 +292,24 @@ class Inflector
*
* @return string The string with all delimeter-separated words capitalized.
*/
public static function ucwords(string $string, string $delimiters = " \n\t\r\0\x0B-") : string
public static function ucwords($string, $delimiters = " \n\t\r\0\x0B-")
{
return ucwords($string, $delimiters);
return preg_replace_callback(
'/[^' . preg_quote($delimiters, '/') . ']+/',
function($matches) {
return ucfirst($matches[0]);
},
$string
);
}
/**
* Clears Inflectors inflected value caches, and resets the inflection
* rules to the initial values.
*
* @return void
*/
public static function reset() : void
public static function reset()
{
if (empty(self::$initialState)) {
self::$initialState = get_class_vars('Inflector');
......@@ -328,7 +318,7 @@ class Inflector
}
foreach (self::$initialState as $key => $val) {
if ($key !== 'initialState') {
if ($key != 'initialState') {
self::${$key} = $val;
}
}
......@@ -348,14 +338,14 @@ class Inflector
* ));
* }}}
*
* @param string $type The type of inflection, either 'plural' or 'singular'
* @param array|iterable $rules An array of rules to be added.
* @param boolean $reset If true, will unset default inflections for all
* new rules that are being defined in $rules.
* @param string $type The type of inflection, either 'plural' or 'singular'
* @param array $rules An array of rules to be added.
* @param boolean $reset If true, will unset default inflections for all
* new rules that are being defined in $rules.
*
* @return void
*/
public static function rules(string $type, iterable $rules, bool $reset = false) : void
public static function rules($type, $rules, $reset = false)
{
foreach ($rules as $rule => $pattern) {
if ( ! is_array($pattern)) {
......@@ -393,7 +383,7 @@ class Inflector
*
* @return string The word in plural form.
*/
public static function pluralize(string $word) : string
public static function pluralize($word)
{
if (isset(self::$cache['pluralize'][$word])) {
return self::$cache['pluralize'][$word];
......@@ -413,8 +403,8 @@ class Inflector
}
if (preg_match('/(.*)\\b(' . self::$plural['cacheIrregular'] . ')$/i', $word, $regs)) {
self::$cache['pluralize'][$word] = $regs[1] . $word[0] . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1);
self::$cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1);
return self::$cache['pluralize'][$word];
}
......@@ -440,7 +430,7 @@ class Inflector
*
* @return string The word in singular form.
*/
public static function singularize(string $word) : string
public static function singularize($word)
{
if (isset(self::$cache['singularize'][$word])) {
return self::$cache['singularize'][$word];
......@@ -461,13 +451,13 @@ class Inflector
}
if (!isset(self::$singular['cacheUninflected']) || !isset(self::$singular['cacheIrregular'])) {
self::$singular['cacheUninflected'] = '(?:' . implode('|', self::$singular['merged']['uninflected']) . ')';
self::$singular['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$singular['merged']['irregular'])) . ')';
self::$singular['cacheUninflected'] = '(?:' . join('|', self::$singular['merged']['uninflected']) . ')';
self::$singular['cacheIrregular'] = '(?:' . join('|', array_keys(self::$singular['merged']['irregular'])) . ')';
}
if (preg_match('/(.*)\\b(' . self::$singular['cacheIrregular'] . ')$/i', $word, $regs)) {
self::$cache['singularize'][$word] = $regs[1] . $word[0] . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1);
self::$cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1);
return self::$cache['singularize'][$word];
}
......
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="./tests/Doctrine/Tests/TestInit.php"
>
<testsuites>
<testsuite name="Doctrine Inflector Test Suite">
<directory>./tests/Doctrine/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./lib/Doctrine/</directory>
</whitelist>
</filter>
<groups>
<exclude>
<group>performance</group>
</exclude>
</groups>
</phpunit>
<?php
namespace Doctrine\Tests\Common\Inflector;
use Doctrine\Tests\DoctrineTestCase;
use Doctrine\Common\Inflector\Inflector;
class InflectorTest extends DoctrineTestCase
{
/**
* Singular & Plural test data. Returns an array of sample words.
*
* @return array
*/
public function dataSampleWords()
{
Inflector::reset();
// In the format array('singular', 'plural')
return array(
array('', ''),
array('Alias', 'Aliases'),
array('alumnus', 'alumni'),
array('analysis', 'analyses'),
array('aquarium', 'aquaria'),
array('arch', 'arches'),
array('atlas', 'atlases'),
array('axe', 'axes'),
array('baby', 'babies'),
array('bacillus', 'bacilli'),
array('bacterium', 'bacteria'),
array('bureau', 'bureaus'),
array('bus', 'buses'),
array('Bus', 'Buses'),
array('cactus', 'cacti'),
array('cafe', 'cafes'),
array('calf', 'calves'),
array('categoria', 'categorias'),
array('chateau', 'chateaux'),
array('cherry', 'cherries'),
array('child', 'children'),
array('church', 'churches'),
array('circus', 'circuses'),
array('city', 'cities'),
array('cod', 'cod'),
array('cookie', 'cookies'),
array('copy', 'copies'),
array('crisis', 'crises'),
array('criterion', 'criteria'),
array('curriculum', 'curricula'),
array('curve', 'curves'),
array('deer', 'deer'),
array('demo', 'demos'),
array('dictionary', 'dictionaries'),
array('domino', 'dominoes'),
array('dwarf', 'dwarves'),
array('echo', 'echoes'),
array('elf', 'elves'),
array('emphasis', 'emphases'),
array('family', 'families'),
array('fax', 'faxes'),
array('fish', 'fish'),
array('flush', 'flushes'),
array('fly', 'flies'),
array('focus', 'foci'),
array('foe', 'foes'),
array('food_menu', 'food_menus'),
array('FoodMenu', 'FoodMenus'),
array('foot', 'feet'),
array('fungus', 'fungi'),
array('glove', 'gloves'),
array('half', 'halves'),
array('hero', 'heroes'),
array('hippopotamus', 'hippopotami'),
array('hoax', 'hoaxes'),
array('house', 'houses'),
array('human', 'humans'),
array('identity', 'identities'),
array('index', 'indices'),
array('iris', 'irises'),
array('kiss', 'kisses'),
array('knife', 'knives'),
array('leaf', 'leaves'),
array('life', 'lives'),
array('loaf', 'loaves'),
array('man', 'men'),
array('matrix', 'matrices'),
array('matrix_row', 'matrix_rows'),
array('medium', 'media'),
array('memorandum', 'memoranda'),
array('menu', 'menus'),
array('Menu', 'Menus'),
array('mess', 'messes'),
array('moose', 'moose'),
array('motto', 'mottoes'),
array('mouse', 'mice'),
array('neurosis', 'neuroses'),
array('news', 'news'),
array('NodeMedia', 'NodeMedia'),
array('nucleus', 'nuclei'),
array('oasis', 'oases'),
array('octopus', 'octopuses'),
array('pass', 'passes'),
array('person', 'people'),
array('plateau', 'plateaux'),
array('potato', 'potatoes'),
array('powerhouse', 'powerhouses'),
array('quiz', 'quizzes'),
array('radius', 'radii'),
array('reflex', 'reflexes'),
array('roof', 'roofs'),
array('runner-up', 'runners-up'),
array('scarf', 'scarves'),
array('scratch', 'scratches'),
array('series', 'series'),
array('sheep', 'sheep'),
array('shelf', 'shelves'),
array('shoe', 'shoes'),
array('son-in-law', 'sons-in-law'),
array('species', 'species'),
array('splash', 'splashes'),
array('spy', 'spies'),
array('stimulus', 'stimuli'),
array('stitch', 'stitches'),
array('story', 'stories'),
array('syllabus', 'syllabi'),
array('tax', 'taxes'),
array('terminus', 'termini'),
array('thesis', 'theses'),
array('thief', 'thieves'),
array('tomato', 'tomatoes'),
array('tooth', 'teeth'),
array('tornado', 'tornadoes'),
array('try', 'tries'),
array('vertex', 'vertices'),
array('virus', 'viri'),
array('volcano', 'volcanoes'),
array('wash', 'washes'),
array('watch', 'watches'),
array('wave', 'waves'),
array('wharf', 'wharves'),
array('wife', 'wives'),
array('woman', 'women'),
);
}
/**
* testInflectingSingulars method
*
* @dataProvider dataSampleWords
* @return void
*/
public function testInflectingSingulars($singular, $plural)
{
$this->assertEquals(
$singular,
Inflector::singularize($plural),
"'$plural' should be singularized to '$singular'"
);
}
/**
* testInflectingPlurals method
*
* @dataProvider dataSampleWords
* @return void
*/
public function testInflectingPlurals($singular, $plural)
{
$this->assertEquals(
$plural,
Inflector::pluralize($singular),
"'$singular' should be pluralized to '$plural'"
);
}
/**
* testCustomPluralRule method
*
* @return void
*/
public function testCustomPluralRule()
{
Inflector::reset();
Inflector::rules('plural', array('/^(custom)$/i' => '\1izables'));
$this->assertEquals(Inflector::pluralize('custom'), 'customizables');
Inflector::rules('plural', array('uninflected' => array('uninflectable')));
$this->assertEquals(Inflector::pluralize('uninflectable'), 'uninflectable');
Inflector::rules('plural', array(
'rules' => array('/^(alert)$/i' => '\1ables'),
'uninflected' => array('noflect', 'abtuse'),
'irregular' => array('amaze' => 'amazable', 'phone' => 'phonezes')
));
$this->assertEquals(Inflector::pluralize('noflect'), 'noflect');
$this->assertEquals(Inflector::pluralize('abtuse'), 'abtuse');
$this->assertEquals(Inflector::pluralize('alert'), 'alertables');
$this->assertEquals(Inflector::pluralize('amaze'), 'amazable');
$this->assertEquals(Inflector::pluralize('phone'), 'phonezes');
}
/**
* testCustomSingularRule method
*
* @return void
*/
public function testCustomSingularRule()
{
Inflector::reset();
Inflector::rules('singular', array('/(eple)r$/i' => '\1', '/(jente)r$/i' => '\1'));
$this->assertEquals(Inflector::singularize('epler'), 'eple');
$this->assertEquals(Inflector::singularize('jenter'), 'jente');
Inflector::rules('singular', array(
'rules' => array('/^(bil)er$/i' => '\1', '/^(inflec|contribu)tors$/i' => '\1ta'),
'uninflected' => array('singulars'),
'irregular' => array('spins' => 'spinor')
));
$this->assertEquals(Inflector::singularize('inflectors'), 'inflecta');
$this->assertEquals(Inflector::singularize('contributors'), 'contributa');
$this->assertEquals(Inflector::singularize('spins'), 'spinor');
$this->assertEquals(Inflector::singularize('singulars'), 'singulars');
}
/**
* test that setting new rules clears the inflector caches.
*
* @return void
*/
public function testRulesClearsCaches()
{
Inflector::reset();
$this->assertEquals(Inflector::singularize('Bananas'), 'Banana');
$this->assertEquals(Inflector::pluralize('Banana'), 'Bananas');
Inflector::rules('singular', array(
'rules' => array('/(.*)nas$/i' => '\1zzz')
));
$this->assertEquals('Banazzz', Inflector::singularize('Bananas'), 'Was inflected with old rules.');
Inflector::rules('plural', array(
'rules' => array('/(.*)na$/i' => '\1zzz'),
'irregular' => array('corpus' => 'corpora')
));
$this->assertEquals(Inflector::pluralize('Banana'), 'Banazzz', 'Was inflected with old rules.');
$this->assertEquals(Inflector::pluralize('corpus'), 'corpora', 'Was inflected with old irregular form.');
}
/**
* Test resetting inflection rules.
*
* @return void
*/
public function testCustomRuleWithReset()
{
Inflector::reset();
$uninflected = array('atlas', 'lapis', 'onibus', 'pires', 'virus', '.*x');
$pluralIrregular = array('as' => 'ases');
Inflector::rules('singular', array(
'rules' => array('/^(.*)(a|e|o|u)is$/i' => '\1\2l'),
'uninflected' => $uninflected,
), true);
Inflector::rules('plural', array(
'rules' => array(
'/^(.*)(a|e|o|u)l$/i' => '\1\2is',
),
'uninflected' => $uninflected,
'irregular' => $pluralIrregular
), true);
$this->assertEquals(Inflector::pluralize('Alcool'), 'Alcoois');
$this->assertEquals(Inflector::pluralize('Atlas'), 'Atlas');
$this->assertEquals(Inflector::singularize('Alcoois'), 'Alcool');
$this->assertEquals(Inflector::singularize('Atlas'), 'Atlas');
}
/**
* Test basic ucwords functionality.
*
* @return void
*/
public function testUcwords()
{
$this->assertSame('Top-O-The-Morning To All_of_you!', Inflector::ucwords( 'top-o-the-morning to all_of_you!'));
}
/**
* Test ucwords functionality with custom delimeters.
*
* @return void
*/
public function testUcwordsWithCustomDelimeters()
{
$this->assertSame('Top-O-The-Morning To All_Of_You!', Inflector::ucwords( 'top-o-the-morning to all_of_you!', '-_ '));
}
}
<?php
namespace Doctrine\Tests;
/**
* Base testcase class for all Doctrine testcases.
*/
abstract class DoctrineTestCase extends \PHPUnit_Framework_TestCase
{
}
\ No newline at end of file
<?php
/*
* This file bootstraps the test environment.
*/
namespace Doctrine\Tests;
error_reporting(E_ALL | E_STRICT);
// register silently failing autoloader
spl_autoload_register(function($class)
{
if (0 === strpos($class, 'Doctrine\Tests\\')) {
$path = __DIR__.'/../../'.strtr($class, '\\', '/').'.php';
if (is_file($path) && is_readable($path)) {
require_once $path;
return true;
}
} else if (0 === strpos($class, 'Doctrine\Common\\')) {
$path = __DIR__.'/../../../lib/'.($class = strtr($class, '\\', '/')).'.php';
if (is_file($path) && is_readable($path)) {
require_once $path;
return true;
}
}
});
{
"active": true,
"name": "Instantiator",
"slug": "instantiator",
"docsSlug": "doctrine-instantiator",
"codePath": "/src",
"versions": [
{
"name": "1.1",
"branchName": "master",
"slug": "latest",
"aliases": [
"current",
"stable"
],
"maintained": true,
"current": true
},
{
"name": "1.0",
"branchName": "1.0.x",
"slug": "1.0"
}
]
}
patreon: phpdoctrine
tidelift: packagist/doctrine%2Finstantiator
custom: https://www.doctrine-project.org/sponsorship.html
phpunit.xml
composer.lock
build
vendor
coverage.clover
\ No newline at end of file
before_commands:
- "composer install --no-dev --prefer-source"
checks:
php:
excluded_dependencies:
- phpstan/phpstan
- "composer install --prefer-source"
tools:
external_code_coverage:
timeout: 600
php_code_coverage:
enabled: true
timeout: 300
filter:
excluded_paths: ["tests", "vendor"]
test_command: ./vendor/bin/phpunit
php_code_sniffer:
enabled: true
config:
standard: PSR2
filter:
paths: ["src/*", "tests/*"]
excluded_paths: []
php_cpd:
enabled: true
excluded_dirs: ["tests", "vendor"]
excluded_dirs: ["build/*", "tests", "vendor"]
php_cs_fixer:
enabled: true
config:
......@@ -30,7 +24,7 @@ tools:
paths: ["src/*", "tests/*"]
php_loc:
enabled: true
excluded_dirs: ["tests", "vendor"]
excluded_dirs: ["build", "tests", "vendor"]
php_mess_detector:
enabled: true
config:
......@@ -40,9 +34,13 @@ tools:
paths: ["src/*"]
php_pdepend:
enabled: true
excluded_dirs: ["tests", "vendor"]
excluded_dirs: ["build", "tests", "vendor"]
php_analyzer:
enabled: true
filter:
paths: ["src/*", "tests/*"]
php_hhvm:
enabled: true
filter:
paths: ["src/*", "tests/*"]
sensiolabs_security_checker: true
set -x
if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ] || [ "$TRAVIS_PHP_VERSION" = 'hhvm-nightly' ] ; then
curl -sS https://getcomposer.org/installer > composer-installer.php
hhvm composer-installer.php
hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 composer.phar update --prefer-source
elif [ "$TRAVIS_PHP_VERSION" = '5.3.3' ] ; then
composer self-update
composer update --prefer-source --no-dev
composer dump-autoload
else
composer self-update
composer update --prefer-source
fi
language: php
php:
- 5.3.3
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm
- hhvm-nightly
before_script:
- ./.travis.install.sh
script:
- sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3.3' ]; then phpunit; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.3.3' ]; then ./vendor/bin/phpunit; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.3.3' ]; then ./vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/; fi"
- sh -c "if [[ '$TRAVIS_PHP_VERSION' != '5.3.3' && '$TRAVIS_PHP_VERSION' != '5.4.29' && '$TRAVIS_PHP_VERSION' != '5.5.13' ]]; then php -n ./vendor/bin/athletic -p ./tests/DoctrineTest/InstantiatorPerformance/ -f GroupedFormatter; fi"
after_script:
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '5.3.3' ]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi"
matrix:
allow_failures:
- php: 5.6 # Depends on https://github.com/php/php-src/pull/733
- php: hhvm-nightly
# Contributing
* Follow the [Doctrine Coding Standard](https://github.com/doctrine/coding-standard)
* Coding standard for the project is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
* The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php)
* Any contribution must provide tests for additional introduced conditions
* Any un-confirmed issue needs a failing test case before being accepted
......
......@@ -6,6 +6,7 @@ This library provides a way of avoiding usage of constructors when instantiating
[![Code Coverage](https://scrutinizer-ci.com/g/doctrine/instantiator/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/doctrine/instantiator/?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/doctrine/instantiator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/doctrine/instantiator/?branch=master)
[![Dependency Status](https://www.versioneye.com/package/php--doctrine--instantiator/badge.svg)](https://www.versioneye.com/package/php--doctrine--instantiator)
[![HHVM Status](http://hhvm.h4cc.de/badge/doctrine/instantiator.png)](http://hhvm.h4cc.de/package/doctrine/instantiator)
[![Latest Stable Version](https://poser.pugx.org/doctrine/instantiator/v/stable.png)](https://packagist.org/packages/doctrine/instantiator)
[![Latest Unstable Version](https://poser.pugx.org/doctrine/instantiator/v/unstable.png)](https://packagist.org/packages/doctrine/instantiator)
......@@ -15,18 +16,18 @@ This library provides a way of avoiding usage of constructors when instantiating
The suggested installation method is via [composer](https://getcomposer.org/):
```sh
php composer.phar require "doctrine/instantiator:~1.0.3"
php composer.phar require "doctrine/instantiator:~1.0,>=1.0.2"
```
## Usage
The instantiator is able to create new instances of any class without using the constructor or any API of the class
The instantiator is able to create new instances of any class without using the constructor of the class
itself:
```php
$instantiator = new \Doctrine\Instantiator\Instantiator();
$instance = $instantiator->instantiate(\My\ClassName\Here::class);
$instance = $instantiator->instantiate('My\\ClassName\\Here');
```
## Contributing
......
......@@ -3,7 +3,7 @@
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"type": "library",
"license": "MIT",
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
"homepage": "https://github.com/doctrine/instantiator",
"keywords": [
"instantiate",
"constructor"
......@@ -16,20 +16,18 @@
}
],
"require": {
"php": "^7.1"
"php": "~5.3"
},
"require-dev": {
"ext-phar": "*",
"ext-pdo": "*",
"doctrine/coding-standard": "^6.0",
"phpbench/phpbench": "^0.13",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-shim": "^0.11",
"phpunit/phpunit": "^7.0"
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "2.0.*@ALPHA",
"athletic/athletic": "~0.1.8"
},
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
"psr-0": {
"Doctrine\\Instantiator\\": "src"
}
},
"autoload-dev": {
......@@ -41,7 +39,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
"dev-master": "1.0.x-dev"
}
}
}
Introduction
============
This library provides a way of avoiding usage of constructors when instantiating PHP classes.
Installation
============
The suggested installation method is via `composer`_:
.. code-block:: console
$ composer require doctrine/instantiator
Usage
=====
The instantiator is able to create new instances of any class without
using the constructor or any API of the class itself:
.. code-block:: php
<?php
use Doctrine\Instantiator\Instantiator;
use App\Entities\User;
$instantiator = new Instantiator();
$user = $instantiator->instantiate(User::class);
Contributing
============
- Follow the `Doctrine Coding Standard`_
- The project will follow strict `object calisthenics`_
- Any contribution must provide tests for additional introduced
conditions
- Any un-confirmed issue needs a failing test case before being
accepted
- Pull requests must be sent from a new hotfix/feature branch, not from
``master``.
Testing
=======
The PHPUnit version to be used is the one installed as a dev- dependency
via composer:
.. code-block:: console
$ ./vendor/bin/phpunit
Accepted coverage for new contributions is 80%. Any contribution not
satisfying this requirement won’t be merged.
Credits
=======
This library was migrated from `ocramius/instantiator`_, which has been
donated to the doctrine organization, and which is now deprecated in
favour of this package.
.. _composer: https://getcomposer.org/
.. _CONTRIBUTING.md: CONTRIBUTING.md
.. _ocramius/instantiator: https://github.com/Ocramius/Instantiator
.. _Doctrine Coding Standard: https://github.com/doctrine/coding-standard
.. _object calisthenics: http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php
{
"bootstrap": "vendor/autoload.php",
"path": "tests/DoctrineTest/InstantiatorPerformance"
}
<?xml version="1.0"?>
<ruleset>
<arg name="basepath" value="."/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors"/>
<!-- Ignore warnings, show progress of the run and show sniff names -->
<arg value="nps"/>
<file>src</file>
<file>tests</file>
<rule ref="Doctrine">
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint"/>
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint"/>
<exclude name="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly.ReferencedGeneralException"/>
</rule>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming">
<exclude-pattern>tests/DoctrineTest/InstantiatorTestAsset/AbstractClassAsset.php</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming">
<exclude-pattern>src/Doctrine/Instantiator/Exception/UnexpectedValueException.php</exclude-pattern>
<exclude-pattern>src/Doctrine/Instantiator/Exception/InvalidArgumentException.php</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming">
<exclude-pattern>src/Doctrine/Instantiator/Exception/ExceptionInterface.php</exclude-pattern>
<exclude-pattern>src/Doctrine/Instantiator/InstantiatorInterface.php</exclude-pattern>
</rule>
</ruleset>
<?xml version="1.0" encoding="UTF-8" ?>
<ruleset
name="ProxyManager rules"
name="Instantiator rules"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
>
<rule ref="rulesets/cleancode.xml">
<!-- static access is used for caching purposes -->
<exclude name="StaticAccess"/>
</rule>
<rule ref="rulesets/codesize.xml"/>
<rule ref="rulesets/controversial.xml"/>
<rule ref="rulesets/design.xml"/>
<rule ref="rulesets/naming.xml"/>
<rule ref="rulesets/unusedcode.xml"/>
<rule ref="rulesets/design.xml">
<!-- eval is needed to generate runtime classes -->
<exclude name="EvalExpression"/>
</rule>
<rule ref="rulesets/naming.xml">
<exclude name="LongVariable"/>
</rule>
<rule ref="rulesets/naming.xml/LongVariable">
<rule
name="NPathComplexity"
message="The {0} {1}() has an NPath complexity of {2}. The configured NPath complexity threshold is {3}."
class="PHP_PMD_Rule_Design_NpathComplexity"
>
<properties>
<property name="minimum">40</property>
<property name="minimum" description="The npath reporting threshold" value="10"/>
</properties>
</rule>
</ruleset>
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
parameters:
level: max
paths:
- src
- tests
ignoreErrors:
-
message: '#::__construct\(\) does not call parent constructor from#'
path: '*/tests/DoctrineTest/InstantiatorTestAsset/*.php'
# dynamic properties confuse static analysis
-
message: '#Access to an undefined property object::\$foo\.#'
path: '*/tests/DoctrineTest/InstantiatorTest/InstantiatorTest.php'
<?xml version="1.0"?>
<phpunit
bootstrap="./vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
verbose="true"
stopOnFailure="false"
processIsolation="false"
backupGlobals="false"
syntaxCheck="true"
>
<testsuite name="Doctrine\Instantiator tests">
<directory>./tests/DoctrineTest/InstantiatorTest</directory>
</testsuite>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="./coverage.clover"/>
</logging>
</phpunit>
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Instantiator\Exception;
use Throwable;
/**
* Base exception marker interface for the instantiator component
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
interface ExceptionInterface extends Throwable
interface ExceptionInterface
{
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Instantiator\Exception;
use InvalidArgumentException as BaseInvalidArgumentException;
use ReflectionClass;
use const PHP_VERSION_ID;
use function interface_exists;
use function sprintf;
use function trait_exists;
/**
* Exception for invalid arguments provided to the instantiator
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class InvalidArgumentException extends BaseInvalidArgumentException implements ExceptionInterface
{
public static function fromNonExistingClass(string $className) : self
/**
* @param string $className
*
* @return self
*/
public static function fromNonExistingClass($className)
{
if (interface_exists($className)) {
return new self(sprintf('The provided type "%s" is an interface, and can not be instantiated', $className));
......@@ -27,7 +47,12 @@ class InvalidArgumentException extends BaseInvalidArgumentException implements E
return new self(sprintf('The provided class "%s" does not exist', $className));
}
public static function fromAbstractClass(ReflectionClass $reflectionClass) : self
/**
* @param ReflectionClass $reflectionClass
*
* @return self
*/
public static function fromAbstractClass(ReflectionClass $reflectionClass)
{
return new self(sprintf(
'The provided class "%s" is abstract, and can not be instantiated',
......
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Instantiator\Exception;
use Exception;
use ReflectionClass;
use UnexpectedValueException as BaseUnexpectedValueException;
use function sprintf;
/**
* Exception for given parameters causing invalid/unexpected state on instantiation
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class UnexpectedValueException extends BaseUnexpectedValueException implements ExceptionInterface
{
public static function fromSerializationTriggeredException(
ReflectionClass $reflectionClass,
Exception $exception
) : self {
/**
* @param ReflectionClass $reflectionClass
* @param Exception $exception
*
* @return self
*/
public static function fromSerializationTriggeredException(ReflectionClass $reflectionClass, Exception $exception)
{
return new self(
sprintf(
'An exception was raised while trying to instantiate an instance of "%s" via un-serialization',
......@@ -26,13 +48,22 @@ class UnexpectedValueException extends BaseUnexpectedValueException implements E
);
}
/**
* @param ReflectionClass $reflectionClass
* @param string $errorString
* @param int $errorCode
* @param string $errorFile
* @param int $errorLine
*
* @return UnexpectedValueException
*/
public static function fromUncleanUnSerialization(
ReflectionClass $reflectionClass,
string $errorString,
int $errorCode,
string $errorFile,
int $errorLine
) : self {
$errorString,
$errorCode,
$errorFile,
$errorLine
) {
return new self(
sprintf(
'Could not produce an instance of "%s" via un-serialization, since an error was triggered '
......
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Instantiator;
use ArrayIterator;
use Closure;
use Doctrine\Instantiator\Exception\InvalidArgumentException;
use Doctrine\Instantiator\Exception\UnexpectedValueException;
use Exception;
use ReflectionClass;
use ReflectionException;
use Serializable;
use function class_exists;
use function is_subclass_of;
use function restore_error_handler;
use function set_error_handler;
use function sprintf;
use function strlen;
use function unserialize;
/**
* {@inheritDoc}
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
final class Instantiator implements InstantiatorInterface
{
......@@ -27,22 +37,18 @@ final class Instantiator implements InstantiatorInterface
* the method {@see \Serializable::unserialize()} when dealing with classes implementing
* the {@see \Serializable} interface.
*/
public const SERIALIZATION_FORMAT_USE_UNSERIALIZER = 'C';
public const SERIALIZATION_FORMAT_AVOID_UNSERIALIZER = 'O';
const SERIALIZATION_FORMAT_USE_UNSERIALIZER = 'C';
const SERIALIZATION_FORMAT_AVOID_UNSERIALIZER = 'O';
/**
* Used to instantiate specific classes, indexed by class name.
*
* @var callable[]
* @var \Closure[] of {@see \Closure} instances used to instantiate specific classes
*/
private static $cachedInstantiators = [];
private static $cachedInstantiators = array();
/**
* Array of objects that can directly be cloned, indexed by class name.
*
* @var object[]
* @var object[] of objects that can directly be cloned
*/
private static $cachedCloneables = [];
private static $cachedCloneables = array();
/**
* {@inheritDoc}
......@@ -59,20 +65,12 @@ final class Instantiator implements InstantiatorInterface
return $factory();
}
return $this->buildAndCacheFromFactory($className);
}
$factory = self::$cachedInstantiators[$className] = $this->buildFactory($className);
$instance = $factory();
$reflection = new ReflectionClass($instance);
/**
* Builds the requested object and caches it in static properties for performance
*
* @return object
*/
private function buildAndCacheFromFactory(string $className)
{
$factory = self::$cachedInstantiators[$className] = $this->buildFactory($className);
$instance = $factory();
if ($this->isSafeToClone(new ReflectionClass($instance))) {
// not cloneable if it implements `__clone`, as we want to avoid calling it
if (! $reflection->hasMethod('__clone')) {
self::$cachedCloneables[$className] = clone $instance;
}
......@@ -80,40 +78,50 @@ final class Instantiator implements InstantiatorInterface
}
/**
* Builds a callable capable of instantiating the given $className without
* @internal
* @private
*
* Builds a {@see \Closure} capable of instantiating the given $className without
* invoking its constructor.
* This method is only exposed as public because of PHP 5.3 compatibility. Do not
* use this method in your own code
*
* @throws InvalidArgumentException
* @throws UnexpectedValueException
* @throws ReflectionException
* @param string $className
*
* @return Closure
*/
private function buildFactory(string $className) : callable
public function buildFactory($className)
{
$reflectionClass = $this->getReflectionClass($className);
if ($this->isInstantiableViaReflection($reflectionClass)) {
return [$reflectionClass, 'newInstanceWithoutConstructor'];
return function () use ($reflectionClass) {
return $reflectionClass->newInstanceWithoutConstructor();
};
}
$serializedString = sprintf(
'%s:%d:"%s":0:{}',
is_subclass_of($className, Serializable::class) ? self::SERIALIZATION_FORMAT_USE_UNSERIALIZER : self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER,
$this->getSerializationFormat($reflectionClass),
strlen($className),
$className
);
$this->checkIfUnSerializationIsSupported($reflectionClass, $serializedString);
$this->attemptInstantiationViaUnSerialization($reflectionClass, $serializedString);
return static function () use ($serializedString) {
return function () use ($serializedString) {
return unserialize($serializedString);
};
}
/**
* @param string $className
*
* @return ReflectionClass
*
* @throws InvalidArgumentException
* @throws ReflectionException
*/
private function getReflectionClass(string $className) : ReflectionClass
private function getReflectionClass($className)
{
if (! class_exists($className)) {
throw InvalidArgumentException::fromNonExistingClass($className);
......@@ -129,11 +137,16 @@ final class Instantiator implements InstantiatorInterface
}
/**
* @param ReflectionClass $reflectionClass
* @param string $serializedString
*
* @throws UnexpectedValueException
*
* @return void
*/
private function checkIfUnSerializationIsSupported(ReflectionClass $reflectionClass, string $serializedString) : void
private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, $serializedString)
{
set_error_handler(static function (int $code, string $message, string $file, int $line) use ($reflectionClass, &$error) : bool {
set_error_handler(function ($code, $message, $file, $line) use ($reflectionClass, & $error) {
$error = UnexpectedValueException::fromUncleanUnSerialization(
$reflectionClass,
$message,
......@@ -141,63 +154,85 @@ final class Instantiator implements InstantiatorInterface
$file,
$line
);
return true;
});
try {
$this->attemptInstantiationViaUnSerialization($reflectionClass, $serializedString);
} finally {
unserialize($serializedString);
} catch (Exception $exception) {
restore_error_handler();
throw UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $exception);
}
restore_error_handler();
if ($error) {
throw $error;
}
}
/**
* @throws UnexpectedValueException
* @param ReflectionClass $reflectionClass
*
* @return bool
*/
private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, string $serializedString) : void
private function isInstantiableViaReflection(ReflectionClass $reflectionClass)
{
try {
unserialize($serializedString);
} catch (Exception $exception) {
throw UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $exception);
if (\PHP_VERSION_ID >= 50600) {
return ! ($reflectionClass->isInternal() && $reflectionClass->isFinal());
}
}
private function isInstantiableViaReflection(ReflectionClass $reflectionClass) : bool
{
return ! ($this->hasInternalAncestors($reflectionClass) && $reflectionClass->isFinal());
return \PHP_VERSION_ID >= 50400 && ! $this->hasInternalAncestors($reflectionClass);
}
/**
* Verifies whether the given class is to be considered internal
*
* @param ReflectionClass $reflectionClass
*
* @return bool
*/
private function hasInternalAncestors(ReflectionClass $reflectionClass) : bool
private function hasInternalAncestors(ReflectionClass $reflectionClass)
{
do {
if ($reflectionClass->isInternal()) {
return true;
}
$reflectionClass = $reflectionClass->getParentClass();
} while ($reflectionClass);
} while ($reflectionClass = $reflectionClass->getParentClass());
return false;
}
/**
* Checks if a class is cloneable
* Verifies if the given PHP version implements the `Serializable` interface serialization
* with an incompatible serialization format. If that's the case, use serialization marker
* "C" instead of "O".
*
* @link http://news.php.net/php.internals/74654
*
* @param ReflectionClass $reflectionClass
*
* @return string the serialization format marker, either self::SERIALIZATION_FORMAT_USE_UNSERIALIZER
* or self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER
*/
private function getSerializationFormat(ReflectionClass $reflectionClass)
{
if ($this->isPhpVersionWithBrokenSerializationFormat()
&& $reflectionClass->implementsInterface('Serializable')
) {
return self::SERIALIZATION_FORMAT_USE_UNSERIALIZER;
}
return self::SERIALIZATION_FORMAT_AVOID_UNSERIALIZER;
}
/**
* Checks whether the current PHP runtime uses an incompatible serialization format
*
* Classes implementing `__clone` cannot be safely cloned, as that may cause side-effects.
* @return bool
*/
private function isSafeToClone(ReflectionClass $reflection) : bool
private function isPhpVersionWithBrokenSerializationFormat()
{
return $reflection->isCloneable()
&& ! $reflection->hasMethod('__clone')
&& ! $reflection->isSubclassOf(ArrayIterator::class);
return PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513;
}
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Instantiator;
use Doctrine\Instantiator\Exception\ExceptionInterface;
/**
* Instantiator provides utility methods to build objects without invoking their constructors
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
interface InstantiatorInterface
{
......@@ -14,7 +31,7 @@ interface InstantiatorInterface
*
* @return object
*
* @throws ExceptionInterface
* @throws \Doctrine\Instantiator\Exception\ExceptionInterface
*/
public function instantiate($className);
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorPerformance;
use Athletic\AthleticEvent;
use Doctrine\Instantiator\Instantiator;
/**
* Performance tests for {@see \Doctrine\Instantiator\Instantiator}
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class InstantiatorPerformanceEvent extends AthleticEvent
{
/**
* @var \Doctrine\Instantiator\Instantiator
*/
private $instantiator;
/**
* {@inheritDoc}
*/
protected function setUp()
{
$this->instantiator = new Instantiator();
$this->instantiator->instantiate(__CLASS__);
$this->instantiator->instantiate('ArrayObject');
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset');
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset');
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset');
}
/**
* @iterations 20000
* @baseline
* @group instantiation
*/
public function testInstantiateSelf()
{
$this->instantiator->instantiate(__CLASS__);
}
/**
* @iterations 20000
* @group instantiation
*/
public function testInstantiateInternalClass()
{
$this->instantiator->instantiate('ArrayObject');
}
/**
* @iterations 20000
* @group instantiation
*/
public function testInstantiateSimpleSerializableAssetClass()
{
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset');
}
/**
* @iterations 20000
* @group instantiation
*/
public function testInstantiateSerializableArrayObjectAsset()
{
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset');
}
/**
* @iterations 20000
* @group instantiation
*/
public function testInstantiateUnCloneableAsset()
{
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset');
}
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTest\Exception;
use Doctrine\Instantiator\Exception\InvalidArgumentException;
use PHPUnit_Framework_TestCase;
use ReflectionClass;
/**
* Tests for {@see \Doctrine\Instantiator\Exception\InvalidArgumentException}
*
* @author Marco Pivetta <ocramius@gmail.com>
*
* @covers \Doctrine\Instantiator\Exception\InvalidArgumentException
*/
class InvalidArgumentExceptionTest extends PHPUnit_Framework_TestCase
{
public function testFromNonExistingTypeWithNonExistingClass()
{
$className = __CLASS__ . uniqid();
$exception = InvalidArgumentException::fromNonExistingClass($className);
$this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\InvalidArgumentException', $exception);
$this->assertSame('The provided class "' . $className . '" does not exist', $exception->getMessage());
}
public function testFromNonExistingTypeWithTrait()
{
if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Need at least PHP 5.4.0, as this test requires traits support to run');
}
$exception = InvalidArgumentException::fromNonExistingClass(
'DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset'
);
$this->assertSame(
'The provided type "DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset" is a trait, '
. 'and can not be instantiated',
$exception->getMessage()
);
}
public function testFromNonExistingTypeWithInterface()
{
$exception = InvalidArgumentException::fromNonExistingClass('Doctrine\\Instantiator\\InstantiatorInterface');
$this->assertSame(
'The provided type "Doctrine\\Instantiator\\InstantiatorInterface" is an interface, '
. 'and can not be instantiated',
$exception->getMessage()
);
}
public function testFromAbstractClass()
{
$reflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset');
$exception = InvalidArgumentException::fromAbstractClass($reflection);
$this->assertSame(
'The provided class "DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset" is abstract, '
. 'and can not be instantiated',
$exception->getMessage()
);
}
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTest\Exception;
use Doctrine\Instantiator\Exception\UnexpectedValueException;
use Exception;
use PHPUnit_Framework_TestCase;
use ReflectionClass;
/**
* Tests for {@see \Doctrine\Instantiator\Exception\UnexpectedValueException}
*
* @author Marco Pivetta <ocramius@gmail.com>
*
* @covers \Doctrine\Instantiator\Exception\UnexpectedValueException
*/
class UnexpectedValueExceptionTest extends PHPUnit_Framework_TestCase
{
public function testFromSerializationTriggeredException()
{
$reflectionClass = new ReflectionClass($this);
$previous = new Exception();
$exception = UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $previous);
$this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\UnexpectedValueException', $exception);
$this->assertSame($previous, $exception->getPrevious());
$this->assertSame(
'An exception was raised while trying to instantiate an instance of "'
. __CLASS__ . '" via un-serialization',
$exception->getMessage()
);
}
public function testFromUncleanUnSerialization()
{
$reflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset');
$exception = UnexpectedValueException::fromUncleanUnSerialization($reflection, 'foo', 123, 'bar', 456);
$this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\UnexpectedValueException', $exception);
$this->assertSame(
'Could not produce an instance of "DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset" '
. 'via un-serialization, since an error was triggered in file "bar" at line "456"',
$exception->getMessage()
);
$previous = $exception->getPrevious();
$this->assertInstanceOf('Exception', $previous);
$this->assertSame('foo', $previous->getMessage());
$this->assertSame(123, $previous->getCode());
}
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTest;
use Doctrine\Instantiator\Exception\UnexpectedValueException;
use Doctrine\Instantiator\Instantiator;
use PHPUnit_Framework_TestCase;
use ReflectionClass;
/**
* Tests for {@see \Doctrine\Instantiator\Instantiator}
*
* @author Marco Pivetta <ocramius@gmail.com>
*
* @covers \Doctrine\Instantiator\Instantiator
*/
class InstantiatorTest extends PHPUnit_Framework_TestCase
{
/**
* @var Instantiator
*/
private $instantiator;
/**
* {@inheritDoc}
*/
protected function setUp()
{
$this->instantiator = new Instantiator();
}
/**
* @param string $className
*
* @dataProvider getInstantiableClasses
*/
public function testCanInstantiate($className)
{
$this->assertInstanceOf($className, $this->instantiator->instantiate($className));
}
/**
* @param string $className
*
* @dataProvider getInstantiableClasses
*/
public function testInstantiatesSeparateInstances($className)
{
$instance1 = $this->instantiator->instantiate($className);
$instance2 = $this->instantiator->instantiate($className);
$this->assertEquals($instance1, $instance2);
$this->assertNotSame($instance1, $instance2);
}
public function testExceptionOnUnSerializationException()
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped(
'As of facebook/hhvm#3432, HHVM has no PDORow, and therefore '
. ' no internal final classes that cannot be instantiated'
);
}
$className = 'DoctrineTest\\InstantiatorTestAsset\\UnserializeExceptionArrayObjectAsset';
if (\PHP_VERSION_ID >= 50600) {
$className = 'PDORow';
}
if (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513) {
$className = 'DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset';
}
$this->setExpectedException('Doctrine\\Instantiator\\Exception\\UnexpectedValueException');
$this->instantiator->instantiate($className);
}
public function testNoticeOnUnSerializationException()
{
if (\PHP_VERSION_ID >= 50600) {
$this->markTestSkipped(
'PHP 5.6 supports `ReflectionClass#newInstanceWithoutConstructor()` for some internal classes'
);
}
try {
$this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset');
$this->fail('No exception was raised');
} catch (UnexpectedValueException $exception) {
$wakeUpNoticesReflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset');
$previous = $exception->getPrevious();
$this->assertInstanceOf('Exception', $previous);
// in PHP 5.4.29 and PHP 5.5.13, this case is not a notice, but an exception being thrown
if (! (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513)) {
$this->assertSame(
'Could not produce an instance of "DoctrineTest\\InstantiatorTestAsset\WakeUpNoticesAsset" '
. 'via un-serialization, since an error was triggered in file "'
. $wakeUpNoticesReflection->getFileName() . '" at line "36"',
$exception->getMessage()
);
$this->assertSame('Something went bananas while un-serializing this instance', $previous->getMessage());
$this->assertSame(\E_USER_NOTICE, $previous->getCode());
}
}
}
/**
* @param string $invalidClassName
*
* @dataProvider getInvalidClassNames
*/
public function testInstantiationFromNonExistingClass($invalidClassName)
{
$this->setExpectedException('Doctrine\\Instantiator\\Exception\\InvalidArgumentException');
$this->instantiator->instantiate($invalidClassName);
}
public function testInstancesAreNotCloned()
{
$className = 'TemporaryClass' . uniqid();
eval('namespace ' . __NAMESPACE__ . '; class ' . $className . '{}');
$instance = $this->instantiator->instantiate(__NAMESPACE__ . '\\' . $className);
$instance->foo = 'bar';
$instance2 = $this->instantiator->instantiate(__NAMESPACE__ . '\\' . $className);
$this->assertObjectNotHasAttribute('foo', $instance2);
}
/**
* Provides a list of instantiable classes (existing)
*
* @return string[][]
*/
public function getInstantiableClasses()
{
$classes = array(
array('stdClass'),
array(__CLASS__),
array('Doctrine\\Instantiator\\Instantiator'),
array('PharException'),
array('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset'),
array('DoctrineTest\\InstantiatorTestAsset\\PharExceptionAsset'),
array('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset'),
);
if (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513) {
return $classes;
}
$classes = array_merge(
$classes,
array(
array('PharException'),
array('ArrayObject'),
array('DoctrineTest\\InstantiatorTestAsset\\ArrayObjectAsset'),
array('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset'),
)
);
if (\PHP_VERSION_ID >= 50600) {
$classes[] = array('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset');
$classes[] = array('DoctrineTest\\InstantiatorTestAsset\\UnserializeExceptionArrayObjectAsset');
}
return $classes;
}
/**
* Provides a list of instantiable classes (existing)
*
* @return string[][]
*/
public function getInvalidClassNames()
{
$classNames = array(
array(__CLASS__ . uniqid()),
array('Doctrine\\Instantiator\\InstantiatorInterface'),
array('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset'),
);
if (\PHP_VERSION_ID >= 50400) {
$classNames[] = array('DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset');
}
return $classNames;
}
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTestAsset;
/**
* A simple asset for an abstract class
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
abstract class AbstractClassAsset
{
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTestAsset;
use ArrayObject;
use BadMethodCallException;
/**
* Test asset that extends an internal PHP class
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class ArrayObjectAsset extends ArrayObject
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTestAsset;
use BadMethodCallException;
use Phar;
/**
* Test asset that extends an internal PHP class
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class PharAsset extends Phar
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTestAsset;
use BadMethodCallException;
use PharException;
/**
* Test asset that extends an internal PHP class
* This class should be serializable without problems
* and without getting the "Erroneous data format for unserializing"
* error
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class PharExceptionAsset extends PharException
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTestAsset;
use ArrayObject;
use BadMethodCallException;
use Serializable;
/**
* Serializable test asset that also extends an internal class
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class SerializableArrayObjectAsset extends ArrayObject implements Serializable
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
/**
* {@inheritDoc}
*/
public function serialize()
{
return '';
}
/**
* {@inheritDoc}
*
* Should not be called
*
* @throws BadMethodCallException
*/
public function unserialize($serialized)
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTestAsset;
use BadMethodCallException;
use Serializable;
/**
* Base serializable test asset
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class SimpleSerializableAsset implements Serializable
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
/**
* {@inheritDoc}
*/
public function serialize()
{
return '';
}
/**
* {@inheritDoc}
*
* Should not be called
*
* @throws BadMethodCallException
*/
public function unserialize($serialized)
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTestAsset;
/**
* A simple trait with no attached logic
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
trait SimpleTraitAsset
{
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTestAsset;
use BadMethodCallException;
/**
* Base un-cloneable asset
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class UnCloneableAsset
{
/**
* Constructor - should not be called
*
* @throws BadMethodCallException
*/
public function __construct()
{
throw new BadMethodCallException('Not supposed to be called!');
}
/**
* Magic `__clone` - should not be invoked
*
* @throws BadMethodCallException
*/
public function __clone()
{
throw new BadMethodCallException('Not supposed to be called!');
}
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTestAsset;
use ArrayObject;
use BadMethodCallException;
/**
* A simple asset for an abstract class
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class UnserializeExceptionArrayObjectAsset extends ArrayObject
{
/**
* {@inheritDoc}
*/
public function __wakeup()
{
throw new BadMethodCallException();
}
}
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace DoctrineTest\InstantiatorTestAsset;
use ArrayObject;
/**
* A simple asset for an abstract class
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class WakeUpNoticesAsset extends ArrayObject
{
/**
* Wakeup method called after un-serialization
*/
public function __wakeup()
{
trigger_error('Something went bananas while un-serializing this instance');
}
}
language: php
php: [ 7.1, 7.2, nightly ]
sudo: false
env:
php:
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm
- nightly
matrix:
fast_finish: true
allow_failures:
- php: nightly
- php:
- hhvm
- nightly
install:
- travis_retry composer install --no-interaction --prefer-dist --optimize-autoloader
cache:
directories:
- $HOME/.composer/cache
script:
- ./vendor/bin/phpunit --no-coverage
jobs:
include:
- stage: analysis
php: 7.1
script:
- ./vendor/bin/phpunit
after_script:
- travis_retry wget --no-verbose https://phar.io/releases/phive.phar
- travis_retry php phive.phar --no-progress install --trust-gpg-keys E82B2FB314E9906E php-coveralls/php-coveralls && ./tools/php-coveralls --verbose
- travis_retry wget --no-verbose https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
- vendor/bin/phpunit --coverage-clover=coverage.clover -v
- composer update --no-interaction --prefer-source
- vendor/bin/phpunit -v
- stage: analysis
php: 7.1
before_script:
- travis_retry wget --no-verbose https://phar.io/releases/phive.phar
- travis_retry php phive.phar --no-progress install --trust-gpg-keys 8E730BA25823D8B5 phpstan
script:
- ./tools/phpstan analyse src --level max --configuration phpstan.neon
before_script:
- composer install --no-interaction
- stage: analysis
php: 7.1
script:
- composer create-project symplify/easy-coding-standard temp/ecs ^3 && temp/ecs/bin/ecs check src tests
cache:
directories:
- $HOME/.composer
- $HOME/.phive
after_script:
- if [ $TRAVIS_PHP_VERSION = '5.6' ]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
notifications:
irc: "irc.freenode.org#phpdocumentor"
slack:
secure: "fjumM0h+4w3EYM4dpgqvpiCug7m4sSIC5+HATgwga/Nrc6IjlbWvGOv3JPgD3kQUhi18VmZfUYPmCv916SIbMnv8JWcrSaJXnPCgmxidvYkuzQDIw1HDJbVppGnkmwQA/qjIrM3sIEMfnu/arLRJQLI363aStZzGPxwIa4PDKcg="
email:
- me@mikevanriel.com
- ashnazg@php.net
- me@mikevanriel.com
- ashnazg@php.net
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Travis Status](https://img.shields.io/travis/phpDocumentor/ReflectionCommon.svg?label=Linux)](https://travis-ci.org/phpDocumentor/ReflectionCommon)
[![Appveyor Status](https://img.shields.io/appveyor/ci/phpDocumentor/ReflectionCommon.svg?label=Windows)](https://ci.appveyor.com/project/phpDocumentor/ReflectionCommon/branch/master)
[![Coveralls Coverage](https://img.shields.io/coveralls/github/phpDocumentor/ReflectionCommon.svg)](https://coveralls.io/github/phpDocumentor/ReflectionCommon?branch=master)
[![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/phpDocumentor/ReflectionCommon.svg)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionCommon/?branch=master)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/phpDocumentor/ReflectionCommon.svg)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionCommon/?branch=master)
[![Stable Version](https://img.shields.io/packagist/v/phpDocumentor/Reflection-Common.svg)](https://packagist.org/packages/phpDocumentor/Reflection-Common)
[![Unstable Version](https://img.shields.io/packagist/vpre/phpDocumentor/Reflection-Common.svg)](https://packagist.org/packages/phpDocumentor/Reflection-Common)
ReflectionCommon
================
# ReflectionCommon
[![Build Status](https://travis-ci.org/phpDocumentor/ReflectionCommon.svg?branch=master)](https://travis-ci.org/phpDocumentor/ReflectionCommon)
build: false
clone_folder: c:\reflectioncommon
max_jobs: 3
platform: x86
pull_requests:
do_not_increment_build_number: true
version: '{build}.{branch}'
skip_tags: true
branches:
only:
- master
environment:
matrix:
- php_ver_target: 7.1
- php_ver_target: 7.2
matrix:
fast_finish: false
cache:
- c:\php -> appveyor.yml
- '%LOCALAPPDATA%\Composer\files'
init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
- SET COMPOSER_NO_INTERACTION=1
- SET PHP=1
- SET ANSICON=121x90 (121x90)
install:
- IF EXIST c:\tools\php (SET PHP=0)
- ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
- cd c:\tools\php
- IF %PHP%==1 copy /Y php.ini-development php.ini
- IF %PHP%==1 echo max_execution_time=1200 >> php.ini
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
- IF %PHP%==1 echo extension_dir=ext >> php.ini
- IF %PHP%==1 echo extension=php_curl.dll >> php.ini
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
- IF %PHP%==1 echo zend.assertions=1 >> php.ini
- IF %PHP%==1 echo assert.exception=On >> php.ini
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
- cd c:\reflectioncommon
- composer install --no-interaction --prefer-dist --no-progress
test_script:
- cd c:\reflectioncommon
- vendor\bin\phpunit --no-coverage
......@@ -11,19 +11,19 @@
}
],
"require": {
"php": ">=7.1"
"php": ">=5.5"
},
"autoload" : {
"psr-4" : {
"phpDocumentor\\Reflection\\": "src/"
"phpDocumentor\\Reflection\\": ["src"]
}
},
"require-dev": {
"phpunit/phpunit": "~6"
"phpunit/phpunit": "^4.6"
},
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
"dev-master": "1.0.x-dev"
}
}
}
includes:
- temp/ecs/config/clean-code.neon
- temp/ecs/config/psr2.neon
- temp/ecs/config/common.neon
parameters:
exclude_checkers:
# from temp/ecs/config/common.neon
- PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer
- PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer
- PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer
# from temp/ecs/config/spaces.neon
- PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer
skip:
PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff:
- */tests/**
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpunit" version="^6.5.5" installed="6.5.5" location="./tools/phpunit"/>
<phar name="phpstan" version="^0.9.1" installed="0.9.1" location="./tools/phpstan"/>
</phive>
<?php
declare(strict_types=1);
/**
* phpDocumentor
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* PHP Version 5.5
*
* @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
* @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -21,11 +18,15 @@ interface Element
{
/**
* Returns the Fqsen of the element.
*
* @return Fqsen
*/
public function getFqsen(): Fqsen;
public function getFqsen();
/**
* Returns the name of the element.
*
* @return string
*/
public function getName(): string;
}
public function getName();
}
\ No newline at end of file
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<mike@phpdoc.org>
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -21,16 +19,22 @@ interface File
{
/**
* Returns the content of the file as a string.
*
* @return string
*/
public function getContents(): string;
public function getContents();
/**
* Returns md5 hash of the file.
*
* @return string
*/
public function md5(): string;
public function md5();
/**
* Returns an relative path to the file.
*
* @return string
*/
public function path(): string;
public function path();
}
<?php
declare(strict_types=1);
/**
* phpDocumentor
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* PHP Version 5.5
*
* @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
* @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection;
use InvalidArgumentException;
/**
* Value Object for Fqsen.
*
......@@ -36,19 +31,21 @@ final class Fqsen
/**
* Initializes the object.
*
* @throws InvalidArgumentException when $fqsen is not matching the format.
* @param string $fqsen
*
* @throws \InvalidArgumentException when $fqsen is not matching the format.
*/
public function __construct(string $fqsen)
public function __construct($fqsen)
{
$matches = [];
$matches = array();
$result = preg_match(
'/^\\\\([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff\\\\]*)?(?:[:]{2}\\$?([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*))?(?:\\(\\))?$/',
$fqsen,
$matches
$fqsen,
$matches
);
if ($result === 0) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
sprintf('"%s" is not a valid Fqsen.', $fqsen)
);
}
......@@ -65,16 +62,20 @@ final class Fqsen
/**
* converts this class to string.
*
* @return string
*/
public function __toString(): string
public function __toString()
{
return $this->fqsen;
}
/**
* Returns the name of the element without path.
*
* @return string
*/
public function getName(): string
public function getName()
{
return $this->name;
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2018 Mike van Riel<mike@phpdoc.org>
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -19,7 +17,7 @@ namespace phpDocumentor\Reflection;
*/
final class Location
{
/** @var int */
/** @var int */
private $lineNumber = 0;
/** @var int */
......@@ -27,25 +25,32 @@ final class Location
/**
* Initializes the location for an element using its line number in the file and optionally the column number.
*
* @param int $lineNumber
* @param int $columnNumber
*/
public function __construct(int $lineNumber, int $columnNumber = 0)
public function __construct($lineNumber, $columnNumber = 0)
{
$this->lineNumber = $lineNumber;
$this->lineNumber = $lineNumber;
$this->columnNumber = $columnNumber;
}
/**
* Returns the line number that is covered by this location.
*
* @return integer
*/
public function getLineNumber(): int
public function getLineNumber()
{
return $this->lineNumber;
}
/**
* Returns the column number (character position on a line) for this location object.
*
* @return integer
*/
public function getColumnNumber(): int
public function getColumnNumber()
{
return $this->columnNumber;
}
......
<?php
declare(strict_types=1);
/**
* phpDocumentor
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* PHP Version 5.5
*
* @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
* @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -21,6 +18,8 @@ interface Project
{
/**
* Returns the name of the project.
*
* @return string
*/
public function getName(): string;
public function getName();
}
<?php
declare(strict_types=1);
/**
* phpDocumentor
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* PHP Version 5.5
*
* @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
* @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com)
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection;
/**
......@@ -27,5 +23,5 @@ interface ProjectFactory
* @param File[] $files
* @return Project
*/
public function create($name, array $files): Project;
public function create($name, array $files);
}
service_name: travis-ci
coverage_clover: coverage.xml
json_path: coverage.json
......@@ -10,12 +10,16 @@ that is 100% compatible with the [PHPDoc standard](http://phpdoc.org/docs/latest
With this component, a library can provide support for annotations via DocBlocks
or otherwise retrieve information that is embedded in a DocBlock.
> **Note**: *this is a core component of phpDocumentor and is constantly being
> optimized for performance.*
Installation
------------
```bash
composer require phpdocumentor/reflection-docblock
```
You can install the component in the following ways:
* Use the official Github repository (https://github.com/phpDocumentor/ReflectionDocBlock)
* Via Composer (http://packagist.org/packages/phpdocumentor/reflection-docblock)
Usage
-----
......@@ -48,20 +52,18 @@ $docblock = $factory->create($docComment);
```
The `create` method will yield an object of type `\phpDocumentor\Reflection\DocBlock`
whose methods can be queried:
whose methods can be queried as shown in the following example.
```php
// Contains the summary for this DocBlock
// Should contain the summary for this DocBlock
$summary = $docblock->getSummary();
// Contains \phpDocumentor\Reflection\DocBlock\Description object
// Contains an object of type \phpDocumentor\Reflection\DocBlock\Description;
// you can either cast it to string or use the render method to get a string
// representation of the Description.
$description = $docblock->getDescription();
// You can either cast it to string
$description = (string) $docblock->getDescription();
// Or use the render method to get a string representation of the Description.
$description = $docblock->getDescription()->render();
```
> For more examples it would be best to review the scripts in the [`/examples` folder](/examples).
> For more examples it would be best to review the scripts in the `/examples`
> folder.
build: false
clone_folder: c:\reflectiondocblock
max_jobs: 3
platform: x86
pull_requests:
do_not_increment_build_number: true
version: '{build}.{branch}'
skip_tags: true
branches:
only:
- master
environment:
matrix:
- php_ver_target: 7.1
- php_ver_target: 7.2
matrix:
fast_finish: false
cache:
- c:\php -> appveyor.yml
- '%LOCALAPPDATA%\Composer\files'
init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
- SET COMPOSER_NO_INTERACTION=1
- SET PHP=1
- SET ANSICON=121x90 (121x90)
install:
- IF EXIST c:\tools\php (SET PHP=0)
- ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
- cd c:\tools\php
- IF %PHP%==1 copy /Y php.ini-development php.ini
- IF %PHP%==1 echo max_execution_time=1200 >> php.ini
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
- IF %PHP%==1 echo extension_dir=ext >> php.ini
- IF %PHP%==1 echo extension=php_curl.dll >> php.ini
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
- IF %PHP%==1 echo zend.assertions=1 >> php.ini
- IF %PHP%==1 echo assert.exception=On >> php.ini
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
- cd c:\reflectiondocblock
- composer install --no-interaction --prefer-dist --no-progress
- composer global require phpunit/phpunit ^6
- composer global config bin-dir --absolute
test_script:
- cd c:\reflectiondocblock
- c:\Users\appveyor\AppData\Roaming\Composer\vendor\bin\phpunit --no-coverage
......@@ -10,9 +10,9 @@
}
],
"require": {
"php": "^7.0",
"phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0",
"phpdocumentor/type-resolver": "~0.4 || ^1.0.0",
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0@dev",
"phpdocumentor/type-resolver": "^0.3.0",
"webmozart/assert": "^1.0"
},
"autoload": {
......@@ -22,14 +22,7 @@
"psr-4": {"phpDocumentor\\Reflection\\": ["tests/unit"]}
},
"require-dev": {
"mockery/mockery": "^1.0",
"phpdocumentor/type-resolver": "0.4.*",
"phpunit/phpunit": "^6.4",
"doctrine/instantiator": "^1.0.5"
},
"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
}
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^4.4"
}
}
includes:
- temp/ecs/config/clean-code.neon
- temp/ecs/config/psr2-checkers.neon
- temp/ecs/config/spaces.neon
- temp/ecs/config/common.neon
checkers:
PhpCsFixer\Fixer\Operator\ConcatSpaceFixer:
spacing: one
parameters:
exclude_checkers:
# from temp/ecs/config/common.neon
- PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer
- PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer
- PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer
# from temp/ecs/config/spaces.neon
- PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer
skip:
SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff:
# WIP code
- src/DocBlock/StandardTagFactory.php
PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\EmptyStatementSniff:
# WIP code
- src/DocBlock/StandardTagFactory.php
PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff:
- src/DocBlock/Tags/Return_.php
- src/DocBlock/Tags/Var_.php
PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff:
- */tests/**
......@@ -24,7 +24,7 @@ final class DocBlock
private $description = null;
/** @var Tag[] An array containing all the tags in this docblock; except inline. */
private $tags = [];
private $tags = array();
/** @var Types\Context Information about the context of this DocBlock. */
private $context = null;
......@@ -55,7 +55,8 @@ final class DocBlock
Location $location = null,
$isTemplateStart = false,
$isTemplateEnd = false
) {
)
{
Assert::string($summary);
Assert::boolean($isTemplateStart);
Assert::boolean($isTemplateEnd);
......@@ -170,11 +171,11 @@ final class DocBlock
{
Assert::string($name);
$result = [];
$result = array();
/** @var Tag $tag */
foreach ($this->getTags() as $tag) {
if ($tag->getName() !== $name) {
if ($tag->getName() != $name) {
continue;
}
......@@ -197,7 +198,7 @@ final class DocBlock
/** @var Tag $tag */
foreach ($this->getTags() as $tag) {
if ($tag->getName() === $name) {
if ($tag->getName() == $name) {
return true;
}
}
......@@ -206,23 +207,6 @@ final class DocBlock
}
/**
* Remove a tag from this DocBlock.
*
* @param Tag $tag The tag to remove.
*
* @return void
*/
public function removeTag(Tag $tagToRemove)
{
foreach ($this->tags as $key => $tag) {
if ($tag === $tagToRemove) {
unset($this->tags[$key]);
break;
}
}
}
/**
* Adds a tag to this DocBlock.
*
* @param Tag $tag The tag to add.
......
......@@ -71,16 +71,6 @@ class Description
}
/**
* Returns the tags for this DocBlock.
*
* @return Tag[]
*/
public function getTags()
{
return $this->tags;
}
/**
* Renders this description as a string where the provided formatter will format the tags in the expected string
* format.
*
......@@ -98,7 +88,6 @@ class Description
foreach ($this->tags as $tag) {
$tags[] = '{' . $formatter->format($tag) . '}';
}
return vsprintf($this->bodyTemplate, $tags);
}
......
......@@ -188,4 +188,5 @@ class DescriptionFactory
return implode("\n", $lines);
}
}
......@@ -10,7 +10,7 @@
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\DocBlock;
namespace phpDocumentor\Reflection;
use phpDocumentor\Reflection\DocBlock\Tags\Example;
......@@ -23,7 +23,7 @@ class ExampleFinder
private $sourceDirectory = '';
/** @var string[] */
private $exampleDirectories = [];
private $exampleDirectories = array();
/**
* Attempts to find the example contents for the given descriptor.
......
......@@ -81,12 +81,7 @@ class Serializer
)
);
$comment = "{$firstIndent}/**\n";
if ($text) {
$comment .= "{$indent} * {$text}\n";
$comment .= "{$indent} *\n";
}
$comment = "{$firstIndent}/**\n{$indent} * {$text}\n{$indent} *\n";
$comment = $this->addTagBlock($docblock, $wrapLength, $indent, $comment);
$comment .= $indent . ' */';
......@@ -126,7 +121,6 @@ class Serializer
$text = wordwrap($text, $wrapLength);
return $text;
}
return $text;
}
......@@ -144,7 +138,6 @@ class Serializer
if ($wrapLength !== null) {
$tagText = wordwrap($tagText, $wrapLength);
}
$tagText = str_replace("\n", "\n{$indent} * ", $tagText);
$comment .= "{$indent} * {$tagText}\n";
......
......@@ -166,7 +166,7 @@ final class StandardTagFactory implements TagFactory
*/
private function extractTagParts($tagLine)
{
$matches = [];
$matches = array();
if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)/us', $tagLine, $matches)) {
throw new \InvalidArgumentException(
'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors'
......@@ -196,7 +196,8 @@ final class StandardTagFactory implements TagFactory
$arguments = $this->getArgumentsForParametersFromWiring(
$this->fetchParametersForHandlerFactoryMethod($handlerClassName),
$this->getServiceLocatorWithDynamicParameters($context, $name, $body)
);
)
;
return call_user_func_array([$handlerClassName, 'create'], $arguments);
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
......
......@@ -12,11 +12,11 @@
namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\Fqsen;
use phpDocumentor\Reflection\FqsenResolver;
use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\FqsenResolver;
use Webmozart\Assert\Assert;
/**
......@@ -49,7 +49,8 @@ final class Covers extends BaseTag implements Factory\StaticMethod
DescriptionFactory $descriptionFactory = null,
FqsenResolver $resolver = null,
TypeContext $context = null
) {
)
{
Assert::string($body);
Assert::notEmpty($body);
......
......@@ -12,9 +12,9 @@
namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use Webmozart\Assert\Assert;
/**
......
......@@ -12,19 +12,17 @@
namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\Tag;
use Webmozart\Assert\Assert;
/**
* Reflection class for a {@}example tag in a Docblock.
*/
final class Example extends BaseTag implements Factory\StaticMethod
final class Example extends BaseTag
{
/**
* @var string Path to a file to use as an example. May also be an absolute URI.
*/
private $filePath;
private $filePath = '';
/**
* @var bool Whether the file path component represents an URI. This determines how the file portion
......@@ -33,33 +31,6 @@ final class Example extends BaseTag implements Factory\StaticMethod
private $isURI = false;
/**
* @var int
*/
private $startingLine;
/**
* @var int
*/
private $lineCount;
public function __construct($filePath, $isURI, $startingLine, $lineCount, $description)
{
Assert::notEmpty($filePath);
Assert::integer($startingLine);
Assert::greaterThanEq($startingLine, 0);
$this->filePath = $filePath;
$this->startingLine = $startingLine;
$this->lineCount = $lineCount;
$this->name = 'example';
if ($description !== null) {
$this->description = trim($description);
}
$this->isURI = $isURI;
}
/**
* {@inheritdoc}
*/
public function getContent()
......@@ -72,7 +43,7 @@ final class Example extends BaseTag implements Factory\StaticMethod
:$this->filePath;
}
return trim($filePath . ' ' . parent::getDescription());
$this->description = $filePath . ' ' . parent::getContent();
}
return $this->description;
......@@ -100,29 +71,16 @@ final class Example extends BaseTag implements Factory\StaticMethod
$lineCount = null;
$description = null;
if (array_key_exists(3, $matches)) {
$description = $matches[3];
// Starting line / Number of lines / Description
if (preg_match('/^([1-9]\d*)(?:\s+((?1))\s*)?(.*)$/sux', $matches[3], $contentMatches)) {
$startingLine = (int)$contentMatches[1];
if (isset($contentMatches[2]) && $contentMatches[2] !== '') {
$lineCount = (int)$contentMatches[2];
}
if (array_key_exists(3, $contentMatches)) {
$description = $contentMatches[3];
}
// Starting line / Number of lines / Description
if (preg_match('/^([1-9]\d*)\s*(?:((?1))\s+)?(.*)$/sux', $matches[3], $matches)) {
$startingLine = (int)$matches[1];
if (isset($matches[2]) && $matches[2] !== '') {
$lineCount = (int)$matches[2];
}
$description = $matches[3];
}
return new static(
$filePath !== null?$filePath:$fileUri,
$fileUri !== null,
$startingLine,
$lineCount,
$description
);
return new static($filePath, $fileUri, $startingLine, $lineCount, $description);
}
/**
......@@ -137,40 +95,64 @@ final class Example extends BaseTag implements Factory\StaticMethod
}
/**
* Returns a string representation for this tag.
* Sets the file path.
*
* @return string
* @param string $filePath The new file path to use for the example.
*
* @return $this
*/
public function __toString()
public function setFilePath($filePath)
{
return $this->filePath . ($this->description ? ' ' . $this->description : '');
$this->isURI = false;
$this->filePath = trim($filePath);
$this->description = null;
return $this;
}
/**
* Returns true if the provided URI is relative or contains a complete scheme (and thus is absolute).
* Sets the file path as an URI.
*
* @param string $uri
* This function is equivalent to {@link setFilePath()}, except that it
* converts an URI to a file path before that.
*
* @return bool
* There is no getFileURI(), as {@link getFilePath()} is compatible.
*
* @param string $uri The new file URI to use as an example.
*
* @return $this
*/
private function isUriRelative($uri)
public function setFileURI($uri)
{
return false === strpos($uri, ':');
$this->isURI = true;
$this->description = null;
$this->filePath = $this->isUriRelative($uri)
? rawurldecode(str_replace(array('/', '\\'), '%2F', $uri))
: $this->filePath = $uri;
return $this;
}
/**
* @return int
* Returns a string representation for this tag.
*
* @return string
*/
public function getStartingLine()
public function __toString()
{
return $this->startingLine;
return $this->filePath . ($this->description ? ' ' . $this->description->render() : '');
}
/**
* @return int
* Returns true if the provided URI is relative or contains a complete scheme (and thus is absolute).
*
* @param string $uri
*
* @return bool
*/
public function getLineCount()
private function isUriRelative($uri)
{
return $this->lineCount;
return false === strpos($uri, ':');
}
}
......@@ -57,7 +57,7 @@ class Generic extends BaseTag implements Factory\StaticMethod
Assert::stringNotEmpty($name);
Assert::notNull($descriptionFactory);
$description = $descriptionFactory && $body !== "" ? $descriptionFactory->create($body, $context) : null;
$description = $descriptionFactory && $body ? $descriptionFactory->create($body, $context) : null;
return new static($name, $description);
}
......
......@@ -102,8 +102,12 @@ final class Method extends BaseTag implements Factory\StaticMethod
)
\s+
)?
# Legacy method name (not captured)
(?:
[\w_]+\(\)\s+
)?
# Method name
([\w_]+)
([\w\|_\\\\]+)
# Arguments
(?:
\(([^\)]*)\)
......@@ -131,7 +135,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
if (is_string($arguments) && strlen($arguments) > 0) {
$arguments = explode(',', $arguments);
foreach ($arguments as &$argument) {
foreach($arguments as &$argument) {
$argument = explode(' ', self::stripRestArg(trim($argument)), 2);
if ($argument[0][0] === '$') {
$argumentName = substr($argument[0], 1);
......@@ -210,13 +214,10 @@ final class Method extends BaseTag implements Factory\StaticMethod
if (is_string($argument)) {
$argument = [ 'name' => $argument ];
}
if (! isset($argument['type'])) {
$argument['type'] = new Void_();
}
$keys = array_keys($argument);
sort($keys);
if ($keys !== [ 'name', 'type' ]) {
throw new \InvalidArgumentException(
'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true)
......
......@@ -22,9 +22,15 @@ use Webmozart\Assert\Assert;
/**
* Reflection class for the {@}param tag in a Docblock.
*/
final class Param extends TagWithType implements Factory\StaticMethod
final class Param extends BaseTag implements Factory\StaticMethod
{
/** @var string */
protected $name = 'param';
/** @var Type */
private $type;
/** @var string */
private $variableName = '';
/** @var bool determines whether this is a variadic argument */
......@@ -41,7 +47,6 @@ final class Param extends TagWithType implements Factory\StaticMethod
Assert::string($variableName);
Assert::boolean($isVariadic);
$this->name = 'param';
$this->variableName = $variableName;
$this->type = $type;
$this->isVariadic = $isVariadic;
......@@ -60,25 +65,19 @@ final class Param extends TagWithType implements Factory\StaticMethod
Assert::stringNotEmpty($body);
Assert::allNotNull([$typeResolver, $descriptionFactory]);
list($firstPart, $body) = self::extractTypeFromBody($body);
$parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE);
$type = null;
$parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE);
$variableName = '';
$isVariadic = false;
// if the first item that is encountered is not a variable; it is a type
if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) {
$type = $typeResolver->resolve($firstPart, $context);
} else {
// first part is not a type; we should prepend it to the parts array for further processing
array_unshift($parts, $firstPart);
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) {
$type = $typeResolver->resolve(array_shift($parts), $context);
array_shift($parts);
}
// if the next item starts with a $ or ...$ it must be the variable name
if (isset($parts[0])
&& (strlen($parts[0]) > 0)
&& ($parts[0][0] === '$' || substr($parts[0], 0, 4) === '...$')
) {
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] == '$' || substr($parts[0], 0, 4) === '...$')) {
$variableName = array_shift($parts);
array_shift($parts);
......@@ -108,6 +107,16 @@ final class Param extends TagWithType implements Factory\StaticMethod
}
/**
* Returns the variable's type or null if unknown.
*
* @return Type|null
*/
public function getType()
{
return $this->type;
}
/**
* Returns whether this tag is variadic.
*
* @return boolean
......@@ -125,8 +134,8 @@ final class Param extends TagWithType implements Factory\StaticMethod
public function __toString()
{
return ($this->type ? $this->type . ' ' : '')
. ($this->isVariadic() ? '...' : '')
. '$' . $this->variableName
. ($this->description ? ' ' . $this->description : '');
. ($this->isVariadic() ? '...' : '')
. '$' . $this->variableName
. ($this->description ? ' ' . $this->description : '');
}
}
......@@ -22,21 +22,26 @@ use Webmozart\Assert\Assert;
/**
* Reflection class for a {@}property tag in a Docblock.
*/
class Property extends TagWithType implements Factory\StaticMethod
class Property extends BaseTag implements Factory\StaticMethod
{
/** @var string */
protected $name = 'property';
/** @var Type */
private $type;
/** @var string */
protected $variableName = '';
/**
* @param string $variableName
* @param Type $type
* @param string $variableName
* @param Type $type
* @param Description $description
*/
public function __construct($variableName, Type $type = null, Description $description = null)
{
Assert::string($variableName);
$this->name = 'property';
$this->variableName = $variableName;
$this->type = $type;
$this->description = $description;
......@@ -54,21 +59,18 @@ class Property extends TagWithType implements Factory\StaticMethod
Assert::stringNotEmpty($body);
Assert::allNotNull([$typeResolver, $descriptionFactory]);
list($firstPart, $body) = self::extractTypeFromBody($body);
$parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE);
$type = null;
$parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE);
$variableName = '';
// if the first item that is encountered is not a variable; it is a type
if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) {
$type = $typeResolver->resolve($firstPart, $context);
} else {
// first part is not a type; we should prepend it to the parts array for further processing
array_unshift($parts, $firstPart);
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) {
$type = $typeResolver->resolve(array_shift($parts), $context);
array_shift($parts);
}
// if the next item starts with a $ or ...$ it must be the variable name
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) {
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] == '$')) {
$variableName = array_shift($parts);
array_shift($parts);
......@@ -93,6 +95,16 @@ class Property extends TagWithType implements Factory\StaticMethod
}
/**
* Returns the variable's type or null if unknown.
*
* @return Type|null
*/
public function getType()
{
return $this->type;
}
/**
* Returns a string representation for this tag.
*
* @return string
......@@ -100,7 +112,7 @@ class Property extends TagWithType implements Factory\StaticMethod
public function __toString()
{
return ($this->type ? $this->type . ' ' : '')
. '$' . $this->variableName
. ($this->description ? ' ' . $this->description : '');
. '$' . $this->variableName
. ($this->description ? ' ' . $this->description : '');
}
}
......@@ -22,21 +22,26 @@ use Webmozart\Assert\Assert;
/**
* Reflection class for a {@}property-read tag in a Docblock.
*/
class PropertyRead extends TagWithType implements Factory\StaticMethod
class PropertyRead extends BaseTag implements Factory\StaticMethod
{
/** @var string */
protected $name = 'property-read';
/** @var Type */
private $type;
/** @var string */
protected $variableName = '';
/**
* @param string $variableName
* @param Type $type
* @param string $variableName
* @param Type $type
* @param Description $description
*/
public function __construct($variableName, Type $type = null, Description $description = null)
{
Assert::string($variableName);
$this->name = 'property-read';
$this->variableName = $variableName;
$this->type = $type;
$this->description = $description;
......@@ -54,21 +59,18 @@ class PropertyRead extends TagWithType implements Factory\StaticMethod
Assert::stringNotEmpty($body);
Assert::allNotNull([$typeResolver, $descriptionFactory]);
list($firstPart, $body) = self::extractTypeFromBody($body);
$parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE);
$type = null;
$parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE);
$variableName = '';
// if the first item that is encountered is not a variable; it is a type
if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) {
$type = $typeResolver->resolve($firstPart, $context);
} else {
// first part is not a type; we should prepend it to the parts array for further processing
array_unshift($parts, $firstPart);
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) {
$type = $typeResolver->resolve(array_shift($parts), $context);
array_shift($parts);
}
// if the next item starts with a $ or ...$ it must be the variable name
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) {
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] == '$')) {
$variableName = array_shift($parts);
array_shift($parts);
......@@ -93,6 +95,16 @@ class PropertyRead extends TagWithType implements Factory\StaticMethod
}
/**
* Returns the variable's type or null if unknown.
*
* @return Type|null
*/
public function getType()
{
return $this->type;
}
/**
* Returns a string representation for this tag.
*
* @return string
......@@ -100,7 +112,7 @@ class PropertyRead extends TagWithType implements Factory\StaticMethod
public function __toString()
{
return ($this->type ? $this->type . ' ' : '')
. '$' . $this->variableName
. ($this->description ? ' ' . $this->description : '');
. '$' . $this->variableName
. ($this->description ? ' ' . $this->description : '');
}
}
......@@ -22,21 +22,26 @@ use Webmozart\Assert\Assert;
/**
* Reflection class for a {@}property-write tag in a Docblock.
*/
class PropertyWrite extends TagWithType implements Factory\StaticMethod
class PropertyWrite extends BaseTag implements Factory\StaticMethod
{
/** @var string */
protected $name = 'property-write';
/** @var Type */
private $type;
/** @var string */
protected $variableName = '';
/**
* @param string $variableName
* @param Type $type
* @param string $variableName
* @param Type $type
* @param Description $description
*/
public function __construct($variableName, Type $type = null, Description $description = null)
{
Assert::string($variableName);
$this->name = 'property-write';
$this->variableName = $variableName;
$this->type = $type;
$this->description = $description;
......@@ -54,21 +59,18 @@ class PropertyWrite extends TagWithType implements Factory\StaticMethod
Assert::stringNotEmpty($body);
Assert::allNotNull([$typeResolver, $descriptionFactory]);
list($firstPart, $body) = self::extractTypeFromBody($body);
$parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE);
$type = null;
$parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE);
$variableName = '';
// if the first item that is encountered is not a variable; it is a type
if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) {
$type = $typeResolver->resolve($firstPart, $context);
} else {
// first part is not a type; we should prepend it to the parts array for further processing
array_unshift($parts, $firstPart);
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) {
$type = $typeResolver->resolve(array_shift($parts), $context);
array_shift($parts);
}
// if the next item starts with a $ or ...$ it must be the variable name
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) {
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] == '$')) {
$variableName = array_shift($parts);
array_shift($parts);
......@@ -93,6 +95,16 @@ class PropertyWrite extends TagWithType implements Factory\StaticMethod
}
/**
* Returns the variable's type or null if unknown.
*
* @return Type|null
*/
public function getType()
{
return $this->type;
}
/**
* Returns a string representation for this tag.
*
* @return string
......@@ -100,7 +112,7 @@ class PropertyWrite extends TagWithType implements Factory\StaticMethod
public function __toString()
{
return ($this->type ? $this->type . ' ' : '')
. '$' . $this->variableName
. ($this->description ? ' ' . $this->description : '');
. '$' . $this->variableName
. ($this->description ? ' ' . $this->description : '');
}
}
<?php
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2017 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\DocBlock\Tags\Reference;
use phpDocumentor\Reflection\Fqsen as RealFqsen;
/**
* Fqsen reference used by {@see phpDocumentor\Reflection\DocBlock\Tags\See}
*/
final class Fqsen implements Reference
{
/**
* @var RealFqsen
*/
private $fqsen;
/**
* Fqsen constructor.
*/
public function __construct(RealFqsen $fqsen)
{
$this->fqsen = $fqsen;
}
/**
* @return string string representation of the referenced fqsen
*/
public function __toString()
{
return (string)$this->fqsen;
}
}
<?php
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2017 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\DocBlock\Tags\Reference;
/**
* Interface for references in {@see phpDocumentor\Reflection\DocBlock\Tags\See}
*/
interface Reference
{
public function __toString();
}
<?php
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2017 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\DocBlock\Tags\Reference;
use Webmozart\Assert\Assert;
/**
* Url reference used by {@see phpDocumentor\Reflection\DocBlock\Tags\See}
*/
final class Url implements Reference
{
/**
* @var string
*/
private $uri;
/**
* Url constructor.
*/
public function __construct($uri)
{
Assert::stringNotEmpty($uri);
$this->uri = $uri;
}
public function __toString()
{
return $this->uri;
}
}
......@@ -22,11 +22,15 @@ use Webmozart\Assert\Assert;
/**
* Reflection class for a {@}return tag in a Docblock.
*/
final class Return_ extends TagWithType implements Factory\StaticMethod
final class Return_ extends BaseTag implements Factory\StaticMethod
{
protected $name = 'return';
/** @var Type */
private $type;
public function __construct(Type $type, Description $description = null)
{
$this->name = 'return';
$this->type = $type;
$this->description = $description;
}
......@@ -39,18 +43,29 @@ final class Return_ extends TagWithType implements Factory\StaticMethod
TypeResolver $typeResolver = null,
DescriptionFactory $descriptionFactory = null,
TypeContext $context = null
) {
)
{
Assert::string($body);
Assert::allNotNull([$typeResolver, $descriptionFactory]);
list($type, $description) = self::extractTypeFromBody($body);
$parts = preg_split('/\s+/Su', $body, 2);
$type = $typeResolver->resolve($type, $context);
$description = $descriptionFactory->create($description, $context);
$type = $typeResolver->resolve(isset($parts[0]) ? $parts[0] : '', $context);
$description = $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context);
return new static($type, $description);
}
/**
* Returns the type section of the variable.
*
* @return Type
*/
public function getType()
{
return $this->type;
}
public function __toString()
{
return $this->type . ' ' . $this->description;
......
......@@ -12,13 +12,11 @@
namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen as FqsenRef;
use phpDocumentor\Reflection\DocBlock\Tags\Reference\Reference;
use phpDocumentor\Reflection\DocBlock\Tags\Reference\Url;
use phpDocumentor\Reflection\Fqsen;
use phpDocumentor\Reflection\FqsenResolver;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\DocBlock\Description;
use Webmozart\Assert\Assert;
/**
......@@ -28,16 +26,16 @@ class See extends BaseTag implements Factory\StaticMethod
{
protected $name = 'see';
/** @var Reference */
/** @var Fqsen */
protected $refers = null;
/**
* Initializes this tag.
*
* @param Reference $refers
* @param Fqsen $refers
* @param Description $description
*/
public function __construct(Reference $refers, Description $description = null)
public function __construct(Fqsen $refers, Description $description = null)
{
$this->refers = $refers;
$this->description = $description;
......@@ -58,18 +56,13 @@ class See extends BaseTag implements Factory\StaticMethod
$parts = preg_split('/\s+/Su', $body, 2);
$description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null;
// https://tools.ietf.org/html/rfc2396#section-3
if (preg_match('/\w:\/\/\w/i', $parts[0])) {
return new static(new Url($parts[0]), $description);
}
return new static(new FqsenRef($resolver->resolve($parts[0], $context)), $description);
return new static($resolver->resolve($parts[0], $context), $description);
}
/**
* Returns the ref of this tag.
* Returns the structural element this tag refers to.
*
* @return Reference
* @return Fqsen
*/
public function getReference()
{
......
......@@ -12,9 +12,9 @@
namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use Webmozart\Assert\Assert;
/**
......
......@@ -59,7 +59,6 @@ final class Source extends BaseTag implements Factory\StaticMethod
if (isset($matches[2]) && $matches[2] !== '') {
$lineCount = (int)$matches[2];
}
$description = $matches[3];
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\Type;
abstract class TagWithType extends BaseTag
{
/** @var Type */
protected $type;
/**
* Returns the type section of the variable.
*
* @return Type
*/
public function getType()
{
return $this->type;
}
protected static function extractTypeFromBody(string $body) : array
{
$type = '';
$nestingLevel = 0;
for ($i = 0; $i < strlen($body); $i++) {
$character = $body[$i];
if (trim($character) === '' && $nestingLevel === 0) {
break;
}
$type .= $character;
if (in_array($character, ['<', '(', '[', '{'])) {
$nestingLevel++;
}
if (in_array($character, ['>', ')', ']', '}'])) {
$nestingLevel--;
}
}
$description = trim(substr($body, strlen($type)));
return [$type, $description];
}
}
......@@ -22,12 +22,16 @@ use Webmozart\Assert\Assert;
/**
* Reflection class for a {@}throws tag in a Docblock.
*/
final class Throws extends TagWithType implements Factory\StaticMethod
final class Throws extends BaseTag implements Factory\StaticMethod
{
protected $name = 'throws';
/** @var Type */
private $type;
public function __construct(Type $type, Description $description = null)
{
$this->name = 'throws';
$this->type = $type;
$this->type = $type;
$this->description = $description;
}
......@@ -43,14 +47,24 @@ final class Throws extends TagWithType implements Factory\StaticMethod
Assert::string($body);
Assert::allNotNull([$typeResolver, $descriptionFactory]);
list($type, $description) = self::extractTypeFromBody($body);
$parts = preg_split('/\s+/Su', $body, 2);
$type = $typeResolver->resolve($type, $context);
$description = $descriptionFactory->create($description, $context);
$type = $typeResolver->resolve(isset($parts[0]) ? $parts[0] : '', $context);
$description = $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context);
return new static($type, $description);
}
/**
* Returns the type section of the variable.
*
* @return Type
*/
public function getType()
{
return $this->type;
}
public function __toString()
{
return $this->type . ' ' . $this->description;
......
......@@ -22,24 +22,29 @@ use Webmozart\Assert\Assert;
/**
* Reflection class for a {@}var tag in a Docblock.
*/
class Var_ extends TagWithType implements Factory\StaticMethod
class Var_ extends BaseTag implements Factory\StaticMethod
{
/** @var string */
protected $name = 'var';
/** @var Type */
private $type;
/** @var string */
protected $variableName = '';
/**
* @param string $variableName
* @param Type $type
* @param string $variableName
* @param Type $type
* @param Description $description
*/
public function __construct($variableName, Type $type = null, Description $description = null)
{
Assert::string($variableName);
$this->name = 'var';
$this->variableName = $variableName;
$this->type = $type;
$this->description = $description;
$this->type = $type;
$this->description = $description;
}
/**
......@@ -54,21 +59,18 @@ class Var_ extends TagWithType implements Factory\StaticMethod
Assert::stringNotEmpty($body);
Assert::allNotNull([$typeResolver, $descriptionFactory]);
list($firstPart, $body) = self::extractTypeFromBody($body);
$parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE);
$type = null;
$parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE);
$type = null;
$variableName = '';
// if the first item that is encountered is not a variable; it is a type
if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) {
$type = $typeResolver->resolve($firstPart, $context);
} else {
// first part is not a type; we should prepend it to the parts array for further processing
array_unshift($parts, $firstPart);
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) {
$type = $typeResolver->resolve(array_shift($parts), $context);
array_shift($parts);
}
// if the next item starts with a $ or ...$ it must be the variable name
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) {
if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] == '$')) {
$variableName = array_shift($parts);
array_shift($parts);
......@@ -93,6 +95,16 @@ class Var_ extends TagWithType implements Factory\StaticMethod
}
/**
* Returns the variable's type or null if unknown.
*
* @return Type|null
*/
public function getType()
{
return $this->type;
}
/**
* Returns a string representation for this tag.
*
* @return string
......@@ -100,7 +112,7 @@ class Var_ extends TagWithType implements Factory\StaticMethod
public function __toString()
{
return ($this->type ? $this->type . ' ' : '')
. (empty($this->variableName) ? null : ('$' . $this->variableName))
. ($this->description ? ' ' . $this->description : '');
. '$' . $this->variableName
. ($this->description ? ' ' . $this->description : '');
}
}
......@@ -12,9 +12,9 @@
namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use Webmozart\Assert\Assert;
/**
......
......@@ -93,7 +93,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
return new DocBlock(
$summary,
$description ? $this->descriptionFactory->create($description, $context) : null,
array_filter($this->parseTagBlock($tags, $context), function ($tag) {
array_filter($this->parseTagBlock($tags, $context), function($tag) {
return $tag instanceof Tag;
}),
$context,
......@@ -120,11 +120,11 @@ final class DocBlockFactory implements DocBlockFactoryInterface
$comment = trim(preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ \t]{0,1}(.*)?#u', '$1', $comment));
// reg ex above is not able to remove */ from a single line docblock
if (substr($comment, -2) === '*/') {
if (substr($comment, -2) == '*/') {
$comment = trim(substr($comment, 0, -2));
}
return str_replace(["\r\n", "\r"], "\n", $comment);
return str_replace(array("\r\n", "\r"), "\n", $comment);
}
/**
......@@ -143,7 +143,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
// method does not split tags so we return this verbatim as the fourth result (tags). This saves us the
// performance impact of running a regular expression
if (strpos($comment, '@') === 0) {
return ['', '', '', $comment];
return array('', '', '', $comment);
}
// clears all extra horizontal whitespace from the line endings to prevent parsing issues
......@@ -241,7 +241,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
*/
private function splitTagBlockIntoTagLines($tags)
{
$result = [];
$result = array();
foreach (explode("\n", $tags) as $tag_line) {
if (isset($tag_line[0]) && ($tag_line[0] === '@')) {
$result[] = $tag_line;
......
on: push
name: Qa workflow
jobs:
composer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: composer
uses: docker://composer
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: install --no-interaction --prefer-dist --optimize-autoloader
- name: Code style check
uses: docker://phpdoc/phpcs-ga:master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: -d memory_limit=1024M -s
- name: composer-require-checker
uses: docker://phpga/composer-require-checker-ga
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: check --config-file ./composer-require-config.json composer.json
- name: Psalm
uses: docker://mickaelandrieu/psalm-ga
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: PHPStan
uses: docker://oskarstark/phpstan-ga
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: analyse src tests --level max --configuration phpstan.neon
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Travis Status](https://img.shields.io/travis/phpDocumentor/TypeResolver.svg?label=Linux)](https://travis-ci.org/phpDocumentor/TypeResolver)
[![Appveyor Status](https://img.shields.io/appveyor/ci/phpDocumentor/TypeResolver.svg?label=Windows)](https://ci.appveyor.com/project/phpDocumentor/TypeResolver/branch/master)
[![Coveralls Coverage](https://img.shields.io/coveralls/github/phpDocumentor/TypeResolver.svg)](https://coveralls.io/github/phpDocumentor/TypeResolver?branch=master)
[![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/phpDocumentor/TypeResolver.svg)](https://scrutinizer-ci.com/g/phpDocumentor/TypeResolver/?branch=master)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/phpDocumentor/TypeResolver.svg)](https://scrutinizer-ci.com/g/phpDocumentor/TypeResolver/?branch=master)
[![Stable Version](https://img.shields.io/packagist/v/phpDocumentor/Type-Resolver.svg)](https://packagist.org/packages/phpDocumentor/TypeResolver)
[![Unstable Version](https://img.shields.io/packagist/vpre/phpDocumentor/Type-Resolver.svg)](https://packagist.org/packages/phpDocumentor/TypeResolver)
TypeResolver and FqsenResolver
==============================
......@@ -32,7 +22,8 @@ The easiest way to install this library is with [Composer](https://getcomposer.o
## Examples
Ready to dive in and don't want to read through all that text below? Just consult the [examples](examples) folder and check which type of action that your want to accomplish.
Ready to dive in and don't want to read through all that text below? Just consult the [examples](examples) folder and
check which type of action that your want to accomplish.
## On Types and Element Names
......@@ -48,7 +39,6 @@ The TypeResolver can resolve:
- a php primitive or pseudo-primitive such as a string or void (`@var string` or `@return void`).
- a composite such as an array of string (`@var string[]`).
- a compound such as a string or integer (`@var string|integer`).
- an array expression (`@var (string|TypeResolver)[]`)
- an object or interface such as the TypeResolver class (`@var TypeResolver`
or `@var \phpDocumentor\Reflection\TypeResolver`)
......@@ -68,7 +58,8 @@ Where the FqsenResolver can resolve:
## Resolving a type
In order to resolve a type you will have to instantiate the class `\phpDocumentor\Reflection\TypeResolver` and call its `resolve` method like this:
In order to resolve a type you will have to instantiate the class `\phpDocumentor\Reflection\TypeResolver`
and call its `resolve` method like this:
```php
$typeResolver = new \phpDocumentor\Reflection\TypeResolver();
......@@ -79,30 +70,31 @@ In this example you will receive a Value Object of class `\phpDocumentor\Reflect
elements, one of type `\phpDocumentor\Reflection\Types\String_` and one of type
`\phpDocumentor\Reflection\Types\Integer`.
The real power of this resolver is in its capability to expand partial class names into fully qualified class names; but in order to do that we need an additional `\phpDocumentor\Reflection\Types\Context` class that will inform the resolver in which namespace the given expression occurs and which namespace aliases (or imports) apply.
### Resolving nullable types
Php 7.1 introduced nullable types e.g. `?string`. Type resolver will resolve the original type without the nullable notation `?`
just like it would do without the `?`. After that the type is wrapped in a `\phpDocumentor\Reflection\Types\Nullable` object.
The `Nullable` type has a method to fetch the actual type.
The real power of this resolver is in its capability to expand partial class names into fully qualified class names; but
in order to do that we need an additional `\phpDocumentor\Reflection\Types\Context` class that will inform the resolver
in which namespace the given expression occurs and which namespace aliases (or imports) apply.
## Resolving an FQSEN
A Fully Qualified Structural Element Name is a reference to another element in your code bases and can be resolved using the `\phpDocumentor\Reflection\FqsenResolver` class' `resolve` method, like this:
A Fully Qualified Structural Element Name is a reference to another element in your code bases and can be resolved using
the `\phpDocumentor\Reflection\FqsenResolver` class' `resolve` method, like this:
```php
$fqsenResolver = new \phpDocumentor\Reflection\FqsenResolver();
$fqsen = $fqsenResolver->resolve('\phpDocumentor\Reflection\FqsenResolver::resolve()');
```
In this example we resolve a Fully Qualified Structural Element Name (meaning that it includes the full namespace, class name and element name) and receive a Value Object of type `\phpDocumentor\Reflection\Fqsen`.
In this example we resolve a Fully Qualified Structural Element Name (meaning that it includes the full namespace, class
name and element name) and receive a Value Object of type `\phpDocumentor\Reflection\Fqsen`.
The real power of this resolver is in its capability to expand partial element names into Fully Qualified Structural Element Names; but in order to do that we need an additional `\phpDocumentor\Reflection\Types\Context` class that will inform the resolver in which namespace the given expression occurs and which namespace aliases (or imports) apply.
The real power of this resolver is in its capability to expand partial element names into Fully Qualified Structural
Element Names; but in order to do that we need an additional `\phpDocumentor\Reflection\Types\Context` class that will
inform the resolver in which namespace the given expression occurs and which namespace aliases (or imports) apply.
## Resolving partial Classes and Structural Element Names
Perhaps the best feature of this library is that it knows how to resolve partial class names into fully qualified class names.
Perhaps the best feature of this library is that it knows how to resolve partial class names into fully qualified class
names.
For example, you have this file:
......@@ -124,8 +116,9 @@ class Classy
```
Suppose that you would want to resolve (and expand) the type in the `@var` tag and the element name in the `@see` tag.
For the resolvers to know how to expand partial names you have to provide a bit of _Context_ for them by instantiating a new class named `\phpDocumentor\Reflection\Types\Context` with the name of the namespace and the aliases that are in play.
For the resolvers to know how to expand partial names you have to provide a bit of _Context_ for them by instantiating
a new class named `\phpDocumentor\Reflection\Types\Context` with the name of the namespace and the aliases that are in
play.
### Creating a Context
......@@ -138,7 +131,9 @@ $context = new \phpDocumentor\Reflection\Types\Context(
);
```
Or by using the `\phpDocumentor\Reflection\Types\ContextFactory` to instantiate a new context based on a Reflector object or by providing the namespace that you'd like to extract and the source code of the file in which the given type expression occurs.
Or by using the `\phpDocumentor\Reflection\Types\ContextFactory` to instantiate a new context based on a Reflector
object or by providing the namespace that you'd like to extract and the source code of the file in which the given
type expression occurs.
```php
$contextFactory = new \phpDocumentor\Reflection\Types\ContextFactory();
......@@ -154,7 +149,8 @@ $context = $contextFactory->createForNamespace('\My\Example', file_get_contents(
### Using the Context
After you have obtained a Context it is just a matter of passing it along with the `resolve` method of either Resolver class as second argument and the Resolvers will take this into account when resolving partial names.
After you have obtained a Context it is just a matter of passing it along with the `resolve` method of either Resolver
class as second argument and the Resolvers will take this into account when resolving partial names.
To obtain the resolved class name for the `@var` tag in the example above you can do:
......@@ -163,17 +159,24 @@ $typeResolver = new \phpDocumentor\Reflection\TypeResolver();
$type = $typeResolver->resolve('Types\Context', $context);
```
When you do this you will receive an object of class `\phpDocumentor\Reflection\Types\Object_` for which you can call the `getFqsen` method to receive a Value Object that represents the complete FQSEN. So that would be `phpDocumentor\Reflection\Types\Context`.
When you do this you will receive an object of class `\phpDocumentor\Reflection\Types\Object_` for which you can call
the `getFqsen` method to receive a Value Object that represents the complete FQSEN. So that would be
`phpDocumentor\Reflection\Types\Context`.
> Why is the FQSEN wrapped in another object `Object_`?
>
> The resolve method of the TypeResolver only returns object with the interface `Type` and the FQSEN is a common type that does not represent a Type. Also: in some cases a type can represent an "Untyped Object", meaning that it is an object (signified by the `object` keyword) but does not refer to a specific element using an FQSEN.
> The resolve method of the TypeResolver only returns object with the interface `Type` and the FQSEN is a common
> type that does not represent a Type. Also: in some cases a type can represent an "Untyped Object", meaning that it
> is an object (signified by the `object` keyword) but does not refer to a specific element using an FQSEN.
Another example is on how to resolve the FQSEN of a method as can be seen with the `@see` tag in the example above. To resolve that you can do the following:
Another example is on how to resolve the FQSEN of a method as can be seen with the `@see` tag in the example above. To
resolve that you can do the following:
```php
$fqsenResolver = new \phpDocumentor\Reflection\FqsenResolver();
$type = $fqsenResolver->resolve('Classy::otherFunction()', $context);
```
Because Classy is a Class in the current namespace its FQSEN will have the `My\Example` namespace and by calling the `resolve` method of the FQSEN Resolver you will receive an `Fqsen` object that refers to `\My\Example\Classy::otherFunction()`.
Because Classy is a Class in the current namespace its FQSEN will have the `My\Example` namespace and by calling the
`resolve` method of the FQSEN Resolver you will receive an `Fqsen` object that refers to
`\My\Example\Classy::otherFunction()`.
build: false
clone_folder: c:\typeresolver
max_jobs: 3
platform: x86
pull_requests:
do_not_increment_build_number: true
version: '{build}.{branch}'
skip_tags: true
branches:
only:
- master
environment:
matrix:
- php_ver_target: 7.1
- php_ver_target: 7.2
matrix:
fast_finish: false
cache:
- c:\php -> appveyor.yml
- '%LOCALAPPDATA%\Composer\files'
init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
- SET COMPOSER_NO_INTERACTION=1
- SET PHP=1
- SET ANSICON=121x90 (121x90)
install:
- IF EXIST c:\tools\php (SET PHP=0)
- ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
- cd c:\tools\php
- IF %PHP%==1 copy /Y php.ini-development php.ini
- IF %PHP%==1 echo max_execution_time=1200 >> php.ini
- IF %PHP%==1 echo date.timezone="UTC" >> php.ini
- IF %PHP%==1 echo extension_dir=ext >> php.ini
- IF %PHP%==1 echo extension=php_curl.dll >> php.ini
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini
- IF %PHP%==1 echo zend.assertions=1 >> php.ini
- IF %PHP%==1 echo assert.exception=On >> php.ini
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar
- cd c:\typeresolver
- composer install --no-interaction --prefer-dist --no-progress
test_script:
- cd c:\typeresolver
- vendor\bin\phpunit --no-coverage
{
"symbol-whitelist" : [
"null", "true", "false",
"static", "self", "parent",
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "XSLTProcessor"
],
"php-core-extensions" : [
"Core",
"pcre",
"Reflection",
"tokenizer",
"SPL",
"standard"
]
}
{
"name": "phpdocumentor/type-resolver",
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"type": "library",
"name": "phpdocumentor/type-resolver",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
{"name": "Mike van Riel", "email": "me@mikevanriel.com"}
],
"require": {
"php": "^7.1",
"phpdocumentor/reflection-common": "^2.0"
},
"require-dev": {
"mockery/mockery": "~1",
"ext-tokenizer": "^7.1",
"phpunit/phpunit": "^7.0"
"php": "^5.5 || ^7.0",
"phpdocumentor/reflection-common": "^1.0"
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src"
}
"psr-4": {"phpDocumentor\\Reflection\\": ["src/"]}
},
"autoload-dev": {
"psr-4": {
"phpDocumentor\\Reflection\\": "tests/unit"
}
"psr-4": {"phpDocumentor\\Reflection\\": ["tests/unit"]}
},
"require-dev": {
"phpunit/phpunit": "^5.2||^4.8.24",
"mockery/mockery": "^0.9.4"
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
"dev-master": "1.0.x-dev"
}
}
}
{
"_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": "8168e5df1ad1444a9512e8b63bab2bfe",
"packages": [
{
"name": "phpdocumentor/reflection-common",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a",
"reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"phpunit/phpunit": "~6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"time": "2018-08-07T13:53:10+00:00"
}
],
"packages-dev": [
{
"name": "doctrine/instantiator",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "a2c590166b2133a4633738648b6b064edae0814a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a",
"reference": "a2c590166b2133a4633738648b6b064edae0814a",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"ext-pdo": "*",
"ext-phar": "*",
"phpbench/phpbench": "^0.13",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-shim": "^0.11",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com",
"homepage": "http://ocramius.github.com/"
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
"keywords": [
"constructor",
"instantiate"
],
"time": "2019-03-17T17:37:11+00:00"
},
{
"name": "hamcrest/hamcrest-php",
"version": "v2.0.0",
"source": {
"type": "git",
"url": "https://github.com/hamcrest/hamcrest-php.git",
"reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/776503d3a8e85d4f9a1148614f95b7a608b046ad",
"reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad",
"shasum": ""
},
"require": {
"php": "^5.3|^7.0"
},
"replace": {
"cordoval/hamcrest-php": "*",
"davedevelopment/hamcrest-php": "*",
"kodova/hamcrest-php": "*"
},
"require-dev": {
"phpunit/php-file-iterator": "1.3.3",
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "^1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"classmap": [
"hamcrest"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD"
],
"description": "This is the PHP port of Hamcrest Matchers",
"keywords": [
"test"
],
"time": "2016-01-20T08:20:44+00:00"
},
{
"name": "mockery/mockery",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/mockery/mockery.git",
"reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mockery/mockery/zipball/0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2",
"reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2",
"shasum": ""
},
"require": {
"hamcrest/hamcrest-php": "~2.0",
"lib-pcre": ">=7.0",
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Mockery": "library/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Pádraic Brady",
"email": "padraic.brady@gmail.com",
"homepage": "http://blog.astrumfutura.com"
},
{
"name": "Dave Marshall",
"email": "dave.marshall@atstsolutions.co.uk",
"homepage": "http://davedevelopment.co.uk"
}
],
"description": "Mockery is a simple yet flexible PHP mock object framework",
"homepage": "https://github.com/mockery/mockery",
"keywords": [
"BDD",
"TDD",
"library",
"mock",
"mock objects",
"mockery",
"stub",
"test",
"test double",
"testing"
],
"time": "2019-02-13T09:37:52+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.9.1",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72",
"reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"replace": {
"myclabs/deep-copy": "self.version"
},
"require-dev": {
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
"phpunit/phpunit": "^7.1"
},
"type": "library",
"autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
},
"files": [
"src/DeepCopy/deep_copy.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"keywords": [
"clone",
"copy",
"duplicate",
"object",
"object graph"
],
"time": "2019-04-07T13:18:21+00:00"
},
{
"name": "phar-io/manifest",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/phar-io/manifest.git",
"reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4",
"reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-phar": "*",
"phar-io/version": "^2.0",
"php": "^5.6 || ^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Arne Blankerts",
"email": "arne@blankerts.de",
"role": "Developer"
},
{
"name": "Sebastian Heuer",
"email": "sebastian@phpeople.de",
"role": "Developer"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "Developer"
}
],
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"time": "2018-07-08T19:23:20+00:00"
},
{
"name": "phar-io/version",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/phar-io/version.git",
"reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6",
"reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Arne Blankerts",
"email": "arne@blankerts.de",
"role": "Developer"
},
{
"name": "Sebastian Heuer",
"email": "sebastian@phpeople.de",
"role": "Developer"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "Developer"
}
],
"description": "Library for handling version information and constraints",
"time": "2018-07-08T19:19:57+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "2.0.5",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b",
"reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"suggest": {
"dflydev/markdown": "~1.0",
"erusev/parsedown": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-0": {
"phpDocumentor": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "mike.vanriel@naenius.com"
}
],
"time": "2016-01-25T08:17:30+00:00"
},
{
"name": "phpspec/prophecy",
"version": "1.8.0",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06",
"reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
"sebastian/comparator": "^1.1|^2.0|^3.0",
"sebastian/recursion-context": "^1.0|^2.0|^3.0"
},
"require-dev": {
"phpspec/phpspec": "^2.5|^3.2",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8.x-dev"
}
},
"autoload": {
"psr-0": {
"Prophecy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Marcello Duarte",
"email": "marcello.duarte@gmail.com"
}
],
"description": "Highly opinionated mocking framework for PHP 5.3+",
"homepage": "https://github.com/phpspec/prophecy",
"keywords": [
"Double",
"Dummy",
"fake",
"mock",
"spy",
"stub"
],
"time": "2018-08-05T17:53:17+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "6.1.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d",
"reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-xmlwriter": "*",
"php": "^7.1",
"phpunit/php-file-iterator": "^2.0",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-token-stream": "^3.0",
"sebastian/code-unit-reverse-lookup": "^1.0.1",
"sebastian/environment": "^3.1 || ^4.0",
"sebastian/version": "^2.0.1",
"theseer/tokenizer": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
},
"suggest": {
"ext-xdebug": "^2.6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.1-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"time": "2018-10-31T16:06:48+00:00"
},
{
"name": "phpunit/php-file-iterator",
"version": "2.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "050bedf145a257b1ff02746c31894800e5122946"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946",
"reference": "050bedf145a257b1ff02746c31894800e5122946",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2018-09-13T20:33:42+00:00"
},
{
"name": "phpunit/php-text-template",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2015-06-21T13:50:34+00:00"
},
{
"name": "phpunit/php-timer",
"version": "2.1.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "1038454804406b0b5f5f520358e78c1c2f71501e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e",
"reference": "1038454804406b0b5f5f520358e78c1c2f71501e",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2019-06-07T04:22:29+00:00"
},
{
"name": "phpunit/php-token-stream",
"version": "3.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18",
"reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2018-10-30T05:52:18+00:00"
},
{
"name": "phpunit/phpunit",
"version": "7.5.12",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c",
"reference": "9ba59817745b0fe0c1a5a3032dfd4a6d2994ad1c",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.1",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"myclabs/deep-copy": "^1.7",
"phar-io/manifest": "^1.0.2",
"phar-io/version": "^2.0",
"php": "^7.1",
"phpspec/prophecy": "^1.7",
"phpunit/php-code-coverage": "^6.0.7",
"phpunit/php-file-iterator": "^2.0.1",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-timer": "^2.1",
"sebastian/comparator": "^3.0",
"sebastian/diff": "^3.0",
"sebastian/environment": "^4.0",
"sebastian/exporter": "^3.1",
"sebastian/global-state": "^2.0",
"sebastian/object-enumerator": "^3.0.3",
"sebastian/resource-operations": "^2.0",
"sebastian/version": "^2.0.1"
},
"conflict": {
"phpunit/phpunit-mock-objects": "*"
},
"require-dev": {
"ext-pdo": "*"
},
"suggest": {
"ext-soap": "*",
"ext-xdebug": "*",
"phpunit/php-invoker": "^2.0"
},
"bin": [
"phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "7.5-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2019-05-28T11:59:40+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
"reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
"reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7 || ^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"time": "2017-03-04T06:30:41+00:00"
},
{
"name": "sebastian/comparator",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da",
"reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da",
"shasum": ""
},
"require": {
"php": "^7.1",
"sebastian/diff": "^3.0",
"sebastian/exporter": "^3.1"
},
"require-dev": {
"phpunit/phpunit": "^7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "https://github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"time": "2018-07-12T15:12:46+00:00"
},
{
"name": "sebastian/diff",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29",
"reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^7.5 || ^8.0",
"symfony/process": "^2 || ^3.3 || ^4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Diff implementation",
"homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff",
"udiff",
"unidiff",
"unified diff"
],
"time": "2019-02-04T06:01:07+00:00"
},
{
"name": "sebastian/environment",
"version": "4.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404",
"reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^7.5"
},
"suggest": {
"ext-posix": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.2-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
"homepage": "http://www.github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
"hhvm"
],
"time": "2019-05-05T09:05:15+00:00"
},
{
"name": "sebastian/exporter",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "234199f4528de6d12aaa58b612e98f7d36adb937"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937",
"reference": "234199f4528de6d12aaa58b612e98f7d36adb937",
"shasum": ""
},
"require": {
"php": "^7.0",
"sebastian/recursion-context": "^3.0"
},
"require-dev": {
"ext-mbstring": "*",
"phpunit/phpunit": "^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "http://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"time": "2017-04-03T13:19:02+00:00"
},
{
"name": "sebastian/global-state",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4",
"reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4",
"shasum": ""
},
"require": {
"php": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
},
"suggest": {
"ext-uopz": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"time": "2017-04-27T15:39:26+00:00"
},
{
"name": "sebastian/object-enumerator",
"version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-enumerator.git",
"reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5",
"reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5",
"shasum": ""
},
"require": {
"php": "^7.0",
"sebastian/object-reflector": "^1.1.1",
"sebastian/recursion-context": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"time": "2017-08-03T12:35:26+00:00"
},
{
"name": "sebastian/object-reflector",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-reflector.git",
"reference": "773f97c67f28de00d397be301821b06708fca0be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be",
"reference": "773f97c67f28de00d397be301821b06708fca0be",
"shasum": ""
},
"require": {
"php": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Allows reflection of object attributes, including inherited and non-public ones",
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
"time": "2017-03-29T09:07:27+00:00"
},
{
"name": "sebastian/recursion-context",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8",
"reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8",
"shasum": ""
},
"require": {
"php": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2017-03-03T06:23:57+00:00"
},
{
"name": "sebastian/resource-operations",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/resource-operations.git",
"reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9",
"reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"time": "2018-10-04T04:07:39+00:00"
},
{
"name": "sebastian/version",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "99732be0ddb3361e16ad77b68ba41efc8e979019"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019",
"reference": "99732be0ddb3361e16ad77b68ba41efc8e979019",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2016-10-03T07:35:21+00:00"
},
{
"name": "theseer/tokenizer",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/theseer/tokenizer.git",
"reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/1c42705be2b6c1de5904f8afacef5895cab44bf8",
"reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": "^7.0"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Arne Blankerts",
"email": "arne@blankerts.de",
"role": "Developer"
}
],
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"time": "2019-04-04T09:56:43+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^7.1"
},
"platform-dev": {
"ext-tokenizer": "^7.1"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpunit" version="^6.5.5" installed="6.5.11" location="./tools/phpunit"/>
<phar name="phpstan" version="^0.9.1" installed="0.10.2" location="./tools/phpstan"/>
</phive>
<?xml version="1.0"?>
<ruleset name="phpDocumentor">
<description>The coding standard for phpDocumentor.</description>
<file>src</file>
<file>tests/unit</file>
<exclude-pattern>*/tests/unit/Types/ContextFactoryTest.php</exclude-pattern>
<arg value="p"/>
<rule ref="PSR2">
<include-pattern>*\.php</include-pattern>
</rule>
<rule ref="Doctrine">
<exclude name="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint.UselessDocComment" />
</rule>
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
<exclude-pattern>*/src/*_.php</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix">
<exclude-pattern>*/src/*/Abstract*.php</exclude-pattern>
</rule>
<rule ref="Generic.Formatting.SpaceAfterNot">
<properties>
<property name="spacing" value="0" />
</properties>
</rule>
</ruleset>
parameters:
ignoreErrors:
-
message: '#Parameter \#1 \$types of class phpDocumentor\\Reflection\\Types\\Compound constructor expects array<phpDocumentor\\Reflection\\Type>, array<int, string> given\.#'
path: %currentWorkingDirectory%/tests/unit/Types/CompoundTest.php
- message: '#Parameter \#2 \$fileContents of method phpDocumentor\\Reflection\\Types\\ContextFactory::createForNamespace\(\) expects string, string|false given\.#'
path: %currentWorkingDirectory%/tests/unit/Types/ContextFactoryTest.php
<?xml version="1.0"?>
<psalm
totallyTyped="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config file:///composer/vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<LessSpecificReturnType errorLevel="info" />
</issueHandlers>
</psalm>
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection;
use InvalidArgumentException;
use phpDocumentor\Reflection\Types\Context;
use function explode;
use function implode;
use function strpos;
class FqsenResolver
{
/** @var string Definition of the NAMESPACE operator in PHP */
private const OPERATOR_NAMESPACE = '\\';
const OPERATOR_NAMESPACE = '\\';
public function resolve(string $fqsen, ?Context $context = null) : Fqsen
public function resolve($fqsen, Context $context = null)
{
if ($context === null) {
$context = new Context('');
......@@ -39,8 +34,12 @@ class FqsenResolver
/**
* Tests whether the given type is a Fully Qualified Structural Element Name.
*
* @param string $type
*
* @return bool
*/
private function isFqsen(string $type) : bool
private function isFqsen($type)
{
return strpos($type, self::OPERATOR_NAMESPACE) === 0;
}
......@@ -49,9 +48,13 @@ class FqsenResolver
* Resolves a partial Structural Element Name (i.e. `Reflection\DocBlock`) to its FQSEN representation
* (i.e. `\phpDocumentor\Reflection\DocBlock`) based on the Namespace and aliases mentioned in the Context.
*
* @throws InvalidArgumentException When type is not a valid FQSEN.
* @param string $type
* @param Context $context
*
* @return Fqsen
* @throws \InvalidArgumentException when type is not a valid FQSEN.
*/
private function resolvePartialStructuralElementName(string $type, Context $context) : Fqsen
private function resolvePartialStructuralElementName($type, Context $context)
{
$typeParts = explode(self::OPERATOR_NAMESPACE, $type, 2);
......@@ -60,7 +63,7 @@ class FqsenResolver
// if the first segment is not an alias; prepend namespace name and return
if (!isset($namespaceAliases[$typeParts[0]])) {
$namespace = $context->getNamespace();
if ($namespace !== '') {
if ('' !== $namespace) {
$namespace .= self::OPERATOR_NAMESPACE;
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -15,8 +14,5 @@ namespace phpDocumentor\Reflection;
interface Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*/
public function __toString() : string;
public function __toString();
}
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection;
use ArrayIterator;
use InvalidArgumentException;
use phpDocumentor\Reflection\Types\Array_;
use phpDocumentor\Reflection\Types\Collection;
use phpDocumentor\Reflection\Types\Compound;
use phpDocumentor\Reflection\Types\Context;
use phpDocumentor\Reflection\Types\Integer;
use phpDocumentor\Reflection\Types\Iterable_;
use phpDocumentor\Reflection\Types\Nullable;
use phpDocumentor\Reflection\Types\Object_;
use phpDocumentor\Reflection\Types\String_;
use RuntimeException;
use const PREG_SPLIT_DELIM_CAPTURE;
use const PREG_SPLIT_NO_EMPTY;
use function array_keys;
use function array_pop;
use function class_exists;
use function class_implements;
use function count;
use function in_array;
use function preg_split;
use function strlen;
use function strpos;
use function strtolower;
use function substr;
use function trim;
final class TypeResolver
{
/** @var string Definition of the ARRAY operator for types */
private const OPERATOR_ARRAY = '[]';
const OPERATOR_ARRAY = '[]';
/** @var string Definition of the NAMESPACE operator in PHP */
private const OPERATOR_NAMESPACE = '\\';
/** @var int the iterator parser is inside a compound context */
private const PARSER_IN_COMPOUND = 0;
/** @var int the iterator parser is inside a nullable expression context */
private const PARSER_IN_NULLABLE = 1;
const OPERATOR_NAMESPACE = '\\';
/** @var int the iterator parser is inside an array expression context */
private const PARSER_IN_ARRAY_EXPRESSION = 2;
/** @var int the iterator parser is inside a collection expression context */
private const PARSER_IN_COLLECTION_EXPRESSION = 3;
/**
* @var array<string, string> List of recognized keywords and unto which Value Object they map
* @psalm-var array<string, class-string<Type>>
*/
private $keywords = [
/** @var string[] List of recognized keywords and unto which Value Object they map */
private $keywords = array(
'string' => Types\String_::class,
'int' => Types\Integer::class,
'integer' => Types\Integer::class,
'bool' => Types\Boolean::class,
'boolean' => Types\Boolean::class,
'real' => Types\Float_::class,
'float' => Types\Float_::class,
'double' => Types\Float_::class,
'object' => Object_::class,
'mixed' => Types\Mixed_::class,
'mixed' => Types\Mixed::class,
'array' => Array_::class,
'resource' => Types\Resource_::class,
'resource' => Types\Resource::class,
'void' => Types\Void_::class,
'null' => Types\Null_::class,
'scalar' => Types\Scalar::class,
......@@ -89,15 +52,17 @@ final class TypeResolver
'static' => Types\Static_::class,
'parent' => Types\Parent_::class,
'iterable' => Iterable_::class,
];
);
/** @var FqsenResolver */
private $fqsenResolver;
/**
* Initializes this TypeResolver with the means to create and resolve Fqsen objects.
*
* @param FqsenResolver $fqsenResolver
*/
public function __construct(?FqsenResolver $fqsenResolver = null)
public function __construct(FqsenResolver $fqsenResolver = null)
{
$this->fqsenResolver = $fqsenResolver ?: new FqsenResolver();
}
......@@ -112,177 +77,39 @@ final class TypeResolver
* This method only works as expected if the namespace and aliases are set;
* no dynamic reflection is being performed here.
*
* @uses Context::getNamespaceAliases() to check whether the first part of the relative type name should not be
* replaced with another namespace.
* @param string $type The relative or absolute type.
* @param Context $context
*
* @uses Context::getNamespace() to determine with what to prefix the type name.
* @uses Context::getNamespaceAliases() to check whether the first part of the relative type name should not be
* replaced with another namespace.
*
* @param string $type The relative or absolute type.
* @return Type|null
*/
public function resolve(string $type, ?Context $context = null) : Type
public function resolve($type, Context $context = null)
{
if (!is_string($type)) {
throw new \InvalidArgumentException(
'Attempted to resolve type but it appeared not to be a string, received: ' . var_export($type, true)
);
}
$type = trim($type);
if (!$type) {
throw new InvalidArgumentException('Attempted to resolve "' . $type . '" but it appears to be empty');
throw new \InvalidArgumentException('Attempted to resolve "' . $type . '" but it appears to be empty');
}
if ($context === null) {
$context = new Context('');
}
// split the type string into tokens `|`, `?`, `<`, `>`, `,`, `(`, `)[]`, '<', '>' and type names
$tokens = preg_split(
'/(\\||\\?|<|>|, ?|\\(|\\)(?:\\[\\])+)/',
$type,
-1,
PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
);
if ($tokens === false) {
throw new InvalidArgumentException('Unable to split the type string "' . $type . '" into tokens');
}
$tokenIterator = new ArrayIterator($tokens);
return $this->parseTypes($tokenIterator, $context, self::PARSER_IN_COMPOUND);
}
/**
* Analyse each tokens and creates types
*
* @param ArrayIterator $tokens the iterator on tokens
* @param int $parserContext on of self::PARSER_* constants, indicating
* the context where we are in the parsing
*/
private function parseTypes(ArrayIterator $tokens, Context $context, int $parserContext) : Type
{
$types = [];
$token = '';
while ($tokens->valid()) {
$token = $tokens->current();
if ($token === '|') {
if (count($types) === 0) {
throw new RuntimeException(
'A type is missing before a type separator'
);
}
if ($parserContext !== self::PARSER_IN_COMPOUND
&& $parserContext !== self::PARSER_IN_ARRAY_EXPRESSION
&& $parserContext !== self::PARSER_IN_COLLECTION_EXPRESSION
) {
throw new RuntimeException(
'Unexpected type separator'
);
}
$tokens->next();
} elseif ($token === '?') {
if ($parserContext !== self::PARSER_IN_COMPOUND
&& $parserContext !== self::PARSER_IN_ARRAY_EXPRESSION
&& $parserContext !== self::PARSER_IN_COLLECTION_EXPRESSION
) {
throw new RuntimeException(
'Unexpected nullable character'
);
}
$tokens->next();
$type = $this->parseTypes($tokens, $context, self::PARSER_IN_NULLABLE);
$types[] = new Nullable($type);
} elseif ($token === '(') {
$tokens->next();
$type = $this->parseTypes($tokens, $context, self::PARSER_IN_ARRAY_EXPRESSION);
$resolvedType = new Array_($type);
$token = $tokens->current();
// Someone did not properly close their array expression ..
if ($token === null) {
break;
}
// we generate arrays corresponding to the number of '[]' after the ')'
$numberOfArrays = (strlen($token) - 1) / 2;
for ($i = 0; $i < $numberOfArrays - 1; ++$i) {
$resolvedType = new Array_($resolvedType);
}
$types[] = $resolvedType;
$tokens->next();
} elseif ($parserContext === self::PARSER_IN_ARRAY_EXPRESSION && $token[0] === ')') {
break;
} elseif ($token === '<') {
if (count($types) === 0) {
throw new RuntimeException(
'Unexpected collection operator "<", class name is missing'
);
}
$classType = array_pop($types);
if ($classType !== null) {
$types[] = $this->resolveCollection($tokens, $classType, $context);
}
$tokens->next();
} elseif ($parserContext === self::PARSER_IN_COLLECTION_EXPRESSION
&& ($token === '>' || trim($token) === ',')
) {
break;
} else {
$type = $this->resolveSingleType($token, $context);
$tokens->next();
if ($parserContext === self::PARSER_IN_NULLABLE) {
return $type;
}
$types[] = $type;
}
}
if ($token === '|') {
throw new RuntimeException(
'A type is missing after a type separator'
);
}
if (count($types) === 0) {
if ($parserContext === self::PARSER_IN_NULLABLE) {
throw new RuntimeException(
'A type is missing after a nullable character'
);
}
if ($parserContext === self::PARSER_IN_ARRAY_EXPRESSION) {
throw new RuntimeException(
'A type is missing in an array expression'
);
}
if ($parserContext === self::PARSER_IN_COLLECTION_EXPRESSION) {
throw new RuntimeException(
'A type is missing in a collection expression'
);
}
} elseif (count($types) === 1) {
return $types[0];
}
return new Compound($types);
}
/**
* resolve the given type into a type object
*
* @param string $type the type string, representing a single type
*
* @return Type|Array_|Object_
*/
private function resolveSingleType(string $type, Context $context)
{
switch (true) {
case $this->isNullableType($type):
return $this->resolveNullableType($type, $context);
case $this->isKeyword($type):
return $this->resolveKeyword($type);
case ($this->isCompoundType($type)):
return $this->resolveCompoundType($type, $context);
case $this->isTypedArray($type):
return $this->resolveTypedArray($type, $context);
case $this->isFqsen($type):
......@@ -292,28 +119,32 @@ final class TypeResolver
// @codeCoverageIgnoreStart
default:
// I haven't got the foggiest how the logic would come here but added this as a defense.
throw new RuntimeException(
throw new \RuntimeException(
'Unable to resolve type "' . $type . '", there is no known method to resolve it'
);
}
// @codeCoverageIgnoreEnd
}
/**
* Adds a keyword to the list of Keywords and associates it with a specific Value Object.
*
* @param string $keyword
* @param string $typeClassName
*
* @return void
*/
public function addKeyword(string $keyword, string $typeClassName) : void
public function addKeyword($keyword, $typeClassName)
{
if (!class_exists($typeClassName)) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
'The Value Object that needs to be created with a keyword "' . $keyword . '" must be an existing class'
. ' but we could not find the class ' . $typeClassName
);
}
if (!in_array(Type::class, class_implements($typeClassName), true)) {
throw new InvalidArgumentException(
if (!in_array(Type::class, class_implements($typeClassName))) {
throw new \InvalidArgumentException(
'The class "' . $typeClassName . '" must implement the interface "phpDocumentor\Reflection\Type"'
);
}
......@@ -325,8 +156,10 @@ final class TypeResolver
* Detects whether the given type represents an array.
*
* @param string $type A relative or absolute type as defined in the phpDocumentor documentation.
*
* @return bool
*/
private function isTypedArray(string $type) : bool
private function isTypedArray($type)
{
return substr($type, -2) === self::OPERATOR_ARRAY;
}
......@@ -335,8 +168,10 @@ final class TypeResolver
* Detects whether the given type represents a PHPDoc keyword.
*
* @param string $type A relative or absolute type as defined in the phpDocumentor documentation.
*
* @return bool
*/
private function isKeyword(string $type) : bool
private function isKeyword($type)
{
return in_array(strtolower($type), array_keys($this->keywords), true);
}
......@@ -345,126 +180,119 @@ final class TypeResolver
* Detects whether the given type represents a relative structural element name.
*
* @param string $type A relative or absolute type as defined in the phpDocumentor documentation.
*
* @return bool
*/
private function isPartialStructuralElementName(string $type) : bool
private function isPartialStructuralElementName($type)
{
return ($type[0] !== self::OPERATOR_NAMESPACE) && !$this->isKeyword($type);
}
/**
* Tests whether the given type is a Fully Qualified Structural Element Name.
*
* @param string $type
*
* @return bool
*/
private function isFqsen(string $type) : bool
private function isFqsen($type)
{
return strpos($type, self::OPERATOR_NAMESPACE) === 0;
}
/**
* Tests whether the given type is a compound type (i.e. `string|int`).
*
* @param string $type
*
* @return bool
*/
private function isCompoundType($type)
{
return strpos($type, '|') !== false;
}
/**
* Test whether the given type is a nullable type (i.e. `?string`)
*
* @param string $type
*
* @return bool
*/
private function isNullableType($type)
{
return $type[0] === '?';
}
/**
* Resolves the given typed array string (i.e. `string[]`) into an Array object with the right types set.
*
* @param string $type
* @param Context $context
*
* @return Array_
*/
private function resolveTypedArray(string $type, Context $context) : Array_
private function resolveTypedArray($type, Context $context)
{
return new Array_($this->resolveSingleType(substr($type, 0, -2), $context));
return new Array_($this->resolve(substr($type, 0, -2), $context));
}
/**
* Resolves the given keyword (such as `string`) into a Type object representing that keyword.
*
* @param string $type
*
* @return Type
*/
private function resolveKeyword(string $type) : Type
private function resolveKeyword($type)
{
$className = $this->keywords[strtolower($type)];
return new $className();
}
/**
* Resolves the given FQSEN string into an FQSEN object.
*
* @param string $type
* @param Context|null $context
*
* @return Object_
*/
private function resolveTypedObject(string $type, ?Context $context = null) : Object_
private function resolveTypedObject($type, Context $context = null)
{
return new Object_($this->fqsenResolver->resolve($type, $context));
}
/**
* Resolves the collection values and keys
* Resolves a compound type (i.e. `string|int`) into the appropriate Type objects or FQSEN.
*
* @return Array_|Collection
* @param string $type
* @param Context $context
*
* @return Compound
*/
private function resolveCollection(ArrayIterator $tokens, Type $classType, Context $context) : Type
private function resolveCompoundType($type, Context $context)
{
$isArray = ((string) $classType === 'array');
// allow only "array" or class name before "<"
if (!$isArray
&& (!$classType instanceof Object_ || $classType->getFqsen() === null)) {
throw new RuntimeException(
$classType . ' is not a collection'
);
}
$tokens->next();
$valueType = $this->parseTypes($tokens, $context, self::PARSER_IN_COLLECTION_EXPRESSION);
$keyType = null;
if ($tokens->current() !== null && trim($tokens->current()) === ',') {
// if we have a comma, then we just parsed the key type, not the value type
$keyType = $valueType;
if ($isArray) {
// check the key type for an "array" collection. We allow only
// strings or integers.
if (!$keyType instanceof String_ &&
!$keyType instanceof Integer &&
!$keyType instanceof Compound
) {
throw new RuntimeException(
'An array can have only integers or strings as keys'
);
}
if ($keyType instanceof Compound) {
foreach ($keyType->getIterator() as $item) {
if (!$item instanceof String_ &&
!$item instanceof Integer
) {
throw new RuntimeException(
'An array can have only integers or strings as keys'
);
}
}
}
}
$tokens->next();
// now let's parse the value type
$valueType = $this->parseTypes($tokens, $context, self::PARSER_IN_COLLECTION_EXPRESSION);
}
if ($tokens->current() !== '>') {
if (empty($tokens->current())) {
throw new RuntimeException(
'Collection: ">" is missing'
);
}
throw new RuntimeException(
'Unexpected character "' . $tokens->current() . '", ">" is missing'
);
}
if ($isArray) {
return new Array_($valueType, $keyType);
}
$types = [];
/** @psalm-suppress RedundantCondition */
if ($classType instanceof Object_) {
return $this->makeCollectionFromObject($classType, $valueType, $keyType);
foreach (explode('|', $type) as $part) {
$types[] = $this->resolve($part, $context);
}
throw new RuntimeException('Invalid $classType provided');
return new Compound($types);
}
private function makeCollectionFromObject(Object_ $object, Type $valueType, ?Type $keyType = null) : Collection
/**
* Resolve nullable types (i.e. `?string`) into a Nullable type wrapper
*
* @param string $type
* @param Context $context
*
* @return Nullable
*/
private function resolveNullableType($type, Context $context)
{
return new Collection($object->getFqsen(), $valueType, $keyType);
return new Nullable($this->resolve(ltrim($type, '?'), $context));
}
}
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\Types;
use phpDocumentor\Reflection\Type;
/**
* Represents a list of values. This is an abstract class for Array_ and Collection.
*/
abstract class AbstractList implements Type
{
/** @var Type */
protected $valueType;
/** @var Type|null */
protected $keyType;
/** @var Type */
protected $defaultKeyType;
/**
* Initializes this representation of an array with the given Type.
*/
public function __construct(?Type $valueType = null, ?Type $keyType = null)
{
if ($valueType === null) {
$valueType = new Mixed_();
}
$this->valueType = $valueType;
$this->defaultKeyType = new Compound([new String_(), new Integer()]);
$this->keyType = $keyType;
}
/**
* Returns the type for the keys of this array.
*/
public function getKeyType() : Type
{
if ($this->keyType === null) {
return $this->defaultKeyType;
}
return $this->keyType;
}
/**
* Returns the value for the keys of this array.
*/
public function getValueType() : Type
{
return $this->valueType;
}
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*/
public function __toString() : string
{
if ($this->keyType) {
return 'array<' . $this->keyType . ',' . $this->valueType . '>';
}
if ($this->valueType instanceof Mixed_) {
return 'array';
}
if ($this->valueType instanceof Compound) {
return '(' . $this->valueType . ')[]';
}
return $this->valueType . '[]';
}
}
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\Types;
use phpDocumentor\Reflection\Type;
/**
* Represents an array type as described in the PSR-5, the PHPDoc Standard.
*
* An array can be represented in two forms:
*
* 1. Untyped (`array`), where the key and value type is unknown and hence classified as 'Mixed_'.
* 1. Untyped (`array`), where the key and value type is unknown and hence classified as 'Mixed'.
* 2. Types (`string[]`), where the value type is provided by preceding an opening and closing square bracket with a
* type name.
*/
final class Array_ extends AbstractList
final class Array_ implements Type
{
/** @var Type */
private $valueType;
/** @var Type */
private $keyType;
/**
* Initializes this representation of an array with the given Type or Fqsen.
*
* @param Type $valueType
* @param Type $keyType
*/
public function __construct(Type $valueType = null, Type $keyType = null)
{
if ($keyType === null) {
$keyType = new Compound([ new String_(), new Integer() ]);
}
if ($valueType === null) {
$valueType = new Mixed();
}
$this->valueType = $valueType;
$this->keyType = $keyType;
}
/**
* Returns the type for the keys of this array.
*
* @return Type
*/
public function getKeyType()
{
return $this->keyType;
}
/**
* Returns the value for the keys of this array.
*
* @return Type
*/
public function getValueType()
{
return $this->valueType;
}
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString()
{
if ($this->valueType instanceof Mixed) {
return 'array';
}
return $this->valueType . '[]';
}
}
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -22,8 +21,10 @@ final class Boolean implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'bool';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -22,8 +21,10 @@ final class Callable_ implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'callable';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\Types;
use phpDocumentor\Reflection\Fqsen;
use phpDocumentor\Reflection\Type;
/**
* Represents a collection type as described in the PSR-5, the PHPDoc Standard.
*
* A collection can be represented in two forms:
*
* 1. `ACollectionObject<aValueType>`
* 2. `ACollectionObject<aValueType,aKeyType>`
*
* - ACollectionObject can be 'array' or an object that can act as an array
* - aValueType and aKeyType can be any type expression
*/
final class Collection extends AbstractList
{
/** @var Fqsen|null */
private $fqsen;
/**
* Initializes this representation of an array with the given Type or Fqsen.
*/
public function __construct(?Fqsen $fqsen, Type $valueType, ?Type $keyType = null)
{
parent::__construct($valueType, $keyType);
$this->fqsen = $fqsen;
}
/**
* Returns the FQSEN associated with this object.
*/
public function getFqsen() : ?Fqsen
{
return $this->fqsen;
}
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*/
public function __toString() : string
{
$objectType = (string) ($this->fqsen ?? 'object');
if ($this->keyType === null) {
return $objectType . '<' . $this->valueType . '>';
}
return $objectType . '<' . $this->keyType . ',' . $this->valueType . '>';
}
}
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\Types;
use ArrayIterator;
use InvalidArgumentException;
use IteratorAggregate;
use phpDocumentor\Reflection\Type;
use function implode;
/**
* Value Object representing a Compound Type.
......@@ -26,7 +21,7 @@ use function implode;
* using an OR operator (`|`). This combination of types signifies that whatever is associated with this compound type
* may contain a value with any of the given types.
*/
final class Compound implements Type, IteratorAggregate
final class Compound implements Type
{
/** @var Type[] */
private $types;
......@@ -35,15 +30,13 @@ final class Compound implements Type, IteratorAggregate
* Initializes a compound type (i.e. `string|int`) and tests if the provided types all implement the Type interface.
*
* @param Type[] $types
*
* @throws InvalidArgumentException When types are not all instance of Type.
* @throws \InvalidArgumentException when types are not all instance of Type
*/
public function __construct(array $types)
{
foreach ($types as $type) {
/** @psalm-suppress RedundantConditionGivenDocblockType */
if (!$type instanceof Type) {
throw new InvalidArgumentException('A compound type can only have other types as elements');
throw new \InvalidArgumentException('A compound type can only have other types as elements');
}
}
......@@ -52,8 +45,12 @@ final class Compound implements Type, IteratorAggregate
/**
* Returns the type at the given index.
*
* @param integer $index
*
* @return Type|null
*/
public function get(int $index) : ?Type
public function get($index)
{
if (!$this->has($index)) {
return null;
......@@ -64,25 +61,23 @@ final class Compound implements Type, IteratorAggregate
/**
* Tests if this compound type has a type with the given index.
*
* @param integer $index
*
* @return bool
*/
public function has(int $index) : bool
public function has($index)
{
return isset($this->types[$index]);
}
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return implode('|', $this->types);
}
/**
* {@inheritdoc}
*/
public function getIterator()
{
return new ArrayIterator($this->types);
}
}
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\Types;
use function strlen;
use function substr;
use function trim;
/**
* Provides information about the Context in which the DocBlock occurs that receives this context.
*
......@@ -36,27 +31,26 @@ final class Context
/** @var string The current namespace. */
private $namespace;
/** @var string[] List of namespace aliases => Fully Qualified Namespace. */
/** @var array List of namespace aliases => Fully Qualified Namespace. */
private $namespaceAliases;
/**
* Initializes the new context and normalizes all passed namespaces to be in Qualified Namespace Name (QNN)
* format (without a preceding `\`).
*
* @param string $namespace The namespace where this DocBlock resides in.
* @param string[] $namespaceAliases List of namespace aliases => Fully Qualified Namespace.
* @param string $namespace The namespace where this DocBlock resides in.
* @param array $namespaceAliases List of namespace aliases => Fully Qualified Namespace.
*/
public function __construct(string $namespace, array $namespaceAliases = [])
public function __construct($namespace, array $namespaceAliases = [])
{
$this->namespace = $namespace !== 'global' && $namespace !== 'default'
? trim($namespace, '\\')
$this->namespace = ('global' !== $namespace && 'default' !== $namespace)
? trim((string)$namespace, '\\')
: '';
foreach ($namespaceAliases as $alias => $fqnn) {
if ($fqnn[0] === '\\') {
$fqnn = substr($fqnn, 1);
}
if ($fqnn[strlen($fqnn) - 1] === '\\') {
$fqnn = substr($fqnn, 0, -1);
}
......@@ -69,8 +63,10 @@ final class Context
/**
* Returns the Qualified Namespace Name (thus without `\` in front) where the associated element is in.
*
* @return string
*/
public function getNamespace() : string
public function getNamespace()
{
return $this->namespace;
}
......@@ -81,7 +77,7 @@ final class Context
*
* @return string[]
*/
public function getNamespaceAliases() : array
public function getNamespaceAliases()
{
return $this->namespaceAliases;
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\Types;
use ArrayIterator;
use InvalidArgumentException;
use ReflectionClass;
use ReflectionClassConstant;
use ReflectionMethod;
use ReflectionParameter;
use ReflectionProperty;
use Reflector;
use RuntimeException;
use UnexpectedValueException;
use const T_AS;
use const T_CLASS;
use const T_CURLY_OPEN;
use const T_DOLLAR_OPEN_CURLY_BRACES;
use const T_NAMESPACE;
use const T_NS_SEPARATOR;
use const T_STRING;
use const T_USE;
use function array_merge;
use function file_exists;
use function file_get_contents;
use function get_class;
use function is_string;
use function token_get_all;
use function trim;
/**
* Convenience class to create a Context for DocBlocks when not using the Reflection Component of phpDocumentor.
*
......@@ -51,78 +24,31 @@ use function trim;
final class ContextFactory
{
/** The literal used at the end of a use statement. */
private const T_LITERAL_END_OF_USE = ';';
const T_LITERAL_END_OF_USE = ';';
/** The literal used between sets of use statements */
private const T_LITERAL_USE_SEPARATOR = ',';
const T_LITERAL_USE_SEPARATOR = ',';
/**
* Build a Context given a Class Reflection.
*
* @param \Reflector $reflector
*
* @see Context for more information on Contexts.
*
* @return Context
*/
public function createFromReflector(Reflector $reflector) : Context
{
if ($reflector instanceof ReflectionClass) {
return $this->createFromReflectionClass($reflector);
}
if ($reflector instanceof ReflectionParameter) {
return $this->createFromReflectionParameter($reflector);
}
if ($reflector instanceof ReflectionMethod) {
return $this->createFromReflectionMethod($reflector);
}
if ($reflector instanceof ReflectionProperty) {
return $this->createFromReflectionProperty($reflector);
}
if ($reflector instanceof ReflectionClassConstant) {
return $this->createFromReflectionClassConstant($reflector);
}
throw new UnexpectedValueException('Unhandled \Reflector instance given: ' . get_class($reflector));
}
private function createFromReflectionParameter(ReflectionParameter $parameter) : Context
public function createFromReflector(\Reflector $reflector)
{
$class = $parameter->getDeclaringClass();
if ($class) {
return $this->createFromReflectionClass($class);
if (method_exists($reflector, 'getDeclaringClass')) {
$reflector = $reflector->getDeclaringClass();
}
throw new InvalidArgumentException('Unable to get class of ' . $parameter->getName());
}
private function createFromReflectionMethod(ReflectionMethod $method) : Context
{
return $this->createFromReflectionClass($method->getDeclaringClass());
}
private function createFromReflectionProperty(ReflectionProperty $property) : Context
{
return $this->createFromReflectionClass($property->getDeclaringClass());
}
private function createFromReflectionClassConstant(ReflectionClassConstant $constant) : Context
{
return $this->createFromReflectionClass($constant->getDeclaringClass());
}
private function createFromReflectionClass(ReflectionClass $class) : Context
{
$fileName = $class->getFileName();
$namespace = $class->getNamespaceName();
if (is_string($fileName) && file_exists($fileName)) {
$contents = file_get_contents($fileName);
if ($contents === false) {
throw new RuntimeException('Unable to read file "' . $fileName . '"');
}
$fileName = $reflector->getFileName();
$namespace = $reflector->getNamespaceName();
return $this->createForNamespace($namespace, $contents);
if (file_exists($fileName)) {
return $this->createForNamespace($namespace, file_get_contents($fileName));
}
return new Context($namespace, []);
......@@ -131,18 +57,19 @@ final class ContextFactory
/**
* Build a Context for a namespace in the provided file contents.
*
* @param string $namespace It does not matter if a `\` precedes the namespace name, this method first normalizes.
* @param string $fileContents the file's contents to retrieve the aliases from with the given namespace.
*
* @see Context for more information on Contexts.
*
* @param string $namespace It does not matter if a `\` precedes the namespace name,
* this method first normalizes.
* @param string $fileContents The file's contents to retrieve the aliases from with the given namespace.
* @return Context
*/
public function createForNamespace(string $namespace, string $fileContents) : Context
public function createForNamespace($namespace, $fileContents)
{
$namespace = trim($namespace, '\\');
$useStatements = [];
$namespace = trim($namespace, '\\');
$useStatements = [];
$currentNamespace = '';
$tokens = new ArrayIterator(token_get_all($fileContents));
$tokens = new \ArrayIterator(token_get_all($fileContents));
while ($tokens->valid()) {
switch ($tokens->current()[0]) {
......@@ -153,7 +80,7 @@ final class ContextFactory
// Fast-forward the iterator through the class so that any
// T_USE tokens found within are skipped - these are not
// valid namespace use statements so should be ignored.
$braceLevel = 0;
$braceLevel = 0;
$firstBraceFound = false;
while ($tokens->valid() && ($braceLevel > 0 || !$firstBraceFound)) {
if ($tokens->current() === '{'
......@@ -162,14 +89,12 @@ final class ContextFactory
if (!$firstBraceFound) {
$firstBraceFound = true;
}
++$braceLevel;
$braceLevel++;
}
if ($tokens->current() === '}') {
--$braceLevel;
$braceLevel--;
}
$tokens->next();
}
break;
......@@ -179,7 +104,6 @@ final class ContextFactory
}
break;
}
$tokens->next();
}
......@@ -188,8 +112,12 @@ final class ContextFactory
/**
* Deduce the name from tokens when we are at the T_NAMESPACE token.
*
* @param \ArrayIterator $tokens
*
* @return string
*/
private function parseNamespace(ArrayIterator $tokens) : string
private function parseNamespace(\ArrayIterator $tokens)
{
// skip to the first string or namespace separator
$this->skipToNextStringOrNamespaceSeparator($tokens);
......@@ -207,18 +135,22 @@ final class ContextFactory
/**
* Deduce the names of all imports when we are at the T_USE token.
*
* @param \ArrayIterator $tokens
*
* @return string[]
*/
private function parseUseStatement(ArrayIterator $tokens) : array
private function parseUseStatement(\ArrayIterator $tokens)
{
$uses = [];
$continue = true;
while (true) {
while ($continue) {
$this->skipToNextStringOrNamespaceSeparator($tokens);
$uses = array_merge($uses, $this->extractUseStatements($tokens));
list($alias, $fqnn) = $this->extractUseStatement($tokens);
$uses[$alias] = $fqnn;
if ($tokens->current()[0] === self::T_LITERAL_END_OF_USE) {
return $uses;
$continue = false;
}
}
......@@ -227,8 +159,12 @@ final class ContextFactory
/**
* Fast-forwards the iterator as longs as we don't encounter a T_STRING or T_NS_SEPARATOR token.
*
* @param \ArrayIterator $tokens
*
* @return void
*/
private function skipToNextStringOrNamespaceSeparator(ArrayIterator $tokens) : void
private function skipToNextStringOrNamespaceSeparator(\ArrayIterator $tokens)
{
while ($tokens->valid() && ($tokens->current()[0] !== T_STRING) && ($tokens->current()[0] !== T_NS_SEPARATOR)) {
$tokens->next();
......@@ -237,114 +173,38 @@ final class ContextFactory
/**
* Deduce the namespace name and alias of an import when we are at the T_USE token or have not reached the end of
* a USE statement yet. This will return a key/value array of the alias => namespace.
* a USE statement yet.
*
* @return string[]
* @param \ArrayIterator $tokens
*
* @psalm-suppress TypeDoesNotContainType
* @return string
*/
private function extractUseStatements(ArrayIterator $tokens) : array
private function extractUseStatement(\ArrayIterator $tokens)
{
$extractedUseStatements = [];
$groupedNs = '';
$currentNs = '';
$currentAlias = '';
$state = 'start';
while ($tokens->valid()) {
$currentToken = $tokens->current();
$tokenId = is_string($currentToken) ? $currentToken : $currentToken[0];
$tokenValue = is_string($currentToken) ? null : $currentToken[1];
switch ($state) {
case 'start':
switch ($tokenId) {
case T_STRING:
case T_NS_SEPARATOR:
$currentNs .= $tokenValue;
$currentAlias = $tokenValue;
break;
case T_CURLY_OPEN:
case '{':
$state = 'grouped';
$groupedNs = $currentNs;
break;
case T_AS:
$state = 'start-alias';
break;
case self::T_LITERAL_USE_SEPARATOR:
case self::T_LITERAL_END_OF_USE:
$state = 'end';
break;
default:
break;
}
break;
case 'start-alias':
switch ($tokenId) {
case T_STRING:
$currentAlias = $tokenValue;
break;
case self::T_LITERAL_USE_SEPARATOR:
case self::T_LITERAL_END_OF_USE:
$state = 'end';
break;
default:
break;
}
break;
case 'grouped':
switch ($tokenId) {
case T_STRING:
case T_NS_SEPARATOR:
$currentNs .= $tokenValue;
$currentAlias = $tokenValue;
break;
case T_AS:
$state = 'grouped-alias';
break;
case self::T_LITERAL_USE_SEPARATOR:
$state = 'grouped';
$extractedUseStatements[$currentAlias] = $currentNs;
$currentNs = $groupedNs;
$currentAlias = '';
break;
case self::T_LITERAL_END_OF_USE:
$state = 'end';
break;
default:
break;
}
break;
case 'grouped-alias':
switch ($tokenId) {
case T_STRING:
$currentAlias = $tokenValue;
break;
case self::T_LITERAL_USE_SEPARATOR:
$state = 'grouped';
$extractedUseStatements[$currentAlias] = $currentNs;
$currentNs = $groupedNs;
$currentAlias = '';
break;
case self::T_LITERAL_END_OF_USE:
$state = 'end';
break;
default:
break;
}
$result = [''];
while ($tokens->valid()
&& ($tokens->current()[0] !== self::T_LITERAL_USE_SEPARATOR)
&& ($tokens->current()[0] !== self::T_LITERAL_END_OF_USE)
) {
if ($tokens->current()[0] === T_AS) {
$result[] = '';
}
if ($state === 'end') {
break;
if ($tokens->current()[0] === T_STRING || $tokens->current()[0] === T_NS_SEPARATOR) {
$result[count($result) - 1] .= $tokens->current()[1];
}
$tokens->next();
}
if ($groupedNs !== $currentNs) {
$extractedUseStatements[$currentAlias] = $currentNs;
if (count($result) == 1) {
$backslashPos = strrpos($result[0], '\\');
if (false !== $backslashPos) {
$result[] = substr($result[0], $backslashPos + 1);
} else {
$result[] = $result[0];
}
}
return $extractedUseStatements;
return array_reverse($result);
}
}
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -22,8 +21,10 @@ final class Float_ implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'float';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -19,8 +18,10 @@ final class Integer implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'int';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2017 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -22,8 +21,10 @@ final class Iterable_ implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'iterable';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -18,12 +17,14 @@ use phpDocumentor\Reflection\Type;
/**
* Value Object representing an unknown, or mixed, type.
*/
final class Mixed_ implements Type
final class Mixed implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'mixed';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -22,8 +21,10 @@ final class Null_ implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'null';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2017 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -20,11 +19,15 @@ use phpDocumentor\Reflection\Type;
*/
final class Nullable implements Type
{
/** @var Type The actual type that is wrapped */
/**
* @var Type
*/
private $realType;
/**
* Initialises this nullable type using the real type embedded
*
* @param Type $realType
*/
public function __construct(Type $realType)
{
......@@ -33,16 +36,20 @@ final class Nullable implements Type
/**
* Provide access to the actual type directly, if needed.
*
* @return Type
*/
public function getActualType() : Type
public function getActualType()
{
return $this->realType;
}
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return '?' . $this->realType->__toString();
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
namespace phpDocumentor\Reflection\Types;
use InvalidArgumentException;
use phpDocumentor\Reflection\Fqsen;
use phpDocumentor\Reflection\Type;
use function strpos;
/**
* Value Object representing an object.
......@@ -33,14 +30,15 @@ final class Object_ implements Type
/**
* Initializes this object with an optional FQSEN, if not provided this object is considered 'untyped'.
*
* @throws InvalidArgumentException When provided $fqsen is not a valid type.
* @param Fqsen $fqsen
* @throws \InvalidArgumentException when provided $fqsen is not a valid type.
*/
public function __construct(?Fqsen $fqsen = null)
public function __construct(Fqsen $fqsen = null)
{
if (strpos((string) $fqsen, '::') !== false || strpos((string) $fqsen, '()') !== false) {
throw new InvalidArgumentException(
if (strpos((string)$fqsen, '::') !== false || strpos((string)$fqsen, '()') !== false) {
throw new \InvalidArgumentException(
'Object types can only refer to a class, interface or trait but a method, function, constant or '
. 'property was received: ' . (string) $fqsen
. 'property was received: ' . (string)$fqsen
);
}
......@@ -49,16 +47,23 @@ final class Object_ implements Type
/**
* Returns the FQSEN associated with this object.
*
* @return Fqsen|null
*/
public function getFqsen() : ?Fqsen
public function getFqsen()
{
return $this->fqsen;
}
public function __toString() : string
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString()
{
if ($this->fqsen) {
return (string) $this->fqsen;
return (string)$this->fqsen;
}
return 'object';
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -24,8 +23,10 @@ final class Parent_ implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'parent';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -18,12 +17,14 @@ use phpDocumentor\Reflection\Type;
/**
* Value Object representing the 'resource' Type.
*/
final class Resource_ implements Type
final class Resource implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'resource';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -22,8 +21,10 @@ final class Scalar implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'scalar';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -24,8 +23,10 @@ final class Self_ implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'self';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -29,8 +28,10 @@ final class Static_ implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'static';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -22,8 +21,10 @@ final class String_ implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'string';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -25,8 +24,10 @@ final class This implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return '$this';
}
......
<?php
declare(strict_types=1);
/**
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright 2010-2015 Mike van Riel<mike@phpdoc.org>
* @license http://www.opensource.org/licenses/mit-license.php MIT
* @link http://phpdoc.org
*/
......@@ -25,8 +24,10 @@ final class Void_ implements Type
{
/**
* Returns a rendered output of the Type as it would be used in a DocBlock.
*
* @return string
*/
public function __toString() : string
public function __toString()
{
return 'void';
}
......
......@@ -12,15 +12,35 @@
use Symfony\Polyfill\Ctype as p;
if (!function_exists('ctype_alnum')) {
function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
function ctype_print($text) { return p\Ctype::ctype_print($text); }
function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
function ctype_space($text) { return p\Ctype::ctype_space($text); }
function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
function ctype_alnum($input) { return p\Ctype::ctype_alnum($input); }
}
if (!function_exists('ctype_alpha')) {
function ctype_alpha($input) { return p\Ctype::ctype_alpha($input); }
}
if (!function_exists('ctype_cntrl')) {
function ctype_cntrl($input) { return p\Ctype::ctype_cntrl($input); }
}
if (!function_exists('ctype_digit')) {
function ctype_digit($input) { return p\Ctype::ctype_digit($input); }
}
if (!function_exists('ctype_graph')) {
function ctype_graph($input) { return p\Ctype::ctype_graph($input); }
}
if (!function_exists('ctype_lower')) {
function ctype_lower($input) { return p\Ctype::ctype_lower($input); }
}
if (!function_exists('ctype_print')) {
function ctype_print($input) { return p\Ctype::ctype_print($input); }
}
if (!function_exists('ctype_punct')) {
function ctype_punct($input) { return p\Ctype::ctype_punct($input); }
}
if (!function_exists('ctype_space')) {
function ctype_space($input) { return p\Ctype::ctype_space($input); }
}
if (!function_exists('ctype_upper')) {
function ctype_upper($input) { return p\Ctype::ctype_upper($input); }
}
if (!function_exists('ctype_xdigit')) {
function ctype_xdigit($input) { return p\Ctype::ctype_xdigit($input); }
}
......@@ -28,7 +28,11 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "1.15-dev"
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
}
}
......@@ -3,6 +3,41 @@ Changelog
## UNRELEASED
## 1.9.1
## Fixed
* provisional support for PHP 8.0
## 1.9.0
* added better Psalm support for `all*` & `nullOr*` methods
* These methods are now understood by Psalm through a mixin. You may need a newer version of Psalm in order to use this
* added `@psalm-pure` annotation to `Assert::notFalse()`
* added more `@psalm-assert` annotations where appropriate
## Changed
* the `all*` & `nullOr*` methods are now declared on an interface, instead of `@method` annotations.
This interface is linked to the `Assert` class with a `@mixin` annotation. Most IDE's have supported this
for a long time, and you should not lose any autocompletion capabilities. PHPStan has supported this since
version `0.12.20`. This package is marked incompatible (with a composer conflict) with phpstan version prior to that.
If you do not use PHPStan than this does not matter.
## 1.8.0
### Added
* added `Assert::notStartsWith()`
* added `Assert::notEndsWith()`
* added `Assert::inArray()`
* added `@psalm-pure` annotations to pure assertions
### Fixed
* Exception messages of comparisons between `DateTime(Immutable)` objects now display their date & time.
* Custom Exception messages for `Assert::count()` now use the values to render the exception message.
## 1.7.0 (2020-02-14)
### Added
......@@ -28,7 +63,7 @@ Changelog
They are countable, without implementing the `Countable` interface.
* The doc block of `range` now has the proper variables.
* An empty array will now pass `isList` and `isMap`. As it is a valid form of both.
If a non empty variant is needed, use `isNonEmptyList` or `isNonEmptyMap`.
If a non-empty variant is needed, use `isNonEmptyList` or `isNonEmptyMap`.
### Changed
......@@ -37,8 +72,8 @@ If a non empty variant is needed, use `isNonEmptyList` or `isNonEmptyMap`.
* [#145](https://github.com/webmozart/assert/issues/145)
* [#146](https://github.com/webmozart/assert/pull/146)
* [#150](https://github.com/webmozart/assert/pull/150)
* If you use psalm, the minimum version needed is `3.6.0`. Which is enforced through a composer conflict.
If you don't use psalm, then this has no impact.
* If you use Psalm, the minimum version needed is `3.6.0`. Which is enforced through a composer conflict.
If you don't use Psalm, then this has no impact.
## 1.5.0 (2019-08-24)
......@@ -51,7 +86,7 @@ If you don't use psalm, then this has no impact.
### Fixed
* `Assert::endsWith()` would not give the correct result when dealing with multibyte suffix.
* `Assert::endsWith()` would not give the correct result when dealing with a multibyte suffix.
* `Assert::length(), minLength, maxLength, lengthBetween` would not give the correct result when dealing with multibyte characters.
**NOTE**: These 2 changes may break your assertions if you relied on the fact that multibyte characters didn't behave correctly.
......
......@@ -104,10 +104,10 @@ Method | Description
`isIterable($value, $message = '')` | Check that a value is an array or a `\Traversable`
`isCountable($value, $message = '')` | Check that a value is an array or a `\Countable`
`isInstanceOf($value, $class, $message = '')` | Check that a value is an `instanceof` a class
`isInstanceOfAny($value, array $classes, $message = '')` | Check that a value is an `instanceof` a at least one class on the array of classes
`isInstanceOfAny($value, array $classes, $message = '')` | Check that a value is an `instanceof` at least one class on the array of classes
`notInstanceOf($value, $class, $message = '')` | Check that a value is not an `instanceof` a class
`isAOf($value, $class, $message = '')` | Check that a value is of the class or has one of its parents
`isAnyOf($value, array $classes, $message = '')` | Check that a value a at least one of the class or has one of its parents
`isAnyOf($value, array $classes, $message = '')` | Check that a value is of at least one of the classes or has one of its parents
`isNotA($value, $class, $message = '')` | Check that a value is not of the class or has not one of its parents
`isArrayAccessible($value, $message = '')` | Check that a value can be accessed as an array
`uniqueValues($values, $message = '')` | Check that the given array contains unique values
......@@ -115,7 +115,7 @@ Method | Description
### Comparison Assertions
Method | Description
----------------------------------------------- | --------------------------------------------------
----------------------------------------------- | ------------------------------------------------------------------
`true($value, $message = '')` | Check that a value is `true`
`false($value, $message = '')` | Check that a value is `false`
`notFalse($value, $message = '')` | Check that a value is not `false`
......@@ -132,7 +132,8 @@ Method | Description
`lessThan($value, $value2, $message = '')` | Check that a value is less than another
`lessThanEq($value, $value2, $message = '')` | Check that a value is less than or equal to another
`range($value, $min, $max, $message = '')` | Check that a value is within a range
`oneOf($value, array $values, $message = '')` | Check that a value is one of a list of values
`inArray($value, array $values, $message = '')` | Check that a value is one of a list of values
`oneOf($value, array $values, $message = '')` | Check that a value is one of a list of values (alias of `inArray`)
### String Assertions
......@@ -142,10 +143,12 @@ any of the following assertions.
Method | Description
--------------------------------------------------- | -----------------------------------------------------------------
`contains($value, $subString, $message = '')` | Check that a string contains a substring
`notContains($value, $subString, $message = '')` | Check that a string does not contains a substring
`notContains($value, $subString, $message = '')` | Check that a string does not contain a substring
`startsWith($value, $prefix, $message = '')` | Check that a string has a prefix
`notStartsWith($value, $prefix, $message = '')` | Check that a string does not have a prefix
`startsWithLetter($value, $message = '')` | Check that a string starts with a letter
`endsWith($value, $suffix, $message = '')` | Check that a string has a suffix
`notEndsWith($value, $suffix, $message = '')` | Check that a string does not have a suffix
`regex($value, $pattern, $message = '')` | Check that a string matches a regular expression
`notRegex($value, $pattern, $message = '')` | Check that a string does not match a regular expression
`unicodeLetters($value, $message = '')` | Check that a string contains Unicode letters only
......
......@@ -14,14 +14,15 @@
}
],
"require": {
"php": "^5.3.3 || ^7.0",
"php": "^5.3.3 || ^7.0 || ^8.0",
"symfony/polyfill-ctype": "^1.8"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^7.5.13"
},
"conflict": {
"vimeo/psalm": "<3.6.0"
"vimeo/psalm": "<3.9.1",
"phpstan/phpstan": "<0.12.20"
},
"autoload": {
"psr-4": {
......@@ -30,7 +31,8 @@
},
"autoload-dev": {
"psr-4": {
"Webmozart\\Assert\\Tests\\": "tests/"
"Webmozart\\Assert\\Tests\\": "tests/",
"Webmozart\\Assert\\Bin\\": "bin/src"
}
}
}
......@@ -7,10 +7,8 @@
phpVersion="7.3"
>
<projectFiles>
<directory name="bin" />
<directory name="tests/static-analysis" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
......@@ -15,6 +15,8 @@ use ArrayAccess;
use BadMethodCallException;
use Closure;
use Countable;
use DateTime;
use DateTimeImmutable;
use Exception;
use InvalidArgumentException;
use ResourceBundle;
......@@ -25,182 +27,7 @@ use Traversable;
/**
* Efficient assertions to validate the input/output of your methods.
*
* @method static void nullOrString($value, $message = '')
* @method static void nullOrStringNotEmpty($value, $message = '')
* @method static void nullOrInteger($value, $message = '')
* @method static void nullOrIntegerish($value, $message = '')
* @method static void nullOrFloat($value, $message = '')
* @method static void nullOrNumeric($value, $message = '')
* @method static void nullOrNatural($value, $message = '')
* @method static void nullOrBoolean($value, $message = '')
* @method static void nullOrScalar($value, $message = '')
* @method static void nullOrObject($value, $message = '')
* @method static void nullOrResource($value, $type = null, $message = '')
* @method static void nullOrIsCallable($value, $message = '')
* @method static void nullOrIsArray($value, $message = '')
* @method static void nullOrIsTraversable($value, $message = '')
* @method static void nullOrIsArrayAccessible($value, $message = '')
* @method static void nullOrIsCountable($value, $message = '')
* @method static void nullOrIsIterable($value, $message = '')
* @method static void nullOrIsInstanceOf($value, $class, $message = '')
* @method static void nullOrNotInstanceOf($value, $class, $message = '')
* @method static void nullOrIsInstanceOfAny($value, $classes, $message = '')
* @method static void nullOrIsAOf($value, $classes, $message = '')
* @method static void nullOrIsAnyOf($value, $classes, $message = '')
* @method static void nullOrIsNotA($value, $classes, $message = '')
* @method static void nullOrIsEmpty($value, $message = '')
* @method static void nullOrNotEmpty($value, $message = '')
* @method static void nullOrTrue($value, $message = '')
* @method static void nullOrFalse($value, $message = '')
* @method static void nullOrNotFalse($value, $message = '')
* @method static void nullOrIp($value, $message = '')
* @method static void nullOrIpv4($value, $message = '')
* @method static void nullOrIpv6($value, $message = '')
* @method static void nullOrEmail($value, $message = '')
* @method static void nullOrUniqueValues($values, $message = '')
* @method static void nullOrEq($value, $expect, $message = '')
* @method static void nullOrNotEq($value, $expect, $message = '')
* @method static void nullOrSame($value, $expect, $message = '')
* @method static void nullOrNotSame($value, $expect, $message = '')
* @method static void nullOrGreaterThan($value, $limit, $message = '')
* @method static void nullOrGreaterThanEq($value, $limit, $message = '')
* @method static void nullOrLessThan($value, $limit, $message = '')
* @method static void nullOrLessThanEq($value, $limit, $message = '')
* @method static void nullOrRange($value, $min, $max, $message = '')
* @method static void nullOrOneOf($value, $values, $message = '')
* @method static void nullOrContains($value, $subString, $message = '')
* @method static void nullOrNotContains($value, $subString, $message = '')
* @method static void nullOrNotWhitespaceOnly($value, $message = '')
* @method static void nullOrStartsWith($value, $prefix, $message = '')
* @method static void nullOrStartsWithLetter($value, $message = '')
* @method static void nullOrEndsWith($value, $suffix, $message = '')
* @method static void nullOrRegex($value, $pattern, $message = '')
* @method static void nullOrNotRegex($value, $pattern, $message = '')
* @method static void nullOrUnicodeLetters($value, $message = '')
* @method static void nullOrAlpha($value, $message = '')
* @method static void nullOrDigits($value, $message = '')
* @method static void nullOrAlnum($value, $message = '')
* @method static void nullOrLower($value, $message = '')
* @method static void nullOrUpper($value, $message = '')
* @method static void nullOrLength($value, $length, $message = '')
* @method static void nullOrMinLength($value, $min, $message = '')
* @method static void nullOrMaxLength($value, $max, $message = '')
* @method static void nullOrLengthBetween($value, $min, $max, $message = '')
* @method static void nullOrFileExists($value, $message = '')
* @method static void nullOrFile($value, $message = '')
* @method static void nullOrDirectory($value, $message = '')
* @method static void nullOrReadable($value, $message = '')
* @method static void nullOrWritable($value, $message = '')
* @method static void nullOrClassExists($value, $message = '')
* @method static void nullOrSubclassOf($value, $class, $message = '')
* @method static void nullOrInterfaceExists($value, $message = '')
* @method static void nullOrImplementsInterface($value, $interface, $message = '')
* @method static void nullOrPropertyExists($value, $property, $message = '')
* @method static void nullOrPropertyNotExists($value, $property, $message = '')
* @method static void nullOrMethodExists($value, $method, $message = '')
* @method static void nullOrMethodNotExists($value, $method, $message = '')
* @method static void nullOrKeyExists($value, $key, $message = '')
* @method static void nullOrKeyNotExists($value, $key, $message = '')
* @method static void nullOrValidArrayKey($value, $message = '')
* @method static void nullOrCount($value, $key, $message = '')
* @method static void nullOrMinCount($value, $min, $message = '')
* @method static void nullOrMaxCount($value, $max, $message = '')
* @method static void nullOrIsList($value, $message = '')
* @method static void nullOrIsNonEmptyList($value, $message = '')
* @method static void nullOrIsMap($value, $message = '')
* @method static void nullOrIsNonEmptyMap($value, $message = '')
* @method static void nullOrCountBetween($value, $min, $max, $message = '')
* @method static void nullOrUuid($values, $message = '')
* @method static void nullOrThrows($expression, $class = 'Exception', $message = '')
* @method static void allString($values, $message = '')
* @method static void allStringNotEmpty($values, $message = '')
* @method static void allInteger($values, $message = '')
* @method static void allIntegerish($values, $message = '')
* @method static void allFloat($values, $message = '')
* @method static void allNumeric($values, $message = '')
* @method static void allNatural($values, $message = '')
* @method static void allBoolean($values, $message = '')
* @method static void allScalar($values, $message = '')
* @method static void allObject($values, $message = '')
* @method static void allResource($values, $type = null, $message = '')
* @method static void allIsCallable($values, $message = '')
* @method static void allIsArray($values, $message = '')
* @method static void allIsTraversable($values, $message = '')
* @method static void allIsArrayAccessible($values, $message = '')
* @method static void allIsCountable($values, $message = '')
* @method static void allIsIterable($values, $message = '')
* @method static void allIsInstanceOf($values, $class, $message = '')
* @method static void allNotInstanceOf($values, $class, $message = '')
* @method static void allIsInstanceOfAny($values, $classes, $message = '')
* @method static void allIsAOf($values, $class, $message = '')
* @method static void allIsAnyOf($values, $class, $message = '')
* @method static void allIsNotA($values, $class, $message = '')
* @method static void allNull($values, $message = '')
* @method static void allNotNull($values, $message = '')
* @method static void allIsEmpty($values, $message = '')
* @method static void allNotEmpty($values, $message = '')
* @method static void allTrue($values, $message = '')
* @method static void allFalse($values, $message = '')
* @method static void allNotFalse($values, $message = '')
* @method static void allIp($values, $message = '')
* @method static void allIpv4($values, $message = '')
* @method static void allIpv6($values, $message = '')
* @method static void allEmail($values, $message = '')
* @method static void allUniqueValues($values, $message = '')
* @method static void allEq($values, $expect, $message = '')
* @method static void allNotEq($values, $expect, $message = '')
* @method static void allSame($values, $expect, $message = '')
* @method static void allNotSame($values, $expect, $message = '')
* @method static void allGreaterThan($values, $limit, $message = '')
* @method static void allGreaterThanEq($values, $limit, $message = '')
* @method static void allLessThan($values, $limit, $message = '')
* @method static void allLessThanEq($values, $limit, $message = '')
* @method static void allRange($values, $min, $max, $message = '')
* @method static void allOneOf($values, $values, $message = '')
* @method static void allContains($values, $subString, $message = '')
* @method static void allNotContains($values, $subString, $message = '')
* @method static void allNotWhitespaceOnly($values, $message = '')
* @method static void allStartsWith($values, $prefix, $message = '')
* @method static void allStartsWithLetter($values, $message = '')
* @method static void allEndsWith($values, $suffix, $message = '')
* @method static void allRegex($values, $pattern, $message = '')
* @method static void allNotRegex($values, $pattern, $message = '')
* @method static void allUnicodeLetters($values, $message = '')
* @method static void allAlpha($values, $message = '')
* @method static void allDigits($values, $message = '')
* @method static void allAlnum($values, $message = '')
* @method static void allLower($values, $message = '')
* @method static void allUpper($values, $message = '')
* @method static void allLength($values, $length, $message = '')
* @method static void allMinLength($values, $min, $message = '')
* @method static void allMaxLength($values, $max, $message = '')
* @method static void allLengthBetween($values, $min, $max, $message = '')
* @method static void allFileExists($values, $message = '')
* @method static void allFile($values, $message = '')
* @method static void allDirectory($values, $message = '')
* @method static void allReadable($values, $message = '')
* @method static void allWritable($values, $message = '')
* @method static void allClassExists($values, $message = '')
* @method static void allSubclassOf($values, $class, $message = '')
* @method static void allInterfaceExists($values, $message = '')
* @method static void allImplementsInterface($values, $interface, $message = '')
* @method static void allPropertyExists($values, $property, $message = '')
* @method static void allPropertyNotExists($values, $property, $message = '')
* @method static void allMethodExists($values, $method, $message = '')
* @method static void allMethodNotExists($values, $method, $message = '')
* @method static void allKeyExists($values, $key, $message = '')
* @method static void allKeyNotExists($values, $key, $message = '')
* @method static void allValidArrayKey($values, $message = '')
* @method static void allCount($values, $key, $message = '')
* @method static void allMinCount($values, $min, $message = '')
* @method static void allMaxCount($values, $max, $message = '')
* @method static void allCountBetween($values, $min, $max, $message = '')
* @method static void allIsList($values, $message = '')
* @method static void allIsNonEmptyList($values, $message = '')
* @method static void allIsMap($values, $message = '')
* @method static void allIsNonEmptyMap($values, $message = '')
* @method static void allUuid($values, $message = '')
* @method static void allThrows($expressions, $class = 'Exception', $message = '')
* @mixin Mixin
*
* @since 1.0
*
......@@ -209,6 +36,7 @@ use Traversable;
class Assert
{
/**
* @psalm-pure
* @psalm-assert string $value
*
* @param mixed $value
......@@ -227,6 +55,9 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert non-empty-string $value
*
* @param mixed $value
* @param string $message
*
......@@ -239,6 +70,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert int $value
*
* @param mixed $value
......@@ -257,6 +89,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert numeric $value
*
* @param mixed $value
......@@ -275,6 +108,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert float $value
*
* @param mixed $value
......@@ -293,6 +127,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert numeric $value
*
* @param mixed $value
......@@ -311,6 +146,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert int $value
*
* @param mixed $value
......@@ -322,13 +158,14 @@ class Assert
{
if (!\is_int($value) || $value < 0) {
static::reportInvalidArgument(\sprintf(
$message ?: 'Expected a non-negative integer. Got %s',
$message ?: 'Expected a non-negative integer. Got: %s',
static::valueToString($value)
));
}
}
/**
* @psalm-pure
* @psalm-assert bool $value
*
* @param mixed $value
......@@ -347,6 +184,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert scalar $value
*
* @param mixed $value
......@@ -365,6 +203,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert object $value
*
* @param mixed $value
......@@ -383,6 +222,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert resource $value
*
* @param mixed $value
......@@ -410,6 +250,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert callable $value
*
* @param mixed $value
......@@ -428,6 +269,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert array $value
*
* @param mixed $value
......@@ -446,6 +288,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert iterable $value
*
* @deprecated use "isIterable" or "isInstanceOf" instead
......@@ -474,6 +317,9 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert array|ArrayAccess $value
*
* @param mixed $value
* @param string $message
*
......@@ -490,6 +336,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert countable $value
*
* @param mixed $value
......@@ -513,6 +360,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert iterable $value
*
* @param mixed $value
......@@ -531,6 +379,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $class
* @psalm-assert ExpectedType $value
......@@ -553,6 +402,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $class
* @psalm-assert !ExpectedType $value
......@@ -575,6 +425,9 @@ class Assert
}
/**
* @psalm-pure
* @psalm-param array<class-string> $classes
*
* @param mixed $value
* @param array<object|string> $classes
* @param string $message
......@@ -597,6 +450,11 @@ class Assert
}
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $class
* @psalm-assert ExpectedType|class-string<ExpectedType> $value
*
* @param object|string $value
* @param string $class
* @param string $message
......@@ -617,6 +475,12 @@ class Assert
}
/**
* @psalm-pure
* @psalm-template UnexpectedType of object
* @psalm-param class-string<UnexpectedType> $class
* @psalm-assert !UnexpectedType $value
* @psalm-assert !class-string<UnexpectedType> $value
*
* @param object|string $value
* @param string $class
* @param string $message
......@@ -637,6 +501,9 @@ class Assert
}
/**
* @psalm-pure
* @psalm-param array<class-string> $classes
*
* @param object|string $value
* @param string[] $classes
* @param string $message
......@@ -661,6 +528,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert empty $value
*
* @param mixed $value
......@@ -679,6 +547,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert !empty $value
*
* @param mixed $value
......@@ -697,6 +566,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert null $value
*
* @param mixed $value
......@@ -715,6 +585,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert !null $value
*
* @param mixed $value
......@@ -732,6 +603,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert true $value
*
* @param mixed $value
......@@ -750,6 +622,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert false $value
*
* @param mixed $value
......@@ -768,6 +641,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert !false $value
*
* @param mixed $value
......@@ -826,7 +700,7 @@ class Assert
{
if (false === \filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
static::reportInvalidArgument(\sprintf(
$message ?: 'Expected a value to be an IPv6. Got %s',
$message ?: 'Expected a value to be an IPv6. Got: %s',
static::valueToString($value)
));
}
......@@ -842,7 +716,7 @@ class Assert
{
if (false === \filter_var($value, FILTER_VALIDATE_EMAIL)) {
static::reportInvalidArgument(\sprintf(
$message ?: 'Expected a value to be a valid e-mail address. Got %s',
$message ?: 'Expected a value to be a valid e-mail address. Got: %s',
static::valueToString($value)
));
}
......@@ -908,6 +782,8 @@ class Assert
}
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $expect
* @param string $message
......@@ -926,6 +802,8 @@ class Assert
}
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $expect
* @param string $message
......@@ -943,6 +821,8 @@ class Assert
}
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $limit
* @param string $message
......@@ -961,6 +841,8 @@ class Assert
}
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $limit
* @param string $message
......@@ -979,6 +861,8 @@ class Assert
}
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $limit
* @param string $message
......@@ -997,6 +881,8 @@ class Assert
}
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $limit
* @param string $message
......@@ -1017,6 +903,8 @@ class Assert
/**
* Inclusive range, so Assert::(3, 3, 5) passes.
*
* @psalm-pure
*
* @param mixed $value
* @param mixed $min
* @param mixed $max
......@@ -1037,7 +925,9 @@ class Assert
}
/**
* Does strict comparison, so Assert::oneOf(3, ['3']) does not pass the assertion.
* A more human-readable alias of Assert::inArray().
*
* @psalm-pure
*
* @param mixed $value
* @param array $values
......@@ -1047,6 +937,22 @@ class Assert
*/
public static function oneOf($value, array $values, $message = '')
{
static::inArray($value, $values, $message);
}
/**
* Does strict comparison, so Assert::inArray(3, ['3']) does not pass the assertion.
*
* @psalm-pure
*
* @param mixed $value
* @param array $values
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function inArray($value, array $values, $message = '')
{
if (!\in_array($value, $values, true)) {
static::reportInvalidArgument(\sprintf(
$message ?: 'Expected one of: %2$s. Got: %s',
......@@ -1057,7 +963,9 @@ class Assert
}
/**
* @param mixed $value
* @psalm-pure
*
* @param string $value
* @param string $subString
* @param string $message
*
......@@ -1075,7 +983,9 @@ class Assert
}
/**
* @param mixed $value
* @psalm-pure
*
* @param string $value
* @param string $subString
* @param string $message
*
......@@ -1093,7 +1003,9 @@ class Assert
}
/**
* @param mixed $value
* @psalm-pure
*
* @param string $value
* @param string $message
*
* @throws InvalidArgumentException
......@@ -1109,7 +1021,9 @@ class Assert
}
/**
* @param mixed $value
* @psalm-pure
*
* @param string $value
* @param string $prefix
* @param string $message
*
......@@ -1127,6 +1041,28 @@ class Assert
}
/**
* @psalm-pure
*
* @param string $value
* @param string $prefix
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function notStartsWith($value, $prefix, $message = '')
{
if (0 === \strpos($value, $prefix)) {
static::reportInvalidArgument(\sprintf(
$message ?: 'Expected a value not to start with %2$s. Got: %s',
static::valueToString($value),
static::valueToString($prefix)
));
}
}
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
......@@ -1154,7 +1090,9 @@ class Assert
}
/**
* @param mixed $value
* @psalm-pure
*
* @param string $value
* @param string $suffix
* @param string $message
*
......@@ -1172,8 +1110,30 @@ class Assert
}
/**
* @param mixed $value
* @param mixed $pattern
* @psalm-pure
*
* @param string $value
* @param string $suffix
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function notEndsWith($value, $suffix, $message = '')
{
if ($suffix === \substr($value, -\strlen($suffix))) {
static::reportInvalidArgument(\sprintf(
$message ?: 'Expected a value not to end with %2$s. Got: %s',
static::valueToString($value),
static::valueToString($suffix)
));
}
}
/**
* @psalm-pure
*
* @param string $value
* @param string $pattern
* @param string $message
*
* @throws InvalidArgumentException
......@@ -1189,8 +1149,10 @@ class Assert
}
/**
* @param mixed $value
* @param mixed $pattern
* @psalm-pure
*
* @param string $value
* @param string $pattern
* @param string $message
*
* @throws InvalidArgumentException
......@@ -1208,6 +1170,8 @@ class Assert
}
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
......@@ -1226,6 +1190,8 @@ class Assert
}
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
......@@ -1249,7 +1215,9 @@ class Assert
}
/**
* @param mixed $value
* @psalm-pure
*
* @param string $value
* @param string $message
*
* @throws InvalidArgumentException
......@@ -1270,7 +1238,9 @@ class Assert
}
/**
* @param mixed $value
* @psalm-pure
*
* @param string $value
* @param string $message
*
* @throws InvalidArgumentException
......@@ -1291,7 +1261,10 @@ class Assert
}
/**
* @param mixed $value
* @psalm-pure
* @psalm-assert lowercase-string $value
*
* @param string $value
* @param string $message
*
* @throws InvalidArgumentException
......@@ -1312,7 +1285,10 @@ class Assert
}
/**
* @param mixed $value
* @psalm-pure
* @psalm-assert !lowercase-string $value
*
* @param string $value
* @param string $message
*
* @throws InvalidArgumentException
......@@ -1333,8 +1309,10 @@ class Assert
}
/**
* @param mixed $value
* @param mixed $length
* @psalm-pure
*
* @param string $value
* @param int $length
* @param string $message
*
* @throws InvalidArgumentException
......@@ -1353,9 +1331,11 @@ class Assert
/**
* Inclusive min.
*
* @param mixed $value
* @param mixed $min
* @param string $message
* @psalm-pure
*
* @param string $value
* @param int|float $min
* @param string $message
*
* @throws InvalidArgumentException
*/
......@@ -1373,9 +1353,11 @@ class Assert
/**
* Inclusive max.
*
* @param mixed $value
* @param mixed $max
* @param string $message
* @psalm-pure
*
* @param string $value
* @param int|float $max
* @param string $message
*
* @throws InvalidArgumentException
*/
......@@ -1393,10 +1375,12 @@ class Assert
/**
* Inclusive , so Assert::lengthBetween('asd', 3, 5); passes the assertion.
*
* @param mixed $value
* @param mixed $min
* @param mixed $max
* @param string $message
* @psalm-pure
*
* @param string $value
* @param int|float $min
* @param int|float $max
* @param string $message
*
* @throws InvalidArgumentException
*/
......@@ -1471,7 +1455,7 @@ class Assert
}
/**
* @param mixed $value
* @param string $value
* @param string $message
*
* @throws InvalidArgumentException
......@@ -1487,7 +1471,7 @@ class Assert
}
/**
* @param mixed $value
* @param string $value
* @param string $message
*
* @throws InvalidArgumentException
......@@ -1521,6 +1505,11 @@ class Assert
}
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $class
* @psalm-assert class-string<ExpectedType>|ExpectedType $value
*
* @param mixed $value
* @param string|object $class
* @param string $message
......@@ -1557,6 +1546,11 @@ class Assert
}
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $interface
* @psalm-assert class-string<ExpectedType> $value
*
* @param mixed $value
* @param mixed $interface
* @param string $message
......@@ -1575,6 +1569,9 @@ class Assert
}
/**
* @psalm-pure
* @psalm-param class-string|object $classOrObject
*
* @param string|object $classOrObject
* @param mixed $property
* @param string $message
......@@ -1592,6 +1589,9 @@ class Assert
}
/**
* @psalm-pure
* @psalm-param class-string|object $classOrObject
*
* @param string|object $classOrObject
* @param mixed $property
* @param string $message
......@@ -1609,6 +1609,9 @@ class Assert
}
/**
* @psalm-pure
* @psalm-param class-string|object $classOrObject
*
* @param string|object $classOrObject
* @param mixed $method
* @param string $message
......@@ -1617,7 +1620,7 @@ class Assert
*/
public static function methodExists($classOrObject, $method, $message = '')
{
if (!\method_exists($classOrObject, $method)) {
if (!(\is_string($classOrObject) || \is_object($classOrObject)) || !\method_exists($classOrObject, $method)) {
static::reportInvalidArgument(\sprintf(
$message ?: 'Expected the method %s to exist.',
static::valueToString($method)
......@@ -1626,6 +1629,9 @@ class Assert
}
/**
* @psalm-pure
* @psalm-param class-string|object $classOrObject
*
* @param string|object $classOrObject
* @param mixed $method
* @param string $message
......@@ -1634,7 +1640,7 @@ class Assert
*/
public static function methodNotExists($classOrObject, $method, $message = '')
{
if (\method_exists($classOrObject, $method)) {
if ((\is_string($classOrObject) || \is_object($classOrObject)) && \method_exists($classOrObject, $method)) {
static::reportInvalidArgument(\sprintf(
$message ?: 'Expected the method %s to not exist.',
static::valueToString($method)
......@@ -1643,6 +1649,8 @@ class Assert
}
/**
* @psalm-pure
*
* @param array $array
* @param string|int $key
* @param string $message
......@@ -1660,6 +1668,8 @@ class Assert
}
/**
* @psalm-pure
*
* @param array $array
* @param string|int $key
* @param string $message
......@@ -1679,6 +1689,7 @@ class Assert
/**
* Checks if a value is a valid array key (int or string).
*
* @psalm-pure
* @psalm-assert array-key $value
*
* @param mixed $value
......@@ -1699,9 +1710,9 @@ class Assert
/**
* Does not check if $array is countable, this can generate a warning on php versions after 7.2.
*
* @param mixed $array
* @param mixed $number
* @param string $message
* @param Countable|array $array
* @param int $number
* @param string $message
*
* @throws InvalidArgumentException
*/
......@@ -1710,16 +1721,20 @@ class Assert
static::eq(
\count($array),
$number,
$message ?: \sprintf('Expected an array to contain %d elements. Got: %d.', $number, \count($array))
\sprintf(
$message ?: 'Expected an array to contain %d elements. Got: %d.',
$number,
\count($array)
)
);
}
/**
* Does not check if $array is countable, this can generate a warning on php versions after 7.2.
*
* @param mixed $array
* @param mixed $min
* @param string $message
* @param Countable|array $array
* @param int|float $min
* @param string $message
*
* @throws InvalidArgumentException
*/
......@@ -1737,9 +1752,9 @@ class Assert
/**
* Does not check if $array is countable, this can generate a warning on php versions after 7.2.
*
* @param mixed $array
* @param mixed $max
* @param string $message
* @param Countable|array $array
* @param int|float $max
* @param string $message
*
* @throws InvalidArgumentException
*/
......@@ -1757,10 +1772,10 @@ class Assert
/**
* Does not check if $array is countable, this can generate a warning on php versions after 7.2.
*
* @param mixed $array
* @param mixed $min
* @param mixed $max
* @param string $message
* @param Countable|array $array
* @param int|float $min
* @param int|float $max
* @param string $message
*
* @throws InvalidArgumentException
*/
......@@ -1779,6 +1794,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert list $array
*
* @param mixed $array
......@@ -1796,6 +1812,7 @@ class Assert
}
/**
* @psalm-pure
* @psalm-assert non-empty-list $array
*
* @param mixed $array
......@@ -1810,6 +1827,11 @@ class Assert
}
/**
* @psalm-pure
* @psalm-template T
* @psalm-param mixed|array<T> $array
* @psalm-assert array<string, T> $array
*
* @param mixed $array
* @param string $message
*
......@@ -1828,6 +1850,12 @@ class Assert
}
/**
* @psalm-pure
* @psalm-template T
* @psalm-param mixed|array<T> $array
* @psalm-assert array<string, T> $array
* @psalm-assert !empty $array
*
* @param mixed $array
* @param string $message
*
......@@ -1840,7 +1868,9 @@ class Assert
}
/**
* @param mixed $value
* @psalm-pure
*
* @param string $value
* @param string $message
*
* @throws InvalidArgumentException
......@@ -1864,9 +1894,11 @@ class Assert
}
/**
* @param Closure $expression
* @param string|object $class
* @param string $message
* @psalm-param class-string<Throwable> $class
*
* @param Closure $expression
* @param string $class
* @param string $message
*
* @throws InvalidArgumentException
*/
......@@ -1957,6 +1989,10 @@ class Assert
return \get_class($value).': '.self::valueToString($value->__toString());
}
if ($value instanceof DateTime || $value instanceof DateTimeImmutable) {
return \get_class($value).': '.self::valueToString($value->format('c'));
}
return \get_class($value);
}
......@@ -1998,6 +2034,8 @@ class Assert
* @param string $message
*
* @throws InvalidArgumentException
*
* @psalm-pure this method is not supposed to perform side-effects
*/
protected static function reportInvalidArgument($message)
{
......
<?php
/**
* provides type inference and auto-completion for magic static methods of Assert.
*/
namespace Webmozart\Assert;
use ArrayAccess;
use Closure;
use Countable;
use InvalidArgumentException;
use Throwable;
interface Mixin
{
/**
* @psalm-pure
* @psalm-assert null|string $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrString($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<string> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allString($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|non-empty-string $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrStringNotEmpty($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<non-empty-string> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allStringNotEmpty($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|int $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrInteger($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<int> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allInteger($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|numeric $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIntegerish($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<numeric> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIntegerish($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|float $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrFloat($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<float> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allFloat($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|numeric $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrNumeric($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<numeric> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNumeric($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|int $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrNatural($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<int> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNatural($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|bool $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrBoolean($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<bool> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allBoolean($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|scalar $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrScalar($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<scalar> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allScalar($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|object $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrObject($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<object> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allObject($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|resource $value
*
* @param mixed $value
* @param string|null $type type of resource this should be. @see https://www.php.net/manual/en/function.get-resource-type.php
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrResource($value, $type = null, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<resource> $value
*
* @param mixed $value
* @param string|null $type type of resource this should be. @see https://www.php.net/manual/en/function.get-resource-type.php
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allResource($value, $type = null, $message = '');
/**
* @psalm-pure
* @psalm-assert null|callable $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsCallable($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<callable> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsCallable($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|array $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsArray($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<array> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsArray($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|iterable $value
*
* @deprecated use "isIterable" or "isInstanceOf" instead
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsTraversable($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<iterable> $value
*
* @deprecated use "isIterable" or "isInstanceOf" instead
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsTraversable($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|array|ArrayAccess $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsArrayAccessible($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<array|ArrayAccess> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsArrayAccessible($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|countable $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsCountable($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<countable> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsCountable($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|iterable $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsIterable($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<iterable> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsIterable($value, $message = '');
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $class
* @psalm-assert null|ExpectedType $value
*
* @param mixed $value
* @param string|object $class
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsInstanceOf($value, $class, $message = '');
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $class
* @psalm-assert iterable<ExpectedType> $value
*
* @param mixed $value
* @param string|object $class
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsInstanceOf($value, $class, $message = '');
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $class
*
* @param mixed $value
* @param string|object $class
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrNotInstanceOf($value, $class, $message = '');
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $class
*
* @param mixed $value
* @param string|object $class
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNotInstanceOf($value, $class, $message = '');
/**
* @psalm-pure
* @psalm-param array<class-string> $classes
*
* @param mixed $value
* @param array<object|string> $classes
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsInstanceOfAny($value, $classes, $message = '');
/**
* @psalm-pure
* @psalm-param array<class-string> $classes
*
* @param mixed $value
* @param array<object|string> $classes
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsInstanceOfAny($value, $classes, $message = '');
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $class
* @psalm-assert null|ExpectedType|class-string<ExpectedType> $value
*
* @param null|object|string $value
* @param string $class
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsAOf($value, $class, $message = '');
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $class
* @psalm-assert iterable<ExpectedType|class-string<ExpectedType>> $value
*
* @param iterable<object|string> $value
* @param string $class
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsAOf($value, $class, $message = '');
/**
* @psalm-pure
* @psalm-template UnexpectedType of object
* @psalm-param class-string<UnexpectedType> $class
*
* @param null|object|string $value
* @param string $class
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsNotA($value, $class, $message = '');
/**
* @psalm-pure
* @psalm-template UnexpectedType of object
* @psalm-param class-string<UnexpectedType> $class
*
* @param iterable<object|string> $value
* @param string $class
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsNotA($value, $class, $message = '');
/**
* @psalm-pure
* @psalm-param array<class-string> $classes
*
* @param null|object|string $value
* @param string[] $classes
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsAnyOf($value, $classes, $message = '');
/**
* @psalm-pure
* @psalm-param array<class-string> $classes
*
* @param iterable<object|string> $value
* @param string[] $classes
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsAnyOf($value, $classes, $message = '');
/**
* @psalm-pure
* @psalm-assert empty $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsEmpty($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<empty> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsEmpty($value, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrNotEmpty($value, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNotEmpty($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<null> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNull($value, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNotNull($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|true $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrTrue($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<true> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allTrue($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|false $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrFalse($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<false> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allFalse($value, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrNotFalse($value, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNotFalse($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIp($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIp($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIpv4($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIpv4($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIpv6($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIpv6($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrEmail($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allEmail($value, $message = '');
/**
* @param null|array $values
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrUniqueValues($values, $message = '');
/**
* @param iterable<array> $values
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allUniqueValues($values, $message = '');
/**
* @param mixed $value
* @param mixed $expect
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrEq($value, $expect, $message = '');
/**
* @param mixed $value
* @param mixed $expect
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allEq($value, $expect, $message = '');
/**
* @param mixed $value
* @param mixed $expect
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrNotEq($value, $expect, $message = '');
/**
* @param mixed $value
* @param mixed $expect
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNotEq($value, $expect, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $expect
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrSame($value, $expect, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $expect
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allSame($value, $expect, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $expect
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrNotSame($value, $expect, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $expect
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNotSame($value, $expect, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $limit
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrGreaterThan($value, $limit, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $limit
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allGreaterThan($value, $limit, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $limit
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrGreaterThanEq($value, $limit, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $limit
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allGreaterThanEq($value, $limit, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $limit
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrLessThan($value, $limit, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $limit
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allLessThan($value, $limit, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $limit
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrLessThanEq($value, $limit, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $limit
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allLessThanEq($value, $limit, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $min
* @param mixed $max
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrRange($value, $min, $max, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param mixed $min
* @param mixed $max
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allRange($value, $min, $max, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param array $values
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrOneOf($value, $values, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param array $values
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allOneOf($value, $values, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param array $values
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrInArray($value, $values, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param array $values
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allInArray($value, $values, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $subString
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrContains($value, $subString, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $subString
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allContains($value, $subString, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $subString
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrNotContains($value, $subString, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $subString
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNotContains($value, $subString, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrNotWhitespaceOnly($value, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNotWhitespaceOnly($value, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $prefix
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrStartsWith($value, $prefix, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $prefix
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allStartsWith($value, $prefix, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $prefix
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrNotStartsWith($value, $prefix, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $prefix
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNotStartsWith($value, $prefix, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrStartsWithLetter($value, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allStartsWithLetter($value, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $suffix
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrEndsWith($value, $suffix, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $suffix
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allEndsWith($value, $suffix, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $suffix
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrNotEndsWith($value, $suffix, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $suffix
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNotEndsWith($value, $suffix, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $pattern
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrRegex($value, $pattern, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $pattern
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allRegex($value, $pattern, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $pattern
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrNotRegex($value, $pattern, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $pattern
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allNotRegex($value, $pattern, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrUnicodeLetters($value, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allUnicodeLetters($value, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrAlpha($value, $message = '');
/**
* @psalm-pure
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allAlpha($value, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrDigits($value, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allDigits($value, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrAlnum($value, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allAlnum($value, $message = '');
/**
* @psalm-pure
* @psalm-assert null|lowercase-string $value
*
* @param null|string $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrLower($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<lowercase-string> $value
*
* @param iterable<string> $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allLower($value, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrUpper($value, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allUpper($value, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param int $length
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrLength($value, $length, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param int $length
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allLength($value, $length, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param int|float $min
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrMinLength($value, $min, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param int|float $min
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allMinLength($value, $min, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param int|float $max
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrMaxLength($value, $max, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param int|float $max
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allMaxLength($value, $max, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param int|float $min
* @param int|float $max
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrLengthBetween($value, $min, $max, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param int|float $min
* @param int|float $max
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allLengthBetween($value, $min, $max, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrFileExists($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allFileExists($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrFile($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allFile($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrDirectory($value, $message = '');
/**
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allDirectory($value, $message = '');
/**
* @param null|string $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrReadable($value, $message = '');
/**
* @param iterable<string> $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allReadable($value, $message = '');
/**
* @param null|string $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrWritable($value, $message = '');
/**
* @param iterable<string> $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allWritable($value, $message = '');
/**
* @psalm-assert null|class-string $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrClassExists($value, $message = '');
/**
* @psalm-assert iterable<class-string> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allClassExists($value, $message = '');
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $class
* @psalm-assert null|class-string<ExpectedType>|ExpectedType $value
*
* @param mixed $value
* @param string|object $class
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrSubclassOf($value, $class, $message = '');
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $class
* @psalm-assert iterable<class-string<ExpectedType>|ExpectedType> $value
*
* @param mixed $value
* @param string|object $class
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allSubclassOf($value, $class, $message = '');
/**
* @psalm-assert null|class-string $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrInterfaceExists($value, $message = '');
/**
* @psalm-assert iterable<class-string> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allInterfaceExists($value, $message = '');
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $interface
* @psalm-assert null|class-string<ExpectedType> $value
*
* @param mixed $value
* @param mixed $interface
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrImplementsInterface($value, $interface, $message = '');
/**
* @psalm-pure
* @psalm-template ExpectedType of object
* @psalm-param class-string<ExpectedType> $interface
* @psalm-assert iterable<class-string<ExpectedType>> $value
*
* @param mixed $value
* @param mixed $interface
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allImplementsInterface($value, $interface, $message = '');
/**
* @psalm-pure
* @psalm-param null|class-string|object $classOrObject
*
* @param null|string|object $classOrObject
* @param mixed $property
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrPropertyExists($classOrObject, $property, $message = '');
/**
* @psalm-pure
* @psalm-param iterable<class-string|object> $classOrObject
*
* @param iterable<string|object> $classOrObject
* @param mixed $property
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allPropertyExists($classOrObject, $property, $message = '');
/**
* @psalm-pure
* @psalm-param null|class-string|object $classOrObject
*
* @param null|string|object $classOrObject
* @param mixed $property
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrPropertyNotExists($classOrObject, $property, $message = '');
/**
* @psalm-pure
* @psalm-param iterable<class-string|object> $classOrObject
*
* @param iterable<string|object> $classOrObject
* @param mixed $property
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allPropertyNotExists($classOrObject, $property, $message = '');
/**
* @psalm-pure
* @psalm-param null|class-string|object $classOrObject
*
* @param null|string|object $classOrObject
* @param mixed $method
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrMethodExists($classOrObject, $method, $message = '');
/**
* @psalm-pure
* @psalm-param iterable<class-string|object> $classOrObject
*
* @param iterable<string|object> $classOrObject
* @param mixed $method
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allMethodExists($classOrObject, $method, $message = '');
/**
* @psalm-pure
* @psalm-param null|class-string|object $classOrObject
*
* @param null|string|object $classOrObject
* @param mixed $method
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrMethodNotExists($classOrObject, $method, $message = '');
/**
* @psalm-pure
* @psalm-param iterable<class-string|object> $classOrObject
*
* @param iterable<string|object> $classOrObject
* @param mixed $method
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allMethodNotExists($classOrObject, $method, $message = '');
/**
* @psalm-pure
*
* @param null|array $array
* @param string|int $key
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrKeyExists($array, $key, $message = '');
/**
* @psalm-pure
*
* @param iterable<array> $array
* @param string|int $key
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allKeyExists($array, $key, $message = '');
/**
* @psalm-pure
*
* @param null|array $array
* @param string|int $key
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrKeyNotExists($array, $key, $message = '');
/**
* @psalm-pure
*
* @param iterable<array> $array
* @param string|int $key
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allKeyNotExists($array, $key, $message = '');
/**
* @psalm-pure
* @psalm-assert null|array-key $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrValidArrayKey($value, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<array-key> $value
*
* @param mixed $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allValidArrayKey($value, $message = '');
/**
* @param null|Countable|array $array
* @param int $number
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrCount($array, $number, $message = '');
/**
* @param iterable<Countable|array> $array
* @param int $number
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allCount($array, $number, $message = '');
/**
* @param null|Countable|array $array
* @param int|float $min
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrMinCount($array, $min, $message = '');
/**
* @param iterable<Countable|array> $array
* @param int|float $min
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allMinCount($array, $min, $message = '');
/**
* @param null|Countable|array $array
* @param int|float $max
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrMaxCount($array, $max, $message = '');
/**
* @param iterable<Countable|array> $array
* @param int|float $max
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allMaxCount($array, $max, $message = '');
/**
* @param null|Countable|array $array
* @param int|float $min
* @param int|float $max
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrCountBetween($array, $min, $max, $message = '');
/**
* @param iterable<Countable|array> $array
* @param int|float $min
* @param int|float $max
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allCountBetween($array, $min, $max, $message = '');
/**
* @psalm-pure
* @psalm-assert null|list $array
*
* @param mixed $array
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsList($array, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<list> $array
*
* @param mixed $array
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsList($array, $message = '');
/**
* @psalm-pure
* @psalm-assert null|non-empty-list $array
*
* @param mixed $array
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsNonEmptyList($array, $message = '');
/**
* @psalm-pure
* @psalm-assert iterable<non-empty-list> $array
*
* @param mixed $array
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsNonEmptyList($array, $message = '');
/**
* @psalm-pure
* @psalm-template T
* @psalm-param null|mixed|array<T> $array
* @psalm-assert null|array<string, T> $array
*
* @param mixed $array
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsMap($array, $message = '');
/**
* @psalm-pure
* @psalm-template T
* @psalm-param iterable<mixed|array<T>> $array
* @psalm-assert iterable<array<string, T>> $array
*
* @param mixed $array
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsMap($array, $message = '');
/**
* @psalm-pure
* @psalm-template T
* @psalm-param null|mixed|array<T> $array
*
* @param mixed $array
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrIsNonEmptyMap($array, $message = '');
/**
* @psalm-pure
* @psalm-template T
* @psalm-param iterable<mixed|array<T>> $array
*
* @param mixed $array
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allIsNonEmptyMap($array, $message = '');
/**
* @psalm-pure
*
* @param null|string $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrUuid($value, $message = '');
/**
* @psalm-pure
*
* @param iterable<string> $value
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allUuid($value, $message = '');
/**
* @psalm-param class-string<Throwable> $class
*
* @param null|Closure $expression
* @param string $class
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function nullOrThrows($expression, $class = 'Exception', $message = '');
/**
* @psalm-param class-string<Throwable> $class
*
* @param iterable<Closure> $expression
* @param string $class
* @param string $message
*
* @throws InvalidArgumentException
*/
public static function allThrows($expression, $class = 'Exception', $message = '');
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment