Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0250b86b3f | ||
|
|
e45acc412b | ||
|
|
854206bc70 | ||
|
|
b192e98a8a | ||
|
|
c4e2c781c6 | ||
|
|
e80b3b8dfd | ||
|
|
2b079ff836 | ||
|
|
37201799b5 | ||
|
|
b9d8911c7b | ||
|
|
c51ceb926e | ||
|
|
b4b33d6873 | ||
|
|
959240b0fa | ||
|
|
7eace1013e | ||
|
|
be1e55cad7 | ||
|
|
11a8c6440b | ||
|
|
742cbc31df | ||
|
|
28909fdc03 | ||
|
|
c3b29ad0d7 | ||
|
|
6d481657df | ||
|
|
fc57aabf5d | ||
|
|
d56ee68482 | ||
|
|
b89ab09e12 | ||
|
|
e873ade6c0 | ||
|
|
5910b884ac | ||
|
|
e3bd2c1c3b | ||
|
|
90a8c5540f |
@@ -96,8 +96,6 @@ return [
|
||||
"exclude_analysis_directory_list" => [
|
||||
'www/vendor',
|
||||
'www/tests',
|
||||
'www/lib/Smarty',
|
||||
'www/lib/smarty-4.3.0',
|
||||
'www/templates_c',
|
||||
'www/log',
|
||||
'www/tmp',
|
||||
@@ -118,10 +116,6 @@ return [
|
||||
// ignore the old qq tests
|
||||
'www/admin/qq_file_upload_front.php',
|
||||
'www/admin/qq_file_upload_ajax.php',
|
||||
// symlink ignore
|
||||
'www/lib/smarty-4.3.0/libs/Smarty.class.php',
|
||||
// legacy edit base (until removal)
|
||||
'www/includes/edit_base.LEGACY.php'
|
||||
],
|
||||
|
||||
// what not to show as problem
|
||||
|
||||
@@ -7,6 +7,14 @@ namespace tests;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
|
||||
/*
|
||||
Not yet covered tests:
|
||||
- loginGetLocale
|
||||
- loginGetHeaderColor
|
||||
- loginGetPages
|
||||
- loginGetEuid
|
||||
*/
|
||||
|
||||
/**
|
||||
* Test class for ACL\Login
|
||||
* @coversDefaultClass \CoreLibs\ACL\Login
|
||||
@@ -259,6 +267,8 @@ final class CoreLibsACLLoginTest extends TestCase
|
||||
'GROUP_ACL_LEVEL' => -1,
|
||||
'PAGES_ACL_LEVEL' => [],
|
||||
'USER_ACL_LEVEL' => -1,
|
||||
'USER_ADDITIONAL_ACL' => [],
|
||||
'GROUP_ADDITIONAL_ACL' => [],
|
||||
'UNIT_UID' => [
|
||||
'AdminAccess' => 1,
|
||||
],
|
||||
@@ -272,6 +282,7 @@ final class CoreLibsACLLoginTest extends TestCase
|
||||
'data' => [
|
||||
'test' => 'value',
|
||||
],
|
||||
'additional_acl' => []
|
||||
],
|
||||
],
|
||||
// 'UNIT_DEFAULT' => '',
|
||||
@@ -1114,6 +1125,7 @@ final class CoreLibsACLLoginTest extends TestCase
|
||||
'logout_target' => '',
|
||||
'site_locale' => 'en_US.UTF-8',
|
||||
'site_domain' => 'admin',
|
||||
'site_encoding' => 'UTF-8',
|
||||
'locale_path' => __DIR__ . DIRECTORY_SEPARATOR
|
||||
. 'includes' . DIRECTORY_SEPARATOR
|
||||
. 'locale' . DIRECTORY_SEPARATOR,
|
||||
@@ -1796,6 +1808,7 @@ final class CoreLibsACLLoginTest extends TestCase
|
||||
'logout_target' => '',
|
||||
'site_locale' => 'en_US.UTF-8',
|
||||
'site_domain' => 'admin',
|
||||
'site_encoding' => 'UTF-8',
|
||||
'locale_path' => __DIR__ . DIRECTORY_SEPARATOR
|
||||
. 'includes' . DIRECTORY_SEPARATOR
|
||||
. 'locale' . DIRECTORY_SEPARATOR,
|
||||
@@ -1909,6 +1922,7 @@ final class CoreLibsACLLoginTest extends TestCase
|
||||
'logout_target' => '',
|
||||
'site_locale' => 'en_US.UTF-8',
|
||||
'site_domain' => 'admin',
|
||||
'site_encoding' => 'UTF-8',
|
||||
'locale_path' => __DIR__ . DIRECTORY_SEPARATOR
|
||||
. 'includes' . DIRECTORY_SEPARATOR
|
||||
. 'locale' . DIRECTORY_SEPARATOR,
|
||||
@@ -1996,6 +2010,7 @@ final class CoreLibsACLLoginTest extends TestCase
|
||||
'logout_target' => '',
|
||||
'site_locale' => 'en_US.UTF-8',
|
||||
'site_domain' => 'admin',
|
||||
'site_encoding' => 'UTF-8',
|
||||
'locale_path' => __DIR__ . DIRECTORY_SEPARATOR
|
||||
. 'includes' . DIRECTORY_SEPARATOR
|
||||
. 'locale' . DIRECTORY_SEPARATOR,
|
||||
@@ -2091,6 +2106,7 @@ final class CoreLibsACLLoginTest extends TestCase
|
||||
'logout_target' => '',
|
||||
'site_locale' => 'en_US.UTF-8',
|
||||
'site_domain' => 'admin',
|
||||
'site_encoding' => 'UTF-8',
|
||||
'locale_path' => __DIR__ . DIRECTORY_SEPARATOR
|
||||
. 'includes' . DIRECTORY_SEPARATOR
|
||||
. 'locale' . DIRECTORY_SEPARATOR,
|
||||
|
||||
@@ -31,6 +31,7 @@ final class CoreLibsCombinedArrayHandlerTest extends TestCase
|
||||
4,
|
||||
'b',
|
||||
'c' => 'test',
|
||||
'single' => 'single',
|
||||
'same' => 'same',
|
||||
'deep' => [
|
||||
'sub' => [
|
||||
@@ -288,6 +289,188 @@ final class CoreLibsCombinedArrayHandlerTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function arraySearchKeyProvider(): array
|
||||
{
|
||||
/*
|
||||
0: search in array
|
||||
1: search keys
|
||||
2: flat flag
|
||||
3: prefix flag
|
||||
4: expected array
|
||||
*/
|
||||
return [
|
||||
// single
|
||||
'find single, standard' => [
|
||||
0 => self::$array,
|
||||
1 => ['single'],
|
||||
2 => null,
|
||||
3 => null,
|
||||
4 => [
|
||||
0 => [
|
||||
'value' => 'single',
|
||||
'path' => ['single'],
|
||||
],
|
||||
],
|
||||
],
|
||||
'find single, prefix' => [
|
||||
0 => self::$array,
|
||||
1 => ['single'],
|
||||
2 => null,
|
||||
3 => true,
|
||||
4 => [
|
||||
'single' => [
|
||||
0 => [
|
||||
'value' => 'single',
|
||||
'path' => ['single'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
'find single, flat' => [
|
||||
0 => self::$array,
|
||||
1 => ['single'],
|
||||
2 => true,
|
||||
3 => null,
|
||||
4 => [
|
||||
'single',
|
||||
],
|
||||
],
|
||||
'find single, flat, prefix' => [
|
||||
0 => self::$array,
|
||||
1 => ['single'],
|
||||
2 => true,
|
||||
3 => true,
|
||||
4 => [
|
||||
'single' => [
|
||||
'single',
|
||||
],
|
||||
],
|
||||
],
|
||||
// not found
|
||||
'not found, standard' => [
|
||||
0 => self::$array,
|
||||
1 => ['NOT FOUND'],
|
||||
2 => null,
|
||||
3 => null,
|
||||
4 => [],
|
||||
],
|
||||
'not found, standard, prefix' => [
|
||||
0 => self::$array,
|
||||
1 => ['NOT FOUND'],
|
||||
2 => null,
|
||||
3 => true,
|
||||
4 => [
|
||||
'NOT FOUND' => [],
|
||||
],
|
||||
],
|
||||
'not found, flat' => [
|
||||
0 => self::$array,
|
||||
1 => ['NOT FOUND'],
|
||||
2 => true,
|
||||
3 => null,
|
||||
4 => [],
|
||||
],
|
||||
'not found, flat, prefix' => [
|
||||
0 => self::$array,
|
||||
1 => ['NOT FOUND'],
|
||||
2 => true,
|
||||
3 => true,
|
||||
4 => [
|
||||
'NOT FOUND' => [],
|
||||
],
|
||||
],
|
||||
// multi
|
||||
'multiple found, standard' => [
|
||||
0 => self::$array,
|
||||
1 => ['same'],
|
||||
2 => null,
|
||||
3 => null,
|
||||
4 => [
|
||||
[
|
||||
'value' => 'same',
|
||||
'path' => ['a', 'same', ],
|
||||
],
|
||||
[
|
||||
'value' => 'same',
|
||||
'path' => ['same', ],
|
||||
],
|
||||
[
|
||||
'value' => 'same',
|
||||
'path' => ['deep', 'sub', 'same', ],
|
||||
],
|
||||
]
|
||||
],
|
||||
'multiple found, flat' => [
|
||||
0 => self::$array,
|
||||
1 => ['same'],
|
||||
2 => true,
|
||||
3 => null,
|
||||
4 => ['same', 'same', 'same', ],
|
||||
],
|
||||
// search with multiple
|
||||
'search multiple, standard' => [
|
||||
0 => self::$array,
|
||||
1 => ['single', 'nested'],
|
||||
2 => null,
|
||||
3 => null,
|
||||
4 => [
|
||||
[
|
||||
'value' => 'single',
|
||||
'path' => ['single'],
|
||||
],
|
||||
[
|
||||
'value' => 'bar',
|
||||
'path' => ['deep', 'sub', 'nested', ],
|
||||
],
|
||||
],
|
||||
],
|
||||
'search multiple, prefix' => [
|
||||
0 => self::$array,
|
||||
1 => ['single', 'nested'],
|
||||
2 => null,
|
||||
3 => true,
|
||||
4 => [
|
||||
'single' => [
|
||||
[
|
||||
'value' => 'single',
|
||||
'path' => ['single'],
|
||||
],
|
||||
],
|
||||
'nested' => [
|
||||
[
|
||||
'value' => 'bar',
|
||||
'path' => ['deep', 'sub', 'nested', ],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
'search multiple, flat' => [
|
||||
0 => self::$array,
|
||||
1 => ['single', 'nested'],
|
||||
2 => true,
|
||||
3 => null,
|
||||
4 => [
|
||||
'single', 'bar',
|
||||
],
|
||||
],
|
||||
'search multiple, flat, prefix' => [
|
||||
0 => self::$array,
|
||||
1 => ['single', 'nested'],
|
||||
2 => true,
|
||||
3 => true,
|
||||
4 => [
|
||||
'single' => ['single', ],
|
||||
'nested' => ['bar', ],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* provides array listing for the merge test
|
||||
*
|
||||
@@ -691,6 +874,44 @@ final class CoreLibsCombinedArrayHandlerTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @covers::arraySearchKey
|
||||
* @dataProvider arraySearchKeyProvider
|
||||
* @testdox arraySearchKey Search array with keys and flat: $flat, prefix: $prefix [$_dataName]
|
||||
*
|
||||
* @param array $input
|
||||
* @param array $needles
|
||||
* @param bool|null $flat
|
||||
* @param bool|null $prefix
|
||||
* @param array $expected
|
||||
* @return void
|
||||
*/
|
||||
public function testArraySearchKey(
|
||||
array $input,
|
||||
array $needles,
|
||||
?bool $flat,
|
||||
?bool $prefix,
|
||||
array $expected
|
||||
): void {
|
||||
if ($flat === null && $prefix === null) {
|
||||
$result = \CoreLibs\Combined\ArrayHandler::arraySearchKey($input, $needles);
|
||||
} elseif ($flat === null) {
|
||||
$result = \CoreLibs\Combined\ArrayHandler::arraySearchKey($input, $needles, prefix: $prefix);
|
||||
} elseif ($prefix === null) {
|
||||
$result = \CoreLibs\Combined\ArrayHandler::arraySearchKey($input, $needles, flat: $flat);
|
||||
} else {
|
||||
$result = \CoreLibs\Combined\ArrayHandler::arraySearchKey($input, $needles, $flat, $prefix);
|
||||
}
|
||||
// print "E: " . print_r($expected, true) . "\n";
|
||||
// print "R: " . print_r($result, true) . "\n";
|
||||
$this->assertEquals(
|
||||
$expected,
|
||||
$result
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,13 @@ use PHPUnit\Framework\TestCase;
|
||||
*/
|
||||
final class CoreLibsLanguageGetLocaleTest extends TestCase
|
||||
{
|
||||
public const SITE_ENCODING = 'UTF-8';
|
||||
public const SITE_LOCALE = 'en_US.UTF-8';
|
||||
public const SITE_DOMAIN = 'admin';
|
||||
public const LOCALE_PATH = __DIR__ . DIRECTORY_SEPARATOR
|
||||
. 'includes' . DIRECTORY_SEPARATOR
|
||||
. 'locale' . DIRECTORY_SEPARATOR;
|
||||
|
||||
/**
|
||||
* set all constant variables that must be set before call
|
||||
*
|
||||
@@ -22,7 +29,7 @@ final class CoreLibsLanguageGetLocaleTest extends TestCase
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
// default web page encoding setting
|
||||
if (!defined('DEFAULT_ENCODING')) {
|
||||
/* if (!defined('DEFAULT_ENCODING')) {
|
||||
define('DEFAULT_ENCODING', 'UTF-8');
|
||||
}
|
||||
if (!defined('DEFAULT_LOCALE')) {
|
||||
@@ -35,9 +42,9 @@ final class CoreLibsLanguageGetLocaleTest extends TestCase
|
||||
}
|
||||
if (!defined('SITE_LOCALE')) {
|
||||
define('SITE_LOCALE', DEFAULT_LOCALE);
|
||||
}
|
||||
} */
|
||||
// just set
|
||||
if (!defined('BASE')) {
|
||||
/* if (!defined('BASE')) {
|
||||
define('BASE', str_replace('/configs', '', __DIR__) . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
if (!defined('INCLUDES')) {
|
||||
@@ -51,7 +58,7 @@ final class CoreLibsLanguageGetLocaleTest extends TestCase
|
||||
}
|
||||
if (!defined('CONTENT_PATH')) {
|
||||
define('CONTENT_PATH', 'frontend' . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
} */
|
||||
// array session
|
||||
$_SESSION = [];
|
||||
global $_SESSION;
|
||||
@@ -62,7 +69,7 @@ final class CoreLibsLanguageGetLocaleTest extends TestCase
|
||||
*
|
||||
* @return array<mixed>
|
||||
*/
|
||||
public function setLocaleProvider(): array
|
||||
/* public function setLocaleProvider(): array
|
||||
{
|
||||
return [
|
||||
// 0: locale
|
||||
@@ -233,7 +240,7 @@ final class CoreLibsLanguageGetLocaleTest extends TestCase
|
||||
// TODO invalid params (bad path) (no override)
|
||||
// TODO param calls, but with override set
|
||||
];
|
||||
}
|
||||
} */
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
@@ -252,7 +259,7 @@ final class CoreLibsLanguageGetLocaleTest extends TestCase
|
||||
* @param string|null $deprecation_message
|
||||
* @return void
|
||||
*/
|
||||
public function testsetLocale(
|
||||
/* public function testsetLocale(
|
||||
?string $language,
|
||||
?string $domain,
|
||||
?string $encoding,
|
||||
@@ -347,6 +354,214 @@ final class CoreLibsLanguageGetLocaleTest extends TestCase
|
||||
// unset all vars
|
||||
$_SESSION = [];
|
||||
unset($GLOBALS['OVERRIDE_LANG']);
|
||||
} */
|
||||
|
||||
/**
|
||||
* all the test data
|
||||
*
|
||||
* @return array<mixed>
|
||||
*/
|
||||
public function setLocaleFromSessionProvider(): array
|
||||
{
|
||||
return [
|
||||
// 0: locale
|
||||
// 1: domain
|
||||
// 2: encoding
|
||||
// 3: path
|
||||
// 4: SESSION: DEFAULT_LOCALE
|
||||
// 5: SESSION: DEFAULT_CHARSET
|
||||
// 5: SESSION: DEFAULT_DOMAIN
|
||||
// 6: SESSION: LOCALE_PATH
|
||||
// 6: expected array
|
||||
// 7: deprecation message
|
||||
'all session vars set' => [
|
||||
// lang, domain, encoding, path
|
||||
self::SITE_LOCALE, self::SITE_DOMAIN, self::SITE_ENCODING, self::LOCALE_PATH,
|
||||
// SESSION SETTINGS: locale, charset, domain, path
|
||||
'ja_JP.UTF-8', 'UTF-8', 'admin', __DIR__ . '/locale_other/',
|
||||
// return array
|
||||
[
|
||||
'locale' => 'ja_JP.UTF-8',
|
||||
'lang' => 'ja_JP',
|
||||
'domain' => 'admin',
|
||||
'encoding' => 'UTF-8',
|
||||
'path' => "/^\/(.*\/)?locale_other\/$/",
|
||||
],
|
||||
],
|
||||
// param lang and domain (no override)
|
||||
'no session set, only parameters' => [
|
||||
// lang, domain, encoding, path
|
||||
self::SITE_LOCALE, self::SITE_DOMAIN, self::SITE_ENCODING, self::LOCALE_PATH,
|
||||
// SESSION SETTINGS: locale, charset, domain, path
|
||||
null, null, null, null,
|
||||
// return array
|
||||
[
|
||||
'locale' => 'en_US.UTF-8',
|
||||
'lang' => 'en_US',
|
||||
'domain' => 'admin',
|
||||
'encoding' => 'UTF-8',
|
||||
'path' => "/^\/(.*\/)?includes\/locale\/$/",
|
||||
],
|
||||
],
|
||||
// special parse session check for locales
|
||||
'all session vars set, short lang' => [
|
||||
// lang, domain, encoding, path
|
||||
self::SITE_LOCALE, self::SITE_DOMAIN, self::SITE_ENCODING, self::LOCALE_PATH,
|
||||
// SESSION SETTINGS: locale, charset, domain, path
|
||||
'ja', 'UTF-8', 'admin', __DIR__ . '/locale_other/',
|
||||
// return array
|
||||
[
|
||||
'locale' => 'ja',
|
||||
'lang' => 'ja',
|
||||
'domain' => 'admin',
|
||||
'encoding' => 'UTF-8',
|
||||
'path' => "/^\/(.*\/)?locale_other\/$/",
|
||||
],
|
||||
],
|
||||
// lang with modifier
|
||||
// param lang and domain (no override)
|
||||
'long locale, domain, encoding params, no sessions' => [
|
||||
// lang, domain, encoding, path
|
||||
self::SITE_LOCALE, self::SITE_DOMAIN, self::SITE_ENCODING, self::LOCALE_PATH,
|
||||
// SESSION SETTINGS: locale, charset, domain, path
|
||||
'de_CH.UTF-8@euro', 'admin', 'UTF-8', __DIR__ . '/includes/locale/',
|
||||
// return array
|
||||
[
|
||||
'locale' => 'de_CH.UTF-8@euro',
|
||||
'lang' => 'de_CH',
|
||||
'domain' => 'admin',
|
||||
'encoding' => 'UTF-8',
|
||||
'path' => "/^\/(.*\/)?includes\/locale\/$/",
|
||||
],
|
||||
],
|
||||
// missing session values check
|
||||
// special parse session check for locales
|
||||
'session missing encoding, set from parameters' => [
|
||||
// lang, domain, encoding, path
|
||||
self::SITE_LOCALE, self::SITE_DOMAIN, self::SITE_ENCODING, self::LOCALE_PATH,
|
||||
// SESSION SETTINGS: locale, charset, domain, path
|
||||
'ja', null, 'admin', __DIR__ . '/locale_other/',
|
||||
// return array
|
||||
[
|
||||
'locale' => 'ja',
|
||||
'lang' => 'ja',
|
||||
'domain' => 'admin',
|
||||
'encoding' => 'UTF-8',
|
||||
'path' => "/^\/(.*\/)?locale_other\/$/",
|
||||
],
|
||||
],
|
||||
// null return check for invalid entries
|
||||
'no session set, only parameters, all invalid' => [
|
||||
// lang, domain, encoding, path
|
||||
'###', '&&&&', '$$$$', 'foo_bar_path',
|
||||
// SESSION SETTINGS: locale, charset, domain, path
|
||||
null, null, null, null,
|
||||
// return array
|
||||
[
|
||||
'locale' => null,
|
||||
'lang' => null,
|
||||
'domain' => null,
|
||||
'encoding' => null,
|
||||
'path' => null,
|
||||
],
|
||||
],
|
||||
// invalid session names, fall backup
|
||||
'all session vars are invalid, fallback' => [
|
||||
// lang, domain, encoding, path
|
||||
self::SITE_LOCALE, self::SITE_DOMAIN, self::SITE_ENCODING, self::LOCALE_PATH,
|
||||
// SESSION SETTINGS: locale, charset, domain, path
|
||||
'###', '&&&&', '$$$$', 'foo_bar_path',
|
||||
// return array
|
||||
[
|
||||
'locale' => 'en_US.UTF-8',
|
||||
'lang' => 'en_US',
|
||||
'domain' => 'admin',
|
||||
'encoding' => 'UTF-8',
|
||||
'path' => "/^\/(.*\/)?includes\/locale\/$/",
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @covers ::setLocale
|
||||
* @dataProvider setLocaleFromSessionProvider
|
||||
* @testdox lang settings lang $language, domain $domain, encoding $encoding, path $path; session lang: $SESSION_DEFAULT_LOCALE, session char: $SESSION_DEFAULT_CHARSET [$_dataName]
|
||||
*
|
||||
* @param string| $language
|
||||
* @param string| $domain
|
||||
* @param string| $encoding
|
||||
* @param string| $path
|
||||
* @param string|null $SESSION_DEFAULT_LOCALE
|
||||
* @param string|null $SESSION_DEFAULT_CHARSET
|
||||
* @param string|null $SESSION_DEFAULT_DOMAIN
|
||||
* @param string|null $SESSION_LOCALE_PATH
|
||||
* @param array<mixed> $expected
|
||||
* @return void
|
||||
*/
|
||||
public function testsetLocaleFromSession(
|
||||
string $language,
|
||||
string $domain,
|
||||
string $encoding,
|
||||
string $path,
|
||||
?string $SESSION_DEFAULT_LOCALE,
|
||||
?string $SESSION_DEFAULT_CHARSET,
|
||||
?string $SESSION_DEFAULT_DOMAIN,
|
||||
?string $SESSION_LOCALE_PATH,
|
||||
array $expected,
|
||||
): void {
|
||||
$return_lang_settings = [];
|
||||
global $_SESSION;
|
||||
// set override
|
||||
if ($SESSION_DEFAULT_LOCALE !== null) {
|
||||
$_SESSION['DEFAULT_LOCALE'] = $SESSION_DEFAULT_LOCALE;
|
||||
}
|
||||
if ($SESSION_DEFAULT_CHARSET !== null) {
|
||||
$_SESSION['DEFAULT_CHARSET'] = $SESSION_DEFAULT_CHARSET;
|
||||
}
|
||||
if ($SESSION_DEFAULT_DOMAIN !== null) {
|
||||
$_SESSION['DEFAULT_DOMAIN'] = $SESSION_DEFAULT_DOMAIN;
|
||||
}
|
||||
if ($SESSION_LOCALE_PATH !== null) {
|
||||
$_SESSION['LOCALE_PATH'] = $SESSION_LOCALE_PATH;
|
||||
}
|
||||
$return_lang_settings = \CoreLibs\Language\GetLocale::setLocaleFromSession(
|
||||
$language,
|
||||
$domain,
|
||||
$encoding,
|
||||
$path
|
||||
);
|
||||
// print "RETURN: " . print_r($return_lang_settings, true) . "\n";
|
||||
foreach (
|
||||
[
|
||||
'locale', 'lang', 'domain', 'encoding', 'path'
|
||||
] as $key
|
||||
) {
|
||||
$value = $expected[$key];
|
||||
if (
|
||||
!empty($value) &&
|
||||
strpos($value, "/") === 0
|
||||
) {
|
||||
// this is regex
|
||||
$this->assertMatchesRegularExpression(
|
||||
$value,
|
||||
$return_lang_settings[$key] ?? '',
|
||||
'assert regex failed for ' . $key
|
||||
);
|
||||
} else {
|
||||
// assert equal
|
||||
$this->assertEquals(
|
||||
$value,
|
||||
$return_lang_settings[$key],
|
||||
'assert equal failed for ' . $key
|
||||
);
|
||||
}
|
||||
}
|
||||
// unset all vars
|
||||
$_SESSION = [];
|
||||
unset($GLOBALS['OVERRIDE_LANG']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,94 +84,141 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
||||
{
|
||||
return [
|
||||
// 0: locale
|
||||
// 1: domain
|
||||
// 2: encoding
|
||||
// 1: encoding
|
||||
// 2: domain
|
||||
// 3: path
|
||||
// 4: locale expected
|
||||
// 5: locale set expected
|
||||
// 6: lang expected
|
||||
// 7: encoding expected
|
||||
// 8: domain exepcted
|
||||
// 9: context (null for none)
|
||||
// 10: test string in
|
||||
// 11: test translated
|
||||
// 12: deprecation message (until removed)
|
||||
// 7: lang short expected
|
||||
// 8: encoding expected
|
||||
// 9: domain exepcted
|
||||
// 10: context (null for none)
|
||||
// 11: test string in
|
||||
// 12: test translated
|
||||
// 13: deprecation message (until removed)
|
||||
// new style load
|
||||
'gettext load en' => [
|
||||
'en_US.UTF-8',
|
||||
'UTF-8',
|
||||
'frontend',
|
||||
__DIR__ . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR,
|
||||
//
|
||||
// 4, 5, 6, 7, 8, 9
|
||||
'en_US.UTF-8',
|
||||
'en_US',
|
||||
'en_US',
|
||||
'en',
|
||||
'UTF-8',
|
||||
'frontend',
|
||||
// 10
|
||||
null,
|
||||
// 11, 12
|
||||
'Original',
|
||||
'Translated frontend en_US',
|
||||
// 13
|
||||
null,
|
||||
],
|
||||
'gettext load en' => [
|
||||
'en_US.UTF-8',
|
||||
'UTF-8',
|
||||
'frontend',
|
||||
__DIR__ . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR,
|
||||
//
|
||||
'en_US.UTF-8',
|
||||
'en_US',
|
||||
'en_US',
|
||||
'en',
|
||||
'UTF-8',
|
||||
'frontend',
|
||||
//
|
||||
'context',
|
||||
//
|
||||
'Original',
|
||||
'Original context frontend en_US',
|
||||
//
|
||||
null,
|
||||
],
|
||||
'gettext load ja' => [
|
||||
'ja_JP.UTF-8',
|
||||
'UTF-8',
|
||||
'admin',
|
||||
__DIR__ . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR,
|
||||
//
|
||||
'ja_JP.UTF-8',
|
||||
'ja_JP',
|
||||
'ja_JP',
|
||||
'ja',
|
||||
'UTF-8',
|
||||
'admin',
|
||||
//
|
||||
null,
|
||||
//
|
||||
'Original',
|
||||
'Translated admin ja_JP',
|
||||
//
|
||||
null,
|
||||
],
|
||||
// load short locale with different encoding
|
||||
'gettext load short ja no encoding' => [
|
||||
'ja',
|
||||
'SJIS',
|
||||
'admin',
|
||||
__DIR__ . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR,
|
||||
//
|
||||
'ja',
|
||||
'ja',
|
||||
'ja',
|
||||
'ja',
|
||||
'SJIS',
|
||||
'admin',
|
||||
//
|
||||
null,
|
||||
//
|
||||
'Original',
|
||||
'Translated admin ja_JP',
|
||||
//
|
||||
null,
|
||||
],
|
||||
// mixed path and domain [DEPRECATED]
|
||||
'mixed path and domain [DEPRECATED]' => [
|
||||
'en_US.UTF-8',
|
||||
'UTF-8',
|
||||
__DIR__ . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR,
|
||||
'frontend',
|
||||
//
|
||||
'en_US.UTF-8',
|
||||
'en_US',
|
||||
'en_US',
|
||||
'en',
|
||||
'UTF-8',
|
||||
'frontend',
|
||||
//
|
||||
'context',
|
||||
//
|
||||
'Original',
|
||||
'Original context frontend en_US',
|
||||
//
|
||||
'L10n constructor parameter switch is no longer supported. domain is 2nd, path is 3rd parameter'
|
||||
],
|
||||
// unset path
|
||||
'unset path with locale and domain [DEPRECATED]' => [
|
||||
'ja_JP.UTF-8',
|
||||
'UTF-8',
|
||||
'admin',
|
||||
null,
|
||||
//
|
||||
'ja_JP.UTF-8',
|
||||
'ja_JP',
|
||||
'ja_JP',
|
||||
'ja',
|
||||
'UTF-8',
|
||||
'admin',
|
||||
//
|
||||
null,
|
||||
//
|
||||
'Original',
|
||||
'Translated admin ja_JP',
|
||||
//
|
||||
'Empty path parameter is no longer allowed if locale and domain are set',
|
||||
],
|
||||
// null set
|
||||
@@ -179,15 +226,20 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
//
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'', // unset on empty call
|
||||
'',
|
||||
//
|
||||
null,
|
||||
//
|
||||
'Original',
|
||||
'Original',
|
||||
//
|
||||
null,
|
||||
]
|
||||
];
|
||||
@@ -201,11 +253,13 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
||||
* @testdox check l10n init with Locale $locale, Path $path, Domain $domain, Legacy: $legacy with $context [$_dataName]
|
||||
*
|
||||
* @param string|null $locale
|
||||
* @param string|null $encoding
|
||||
* @param string|null $domain
|
||||
* @param string|null $path
|
||||
* @param string $locale_expected
|
||||
* @param string $locale_set_expected
|
||||
* @param string $lang_expected
|
||||
* @param string $lang_short_expected
|
||||
* @param string $encoding_expected
|
||||
* @param string $domain_expected
|
||||
* @param string|null $context
|
||||
@@ -216,11 +270,13 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
||||
*/
|
||||
public function testL10nObject(
|
||||
?string $locale,
|
||||
?string $encoding,
|
||||
?string $domain,
|
||||
?string $path,
|
||||
string $locale_expected,
|
||||
string $locale_set_expected,
|
||||
string $lang_expected,
|
||||
string $lang_short_expected,
|
||||
string $encoding_expected,
|
||||
string $domain_expected,
|
||||
?string $context,
|
||||
@@ -241,16 +297,18 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
||||
if ($locale === null) {
|
||||
$l10n = new \CoreLibs\Language\L10n();
|
||||
} elseif ($domain === null) {
|
||||
// same as if locale is null
|
||||
// deprecated, locale + domain must be set, handled like empty calls
|
||||
$l10n = new \CoreLibs\Language\L10n($locale);
|
||||
} elseif ($path === null) {
|
||||
// deprecated, path must be set
|
||||
// deprecated, path must be set, will thow DEPRECATION error, handled like empty
|
||||
$l10n = new \CoreLibs\Language\L10n($locale, $domain);
|
||||
} else {
|
||||
} elseif ($encoding === null) {
|
||||
// if encoding not found will be UTF-8
|
||||
$l10n = new \CoreLibs\Language\L10n($locale, $domain, $path);
|
||||
} else {
|
||||
$l10n = new \CoreLibs\Language\L10n($locale, $domain, $path, $encoding);
|
||||
}
|
||||
restore_error_handler();
|
||||
// print "LOC: " . $locale . ", " . $l10n->getLocale() . ", " . $locale_expected . "\n";
|
||||
// print "MO: " . $l10n->getMoFile() . "\n";
|
||||
$this->assertEquals(
|
||||
$locale_expected,
|
||||
@@ -286,6 +344,7 @@ final class CoreLibsLanguageL10nTest extends TestCase
|
||||
[
|
||||
'locale' => $locale_expected,
|
||||
'lang' => $lang_expected,
|
||||
'lang_short' => $lang_short_expected,
|
||||
'domain' => $domain_expected,
|
||||
'encoding' => $encoding_expected,
|
||||
'path' => $path
|
||||
|
||||
1
4dev/tests/Language/includes/locale/ja
Symbolic link
1
4dev/tests/Language/includes/locale/ja
Symbolic link
@@ -0,0 +1 @@
|
||||
ja_JP
|
||||
@@ -7,7 +7,8 @@
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phan/phan": "^5.4",
|
||||
"phpstan/extension-installer": "^1.2",
|
||||
"vimeo/psalm": "^5.7"
|
||||
"vimeo/psalm": "^5.7",
|
||||
"phpstan/phpstan-deprecation-rules": "^1.1"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
|
||||
276
composer.lock
generated
276
composer.lock
generated
@@ -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": "0394d224d0f07a238818542e4602ba86",
|
||||
"content-hash": "c633a27ea30371ec870c8065ca4ae4cd",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
@@ -173,79 +173,6 @@
|
||||
],
|
||||
"time": "2021-03-30T17:13:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "composer/package-versions-deprecated",
|
||||
"version": "1.11.99.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/package-versions-deprecated.git",
|
||||
"reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d",
|
||||
"reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^1.1.0 || ^2.0",
|
||||
"php": "^7 || ^8"
|
||||
},
|
||||
"replace": {
|
||||
"ocramius/package-versions": "1.11.99"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "^1.9.3 || ^2.0@dev",
|
||||
"ext-zip": "^1.13",
|
||||
"phpunit/phpunit": "^6.5 || ^7"
|
||||
},
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "PackageVersions\\Installer",
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PackageVersions\\": "src/PackageVersions"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be"
|
||||
}
|
||||
],
|
||||
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
|
||||
"support": {
|
||||
"issues": "https://github.com/composer/package-versions-deprecated/issues",
|
||||
"source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://packagist.com",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/composer",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-01-17T14:14:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "composer/pcre",
|
||||
"version": "3.1.0",
|
||||
@@ -501,6 +428,49 @@
|
||||
},
|
||||
"time": "2019-12-04T15:06:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/deprecations",
|
||||
"version": "v1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/deprecations.git",
|
||||
"reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de",
|
||||
"reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^9",
|
||||
"phpunit/phpunit": "^7.5|^8.5|^9.5",
|
||||
"psr/log": "^1|^2|^3"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.",
|
||||
"homepage": "https://www.doctrine-project.org/",
|
||||
"support": {
|
||||
"issues": "https://github.com/doctrine/deprecations/issues",
|
||||
"source": "https://github.com/doctrine/deprecations/tree/v1.0.0"
|
||||
},
|
||||
"time": "2022-05-02T15:47:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "felixfbecker/advanced-json-rpc",
|
||||
"version": "v3.2.1",
|
||||
@@ -1006,24 +976,27 @@
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/type-resolver",
|
||||
"version": "1.6.2",
|
||||
"version": "1.7.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/TypeResolver.git",
|
||||
"reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d"
|
||||
"reference": "dfc078e8af9c99210337325ff5aa152872c98714"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d",
|
||||
"reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/dfc078e8af9c99210337325ff5aa152872c98714",
|
||||
"reference": "dfc078e8af9c99210337325ff5aa152872c98714",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/deprecations": "^1.0",
|
||||
"php": "^7.4 || ^8.0",
|
||||
"phpdocumentor/reflection-common": "^2.0"
|
||||
"phpdocumentor/reflection-common": "^2.0",
|
||||
"phpstan/phpdoc-parser": "^1.13"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-tokenizer": "*",
|
||||
"phpbench/phpbench": "^1.2",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan": "^1.8",
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
@@ -1055,9 +1028,9 @@
|
||||
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
|
||||
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2"
|
||||
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.1"
|
||||
},
|
||||
"time": "2022-10-14T12:47:21+00:00"
|
||||
"time": "2023-03-27T19:02:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/extension-installer",
|
||||
@@ -1104,17 +1077,62 @@
|
||||
"time": "2022-10-17T12:59:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.10.5",
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
"version": "1.16.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "1fb6f494d82455151ecf15c5c191923f5d84324e"
|
||||
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
||||
"reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/1fb6f494d82455151ecf15c5c191923f5d84324e",
|
||||
"reference": "1fb6f494d82455151ecf15c5c191923f5d84324e",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/e27e92d939e2e3636f0a1f0afaba59692c0bf571",
|
||||
"reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/extension-installer": "^1.0",
|
||||
"phpstan/phpstan": "^1.5",
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
"phpstan/phpstan-strict-rules": "^1.0",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"symfony/process": "^5.2"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPStan\\PhpDocParser\\": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.16.1"
|
||||
},
|
||||
"time": "2023-02-07T18:11:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.10.8",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "0166aef76e066f0dd2adc2799bdadfa1635711e9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/0166aef76e066f0dd2adc2799bdadfa1635711e9",
|
||||
"reference": "0166aef76e066f0dd2adc2799bdadfa1635711e9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1143,8 +1161,11 @@
|
||||
"static analysis"
|
||||
],
|
||||
"support": {
|
||||
"docs": "https://phpstan.org/user-guide/getting-started",
|
||||
"forum": "https://github.com/phpstan/phpstan/discussions",
|
||||
"issues": "https://github.com/phpstan/phpstan/issues",
|
||||
"source": "https://github.com/phpstan/phpstan/tree/1.10.5"
|
||||
"security": "https://github.com/phpstan/phpstan/security/policy",
|
||||
"source": "https://github.com/phpstan/phpstan-src"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1160,7 +1181,55 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-03-07T16:48:45+00:00"
|
||||
"time": "2023-03-24T10:28:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan-deprecation-rules",
|
||||
"version": "1.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan-deprecation-rules.git",
|
||||
"reference": "a22b36b955a2e9a3d39fe533b6c1bb5359f9c319"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/a22b36b955a2e9a3d39fe533b6c1bb5359f9c319",
|
||||
"reference": "a22b36b955a2e9a3d39fe533b6c1bb5359f9c319",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0",
|
||||
"phpstan/phpstan": "^1.10"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/phpstan-php-parser": "^1.1",
|
||||
"phpstan/phpstan-phpunit": "^1.0",
|
||||
"phpunit/phpunit": "^9.5"
|
||||
},
|
||||
"type": "phpstan-extension",
|
||||
"extra": {
|
||||
"phpstan": {
|
||||
"includes": [
|
||||
"rules.neon"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPStan\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues",
|
||||
"source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.1.3"
|
||||
},
|
||||
"time": "2023-03-17T07:50:08+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
@@ -1333,16 +1402,16 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
"version": "5.0.0",
|
||||
"version": "5.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||
"reference": "70dd1b20bc198da394ad542e988381b44e64e39f"
|
||||
"reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/70dd1b20bc198da394ad542e988381b44e64e39f",
|
||||
"reference": "70dd1b20bc198da394ad542e988381b44e64e39f",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/aae9a0a43bff37bd5d8d0311426c87bf36153f02",
|
||||
"reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1387,7 +1456,8 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/5.0.0"
|
||||
"security": "https://github.com/sebastianbergmann/diff/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/5.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1395,7 +1465,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-02-03T07:00:31+00:00"
|
||||
"time": "2023-03-23T05:12:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/array-to-xml",
|
||||
@@ -2334,22 +2404,22 @@
|
||||
},
|
||||
{
|
||||
"name": "vimeo/psalm",
|
||||
"version": "5.7.7",
|
||||
"version": "5.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vimeo/psalm.git",
|
||||
"reference": "e028ba46ba0d7f9a78bc3201c251e137383e145f"
|
||||
"reference": "9cf4f60a333f779ad3bc704a555920e81d4fdcda"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/vimeo/psalm/zipball/e028ba46ba0d7f9a78bc3201c251e137383e145f",
|
||||
"reference": "e028ba46ba0d7f9a78bc3201c251e137383e145f",
|
||||
"url": "https://api.github.com/repos/vimeo/psalm/zipball/9cf4f60a333f779ad3bc704a555920e81d4fdcda",
|
||||
"reference": "9cf4f60a333f779ad3bc704a555920e81d4fdcda",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"amphp/amp": "^2.4.2",
|
||||
"amphp/byte-stream": "^1.5",
|
||||
"composer/package-versions-deprecated": "^1.10.0",
|
||||
"composer-runtime-api": "^2",
|
||||
"composer/semver": "^1.4 || ^2.0 || ^3.0",
|
||||
"composer/xdebug-handler": "^2.0 || ^3.0",
|
||||
"dnoegel/php-xdg-base-dir": "^0.1.1",
|
||||
@@ -2364,7 +2434,7 @@
|
||||
"felixfbecker/language-server-protocol": "^1.5.2",
|
||||
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1",
|
||||
"netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
|
||||
"nikic/php-parser": "^4.13",
|
||||
"nikic/php-parser": "^4.14",
|
||||
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0",
|
||||
"sebastian/diff": "^4.0 || ^5.0",
|
||||
"spatie/array-to-xml": "^2.17.0 || ^3.0",
|
||||
@@ -2433,9 +2503,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/vimeo/psalm/issues",
|
||||
"source": "https://github.com/vimeo/psalm/tree/5.7.7"
|
||||
"source": "https://github.com/vimeo/psalm/tree/5.8.0"
|
||||
},
|
||||
"time": "2023-02-25T01:05:07+00:00"
|
||||
"time": "2023-03-09T04:14:35+00:00"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
|
||||
22
phpstan.neon
22
phpstan.neon
@@ -10,23 +10,15 @@ parameters:
|
||||
- %currentWorkingDirectory%/www
|
||||
bootstrapFiles:
|
||||
- %currentWorkingDirectory%/phpstan-bootstrap.php
|
||||
# - %currentWorkingDirectory%/www/lib/autoloader.php
|
||||
- %currentWorkingDirectory%/www/vendor/autoload.php
|
||||
scanDirectories:
|
||||
- www/vendor
|
||||
scanFiles:
|
||||
- www/configs/config.php
|
||||
- www/configs/config.master.php
|
||||
# if composer.json autoloader defined, this is not needed
|
||||
# - www/lib/autoloader.php
|
||||
# - www/vendor/autoload.php
|
||||
excludePaths:
|
||||
# do not check old qq file uploader tests
|
||||
- www/admin/qq_file_upload_*.php
|
||||
# ignore all test files
|
||||
# - www/admin/class_test*.php
|
||||
# extra in sub folder
|
||||
- www/admin/subfolder/class_test*.php
|
||||
- www/admin/error_test.php
|
||||
# admin synlink files
|
||||
- www/admin/edit_*.php
|
||||
@@ -37,10 +29,6 @@ parameters:
|
||||
# ignore admin header stuff
|
||||
# - www/includes/admin_header.php # ignore the admin include stuff
|
||||
- www/includes/admin_footer.php # ignore the admin include stuff
|
||||
# deprecated files
|
||||
- www/includes/admin_set_paths.php # ignore the admin include stuff
|
||||
- www/includes/admin_smarty.php # ignore the admin include stuff
|
||||
- www/includes/edit_base.LEGACY.php # old style
|
||||
# folders with data no check needed
|
||||
- www/templates_c
|
||||
- www/cache
|
||||
@@ -51,13 +39,9 @@ parameters:
|
||||
- www/vendor
|
||||
# ignore errores with
|
||||
ignoreErrors:
|
||||
#- # this error is ignore because of the PHP 8.0 to 8.1 change for pg_*, only for 8.0 or lower
|
||||
# message: "#^Parameter \\#1 \\$(result|connection) of function pg_\\w+ expects resource(\\|null)?, object\\|resource(\\|bool)? given\\.$#"
|
||||
# path: %currentWorkingDirectory%/www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||
# - # this is for 8.1 or newer
|
||||
# message: "#^Parameter \\#1 \\$(result|connection) of function pg_\\w+ expects PgSql\\\\(Result|Connection(\\|string)?(\\|null)?), object\\|resource given\\.$#"
|
||||
# path: %currentWorkingDirectory%/www/lib/CoreLibs/DB/SQL/PgSQL.php
|
||||
# this is ignored for now
|
||||
- # in the class_test tree we allow deprecated calls
|
||||
message: "#^Call to deprecated method #"
|
||||
path: %currentWorkingDirectory%/www/admin/class_test.*.php
|
||||
# - '#Expression in empty\(\) is always falsy.#'
|
||||
# -
|
||||
# message: '#Reflection error: [a-zA-Z0-9\\_]+ not found.#'
|
||||
|
||||
2
vendor/composer/autoload_files.php
vendored
2
vendor/composer/autoload_files.php
vendored
@@ -14,8 +14,8 @@ return array(
|
||||
'76cd0796156622033397994f25b0d8fc' => $vendorDir . '/amphp/amp/lib/Internal/functions.php',
|
||||
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
|
||||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
|
||||
'6cd5651c4fef5ed6b63e8d8b8ffbf3cc' => $vendorDir . '/amphp/byte-stream/lib/functions.php',
|
||||
'9b38cf48e83f5d8f60375221cd213eee' => $vendorDir . '/phpstan/phpstan/bootstrap.php',
|
||||
'6cd5651c4fef5ed6b63e8d8b8ffbf3cc' => $vendorDir . '/amphp/byte-stream/lib/functions.php',
|
||||
'2b9d0f43f9552984cfa82fee95491826' => $vendorDir . '/sabre/event/lib/coroutine.php',
|
||||
'd81bab31d3feb45bfe2f283ea3c8fdf7' => $vendorDir . '/sabre/event/lib/Loop/functions.php',
|
||||
'a1cce3d26cc15c00fcd0b3354bd72c88' => $vendorDir . '/sabre/event/lib/Promise/functions.php',
|
||||
|
||||
4
vendor/composer/autoload_psr4.php
vendored
4
vendor/composer/autoload_psr4.php
vendored
@@ -26,11 +26,13 @@ return array(
|
||||
'Psalm\\' => array($vendorDir . '/vimeo/psalm/src/Psalm'),
|
||||
'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'),
|
||||
'Phan\\' => array($vendorDir . '/phan/phan/src/Phan'),
|
||||
'PackageVersions\\' => array($vendorDir . '/composer/package-versions-deprecated/src/PackageVersions'),
|
||||
'PHPStan\\PhpDocParser\\' => array($vendorDir . '/phpstan/phpdoc-parser/src'),
|
||||
'PHPStan\\ExtensionInstaller\\' => array($vendorDir . '/phpstan/extension-installer/src'),
|
||||
'PHPStan\\' => array($vendorDir . '/phpstan/phpstan-deprecation-rules/src'),
|
||||
'Microsoft\\PhpParser\\' => array($vendorDir . '/microsoft/tolerant-php-parser/src'),
|
||||
'LanguageServerProtocol\\' => array($vendorDir . '/felixfbecker/language-server-protocol/src'),
|
||||
'Fidry\\CpuCoreCounter\\' => array($vendorDir . '/fidry/cpu-core-counter/src'),
|
||||
'Doctrine\\Deprecations\\' => array($vendorDir . '/doctrine/deprecations/lib/Doctrine/Deprecations'),
|
||||
'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
|
||||
'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
|
||||
'Composer\\Pcre\\' => array($vendorDir . '/composer/pcre/src'),
|
||||
|
||||
21
vendor/composer/autoload_static.php
vendored
21
vendor/composer/autoload_static.php
vendored
@@ -15,8 +15,8 @@ class ComposerStaticInitdd705c6e8ab22e0d642372dec7767718
|
||||
'76cd0796156622033397994f25b0d8fc' => __DIR__ . '/..' . '/amphp/amp/lib/Internal/functions.php',
|
||||
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
|
||||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
|
||||
'6cd5651c4fef5ed6b63e8d8b8ffbf3cc' => __DIR__ . '/..' . '/amphp/byte-stream/lib/functions.php',
|
||||
'9b38cf48e83f5d8f60375221cd213eee' => __DIR__ . '/..' . '/phpstan/phpstan/bootstrap.php',
|
||||
'6cd5651c4fef5ed6b63e8d8b8ffbf3cc' => __DIR__ . '/..' . '/amphp/byte-stream/lib/functions.php',
|
||||
'2b9d0f43f9552984cfa82fee95491826' => __DIR__ . '/..' . '/sabre/event/lib/coroutine.php',
|
||||
'd81bab31d3feb45bfe2f283ea3c8fdf7' => __DIR__ . '/..' . '/sabre/event/lib/Loop/functions.php',
|
||||
'a1cce3d26cc15c00fcd0b3354bd72c88' => __DIR__ . '/..' . '/sabre/event/lib/Promise/functions.php',
|
||||
@@ -62,8 +62,9 @@ class ComposerStaticInitdd705c6e8ab22e0d642372dec7767718
|
||||
'Psalm\\' => 6,
|
||||
'PhpParser\\' => 10,
|
||||
'Phan\\' => 5,
|
||||
'PackageVersions\\' => 16,
|
||||
'PHPStan\\PhpDocParser\\' => 21,
|
||||
'PHPStan\\ExtensionInstaller\\' => 27,
|
||||
'PHPStan\\' => 8,
|
||||
),
|
||||
'M' =>
|
||||
array (
|
||||
@@ -77,6 +78,10 @@ class ComposerStaticInitdd705c6e8ab22e0d642372dec7767718
|
||||
array (
|
||||
'Fidry\\CpuCoreCounter\\' => 21,
|
||||
),
|
||||
'D' =>
|
||||
array (
|
||||
'Doctrine\\Deprecations\\' => 22,
|
||||
),
|
||||
'C' =>
|
||||
array (
|
||||
'Composer\\XdebugHandler\\' => 23,
|
||||
@@ -174,14 +179,18 @@ class ComposerStaticInitdd705c6e8ab22e0d642372dec7767718
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/phan/phan/src/Phan',
|
||||
),
|
||||
'PackageVersions\\' =>
|
||||
'PHPStan\\PhpDocParser\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/composer/package-versions-deprecated/src/PackageVersions',
|
||||
0 => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src',
|
||||
),
|
||||
'PHPStan\\ExtensionInstaller\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/phpstan/extension-installer/src',
|
||||
),
|
||||
'PHPStan\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/phpstan/phpstan-deprecation-rules/src',
|
||||
),
|
||||
'Microsoft\\PhpParser\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/microsoft/tolerant-php-parser/src',
|
||||
@@ -194,6 +203,10 @@ class ComposerStaticInitdd705c6e8ab22e0d642372dec7767718
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/fidry/cpu-core-counter/src',
|
||||
),
|
||||
'Doctrine\\Deprecations\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/doctrine/deprecations/lib/Doctrine/Deprecations',
|
||||
),
|
||||
'Composer\\XdebugHandler\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
|
||||
|
||||
298
vendor/composer/installed.json
vendored
298
vendor/composer/installed.json
vendored
@@ -172,82 +172,6 @@
|
||||
],
|
||||
"install-path": "../amphp/byte-stream"
|
||||
},
|
||||
{
|
||||
"name": "composer/package-versions-deprecated",
|
||||
"version": "1.11.99.5",
|
||||
"version_normalized": "1.11.99.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/package-versions-deprecated.git",
|
||||
"reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d",
|
||||
"reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^1.1.0 || ^2.0",
|
||||
"php": "^7 || ^8"
|
||||
},
|
||||
"replace": {
|
||||
"ocramius/package-versions": "1.11.99"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "^1.9.3 || ^2.0@dev",
|
||||
"ext-zip": "^1.13",
|
||||
"phpunit/phpunit": "^6.5 || ^7"
|
||||
},
|
||||
"time": "2022-01-17T14:14:24+00:00",
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "PackageVersions\\Installer",
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PackageVersions\\": "src/PackageVersions"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be"
|
||||
}
|
||||
],
|
||||
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
|
||||
"support": {
|
||||
"issues": "https://github.com/composer/package-versions-deprecated/issues",
|
||||
"source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://packagist.com",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/composer",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "./package-versions-deprecated"
|
||||
},
|
||||
{
|
||||
"name": "composer/pcre",
|
||||
"version": "3.1.0",
|
||||
@@ -515,6 +439,52 @@
|
||||
},
|
||||
"install-path": "../dnoegel/php-xdg-base-dir"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/deprecations",
|
||||
"version": "v1.0.0",
|
||||
"version_normalized": "1.0.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/deprecations.git",
|
||||
"reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de",
|
||||
"reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^9",
|
||||
"phpunit/phpunit": "^7.5|^8.5|^9.5",
|
||||
"psr/log": "^1|^2|^3"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
|
||||
},
|
||||
"time": "2022-05-02T15:47:09+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.",
|
||||
"homepage": "https://www.doctrine-project.org/",
|
||||
"support": {
|
||||
"issues": "https://github.com/doctrine/deprecations/issues",
|
||||
"source": "https://github.com/doctrine/deprecations/tree/v1.0.0"
|
||||
},
|
||||
"install-path": "../doctrine/deprecations"
|
||||
},
|
||||
{
|
||||
"name": "felixfbecker/advanced-json-rpc",
|
||||
"version": "v3.2.1",
|
||||
@@ -1047,25 +1017,28 @@
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/type-resolver",
|
||||
"version": "1.6.2",
|
||||
"version_normalized": "1.6.2.0",
|
||||
"version": "1.7.1",
|
||||
"version_normalized": "1.7.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpDocumentor/TypeResolver.git",
|
||||
"reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d"
|
||||
"reference": "dfc078e8af9c99210337325ff5aa152872c98714"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d",
|
||||
"reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d",
|
||||
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/dfc078e8af9c99210337325ff5aa152872c98714",
|
||||
"reference": "dfc078e8af9c99210337325ff5aa152872c98714",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/deprecations": "^1.0",
|
||||
"php": "^7.4 || ^8.0",
|
||||
"phpdocumentor/reflection-common": "^2.0"
|
||||
"phpdocumentor/reflection-common": "^2.0",
|
||||
"phpstan/phpdoc-parser": "^1.13"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-tokenizer": "*",
|
||||
"phpbench/phpbench": "^1.2",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan": "^1.8",
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
@@ -1073,7 +1046,7 @@
|
||||
"rector/rector": "^0.13.9",
|
||||
"vimeo/psalm": "^4.25"
|
||||
},
|
||||
"time": "2022-10-14T12:47:21+00:00",
|
||||
"time": "2023-03-27T19:02:04+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
@@ -1099,7 +1072,7 @@
|
||||
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
|
||||
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2"
|
||||
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.1"
|
||||
},
|
||||
"install-path": "../phpdocumentor/type-resolver"
|
||||
},
|
||||
@@ -1151,18 +1124,66 @@
|
||||
"install-path": "../phpstan/extension-installer"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.10.5",
|
||||
"version_normalized": "1.10.5.0",
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
"version": "1.16.1",
|
||||
"version_normalized": "1.16.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "1fb6f494d82455151ecf15c5c191923f5d84324e"
|
||||
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
||||
"reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/1fb6f494d82455151ecf15c5c191923f5d84324e",
|
||||
"reference": "1fb6f494d82455151ecf15c5c191923f5d84324e",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/e27e92d939e2e3636f0a1f0afaba59692c0bf571",
|
||||
"reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/extension-installer": "^1.0",
|
||||
"phpstan/phpstan": "^1.5",
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
"phpstan/phpstan-strict-rules": "^1.0",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"symfony/process": "^5.2"
|
||||
},
|
||||
"time": "2023-02-07T18:11:17+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPStan\\PhpDocParser\\": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.16.1"
|
||||
},
|
||||
"install-path": "../phpstan/phpdoc-parser"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.10.8",
|
||||
"version_normalized": "1.10.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "0166aef76e066f0dd2adc2799bdadfa1635711e9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/0166aef76e066f0dd2adc2799bdadfa1635711e9",
|
||||
"reference": "0166aef76e066f0dd2adc2799bdadfa1635711e9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1171,7 +1192,7 @@
|
||||
"conflict": {
|
||||
"phpstan/phpstan-shim": "*"
|
||||
},
|
||||
"time": "2023-03-07T16:48:45+00:00",
|
||||
"time": "2023-03-24T10:28:16+00:00",
|
||||
"bin": [
|
||||
"phpstan",
|
||||
"phpstan.phar"
|
||||
@@ -1193,8 +1214,11 @@
|
||||
"static analysis"
|
||||
],
|
||||
"support": {
|
||||
"docs": "https://phpstan.org/user-guide/getting-started",
|
||||
"forum": "https://github.com/phpstan/phpstan/discussions",
|
||||
"issues": "https://github.com/phpstan/phpstan/issues",
|
||||
"source": "https://github.com/phpstan/phpstan/tree/1.10.5"
|
||||
"security": "https://github.com/phpstan/phpstan/security/policy",
|
||||
"source": "https://github.com/phpstan/phpstan-src"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1212,6 +1236,57 @@
|
||||
],
|
||||
"install-path": "../phpstan/phpstan"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan-deprecation-rules",
|
||||
"version": "1.1.3",
|
||||
"version_normalized": "1.1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan-deprecation-rules.git",
|
||||
"reference": "a22b36b955a2e9a3d39fe533b6c1bb5359f9c319"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/a22b36b955a2e9a3d39fe533b6c1bb5359f9c319",
|
||||
"reference": "a22b36b955a2e9a3d39fe533b6c1bb5359f9c319",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0",
|
||||
"phpstan/phpstan": "^1.10"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/phpstan-php-parser": "^1.1",
|
||||
"phpstan/phpstan-phpunit": "^1.0",
|
||||
"phpunit/phpunit": "^9.5"
|
||||
},
|
||||
"time": "2023-03-17T07:50:08+00:00",
|
||||
"type": "phpstan-extension",
|
||||
"extra": {
|
||||
"phpstan": {
|
||||
"includes": [
|
||||
"rules.neon"
|
||||
]
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPStan\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues",
|
||||
"source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.1.3"
|
||||
},
|
||||
"install-path": "../phpstan/phpstan-deprecation-rules"
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
"version": "2.0.2",
|
||||
@@ -1392,17 +1467,17 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
"version": "5.0.0",
|
||||
"version_normalized": "5.0.0.0",
|
||||
"version": "5.0.1",
|
||||
"version_normalized": "5.0.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||
"reference": "70dd1b20bc198da394ad542e988381b44e64e39f"
|
||||
"reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/70dd1b20bc198da394ad542e988381b44e64e39f",
|
||||
"reference": "70dd1b20bc198da394ad542e988381b44e64e39f",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/aae9a0a43bff37bd5d8d0311426c87bf36153f02",
|
||||
"reference": "aae9a0a43bff37bd5d8d0311426c87bf36153f02",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1412,7 +1487,7 @@
|
||||
"phpunit/phpunit": "^10.0",
|
||||
"symfony/process": "^4.2 || ^5"
|
||||
},
|
||||
"time": "2023-02-03T07:00:31+00:00",
|
||||
"time": "2023-03-23T05:12:41+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
@@ -1449,7 +1524,8 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/5.0.0"
|
||||
"security": "https://github.com/sebastianbergmann/diff/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/5.0.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -2432,23 +2508,23 @@
|
||||
},
|
||||
{
|
||||
"name": "vimeo/psalm",
|
||||
"version": "5.7.7",
|
||||
"version_normalized": "5.7.7.0",
|
||||
"version": "5.8.0",
|
||||
"version_normalized": "5.8.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vimeo/psalm.git",
|
||||
"reference": "e028ba46ba0d7f9a78bc3201c251e137383e145f"
|
||||
"reference": "9cf4f60a333f779ad3bc704a555920e81d4fdcda"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/vimeo/psalm/zipball/e028ba46ba0d7f9a78bc3201c251e137383e145f",
|
||||
"reference": "e028ba46ba0d7f9a78bc3201c251e137383e145f",
|
||||
"url": "https://api.github.com/repos/vimeo/psalm/zipball/9cf4f60a333f779ad3bc704a555920e81d4fdcda",
|
||||
"reference": "9cf4f60a333f779ad3bc704a555920e81d4fdcda",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"amphp/amp": "^2.4.2",
|
||||
"amphp/byte-stream": "^1.5",
|
||||
"composer/package-versions-deprecated": "^1.10.0",
|
||||
"composer-runtime-api": "^2",
|
||||
"composer/semver": "^1.4 || ^2.0 || ^3.0",
|
||||
"composer/xdebug-handler": "^2.0 || ^3.0",
|
||||
"dnoegel/php-xdg-base-dir": "^0.1.1",
|
||||
@@ -2463,7 +2539,7 @@
|
||||
"felixfbecker/language-server-protocol": "^1.5.2",
|
||||
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1",
|
||||
"netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
|
||||
"nikic/php-parser": "^4.13",
|
||||
"nikic/php-parser": "^4.14",
|
||||
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0",
|
||||
"sebastian/diff": "^4.0 || ^5.0",
|
||||
"spatie/array-to-xml": "^2.17.0 || ^3.0",
|
||||
@@ -2492,7 +2568,7 @@
|
||||
"ext-curl": "In order to send data to shepherd",
|
||||
"ext-igbinary": "^2.0.5 is required, used to serialize caching data"
|
||||
},
|
||||
"time": "2023-02-25T01:05:07+00:00",
|
||||
"time": "2023-03-09T04:14:35+00:00",
|
||||
"bin": [
|
||||
"psalm",
|
||||
"psalm-language-server",
|
||||
@@ -2534,7 +2610,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/vimeo/psalm/issues",
|
||||
"source": "https://github.com/vimeo/psalm/tree/5.7.7"
|
||||
"source": "https://github.com/vimeo/psalm/tree/5.8.0"
|
||||
},
|
||||
"install-path": "../vimeo/psalm"
|
||||
},
|
||||
@@ -2604,11 +2680,11 @@
|
||||
"dev-package-names": [
|
||||
"amphp/amp",
|
||||
"amphp/byte-stream",
|
||||
"composer/package-versions-deprecated",
|
||||
"composer/pcre",
|
||||
"composer/semver",
|
||||
"composer/xdebug-handler",
|
||||
"dnoegel/php-xdg-base-dir",
|
||||
"doctrine/deprecations",
|
||||
"felixfbecker/advanced-json-rpc",
|
||||
"felixfbecker/language-server-protocol",
|
||||
"fidry/cpu-core-counter",
|
||||
@@ -2620,7 +2696,9 @@
|
||||
"phpdocumentor/reflection-docblock",
|
||||
"phpdocumentor/type-resolver",
|
||||
"phpstan/extension-installer",
|
||||
"phpstan/phpdoc-parser",
|
||||
"phpstan/phpstan",
|
||||
"phpstan/phpstan-deprecation-rules",
|
||||
"psr/container",
|
||||
"psr/log",
|
||||
"sabre/event",
|
||||
|
||||
68
vendor/composer/installed.php
vendored
68
vendor/composer/installed.php
vendored
@@ -28,15 +28,6 @@
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'composer/package-versions-deprecated' => array(
|
||||
'pretty_version' => '1.11.99.5',
|
||||
'version' => '1.11.99.5',
|
||||
'reference' => 'b4f54f74ef3453349c24a845d22392cd31e65f1d',
|
||||
'type' => 'composer-plugin',
|
||||
'install_path' => __DIR__ . '/./package-versions-deprecated',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'composer/pcre' => array(
|
||||
'pretty_version' => '3.1.0',
|
||||
'version' => '3.1.0.0',
|
||||
@@ -73,6 +64,15 @@
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'doctrine/deprecations' => array(
|
||||
'pretty_version' => 'v1.0.0',
|
||||
'version' => '1.0.0.0',
|
||||
'reference' => '0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../doctrine/deprecations',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'egrajp/development-corelibs-dev' => array(
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
@@ -136,12 +136,6 @@
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'ocramius/package-versions' => array(
|
||||
'dev_requirement' => true,
|
||||
'replaced' => array(
|
||||
0 => '1.11.99',
|
||||
),
|
||||
),
|
||||
'phan/phan' => array(
|
||||
'pretty_version' => '5.4.2',
|
||||
'version' => '5.4.2.0',
|
||||
@@ -170,9 +164,9 @@
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpdocumentor/type-resolver' => array(
|
||||
'pretty_version' => '1.6.2',
|
||||
'version' => '1.6.2.0',
|
||||
'reference' => '48f445a408c131e38cab1c235aa6d2bb7a0bb20d',
|
||||
'pretty_version' => '1.7.1',
|
||||
'version' => '1.7.1.0',
|
||||
'reference' => 'dfc078e8af9c99210337325ff5aa152872c98714',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpdocumentor/type-resolver',
|
||||
'aliases' => array(),
|
||||
@@ -187,19 +181,37 @@
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpstan/phpdoc-parser' => array(
|
||||
'pretty_version' => '1.16.1',
|
||||
'version' => '1.16.1.0',
|
||||
'reference' => 'e27e92d939e2e3636f0a1f0afaba59692c0bf571',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpstan/phpdoc-parser',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpstan/phpstan' => array(
|
||||
'pretty_version' => '1.10.5',
|
||||
'version' => '1.10.5.0',
|
||||
'reference' => '1fb6f494d82455151ecf15c5c191923f5d84324e',
|
||||
'pretty_version' => '1.10.8',
|
||||
'version' => '1.10.8.0',
|
||||
'reference' => '0166aef76e066f0dd2adc2799bdadfa1635711e9',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../phpstan/phpstan',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'phpstan/phpstan-deprecation-rules' => array(
|
||||
'pretty_version' => '1.1.3',
|
||||
'version' => '1.1.3.0',
|
||||
'reference' => 'a22b36b955a2e9a3d39fe533b6c1bb5359f9c319',
|
||||
'type' => 'phpstan-extension',
|
||||
'install_path' => __DIR__ . '/../phpstan/phpstan-deprecation-rules',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'psalm/psalm' => array(
|
||||
'dev_requirement' => true,
|
||||
'provided' => array(
|
||||
0 => '5.7.7',
|
||||
0 => '5.8.0',
|
||||
),
|
||||
),
|
||||
'psr/container' => array(
|
||||
@@ -236,9 +248,9 @@
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'sebastian/diff' => array(
|
||||
'pretty_version' => '5.0.0',
|
||||
'version' => '5.0.0.0',
|
||||
'reference' => '70dd1b20bc198da394ad542e988381b44e64e39f',
|
||||
'pretty_version' => '5.0.1',
|
||||
'version' => '5.0.1.0',
|
||||
'reference' => 'aae9a0a43bff37bd5d8d0311426c87bf36153f02',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../sebastian/diff',
|
||||
'aliases' => array(),
|
||||
@@ -353,9 +365,9 @@
|
||||
'dev_requirement' => true,
|
||||
),
|
||||
'vimeo/psalm' => array(
|
||||
'pretty_version' => '5.7.7',
|
||||
'version' => '5.7.7.0',
|
||||
'reference' => 'e028ba46ba0d7f9a78bc3201c251e137383e145f',
|
||||
'pretty_version' => '5.8.0',
|
||||
'version' => '5.8.0.0',
|
||||
'reference' => '9cf4f60a333f779ad3bc704a555920e81d4fdcda',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../vimeo/psalm',
|
||||
'aliases' => array(),
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 1.1.3 - 2017-09-06
|
||||
|
||||
This release fixes a bug that caused PackageVersions to prevent
|
||||
the `composer remove` and `composer update` commands to fail when
|
||||
this package is removed.
|
||||
|
||||
In addition to that, mutation testing has been added to the suite,
|
||||
ensuring that the package is accurately and extensively tested.
|
||||
|
||||
Total issues resolved: **3**
|
||||
|
||||
- [40: Mutation testing, PHP 7.1 testing](https://github.com/Ocramius/PackageVersions/pull/40) thanks to @Ocramius
|
||||
- [41: Removing this package on install results in file access error](https://github.com/Ocramius/PackageVersions/issues/41) thanks to @Xerkus
|
||||
- [46: #41 Avoid issues when the package is scheduled for removal](https://github.com/Ocramius/PackageVersions/pull/46) thanks to @Jean85
|
||||
|
||||
## 1.1.2 - 2016-12-30
|
||||
|
||||
This release fixes a bug that caused PackageVersions to be enabled
|
||||
even when it was part of a globally installed package.
|
||||
|
||||
Total issues resolved: **3**
|
||||
|
||||
- [35: remove all temp directories](https://github.com/Ocramius/PackageVersions/pull/35)
|
||||
- [38: Interferes with other projects when installed globally](https://github.com/Ocramius/PackageVersions/issues/38)
|
||||
- [39: Ignore the global plugin when updating local projects](https://github.com/Ocramius/PackageVersions/pull/39)
|
||||
|
||||
## 1.1.1 - 2016-07-25
|
||||
|
||||
This release removes the [`"files"`](https://getcomposer.org/doc/04-schema.md#files) directive from
|
||||
[`composer.json`](https://github.com/Ocramius/PackageVersions/commit/86f2636f7c5e7b56fa035fa3826d5fcf80b6dc72),
|
||||
as it is no longer needed for `composer install --classmap-authoritative`.
|
||||
Also, that directive was causing issues with HHVM installations, since
|
||||
PackageVersions is not compatible with it.
|
||||
|
||||
Total issues resolved: **1**
|
||||
|
||||
- [34: Fatal error during travis build after update to 1.1.0](https://github.com/Ocramius/PackageVersions/issues/34)
|
||||
|
||||
## 1.1.0 - 2016-07-22
|
||||
|
||||
This release introduces support for running `composer install --classmap-authoritative`
|
||||
and `composer install --no-scripts`. Please note that performance
|
||||
while using these modes may be degraded, but the package will
|
||||
still work.
|
||||
|
||||
Additionally, the package was tuned to prevent the plugin from
|
||||
running twice at installation.
|
||||
|
||||
Total issues resolved: **10**
|
||||
|
||||
- [18: Fails when using composer install --no-scripts](https://github.com/Ocramius/PackageVersions/issues/18)
|
||||
- [20: CS (spacing)](https://github.com/Ocramius/PackageVersions/pull/20)
|
||||
- [22: Document the way the require-dev section is treated](https://github.com/Ocramius/PackageVersions/issues/22)
|
||||
- [23: Underline that composer.lock is used as source of information](https://github.com/Ocramius/PackageVersions/pull/23)
|
||||
- [27: Fix incompatibility with --classmap-authoritative](https://github.com/Ocramius/PackageVersions/pull/27)
|
||||
- [29: mention optimize-autoloader composer.json config option in README](https://github.com/Ocramius/PackageVersions/pull/29)
|
||||
- [30: The version class is generated twice during composer update](https://github.com/Ocramius/PackageVersions/issues/30)
|
||||
- [31: Remove double registration of the event listeners](https://github.com/Ocramius/PackageVersions/pull/31)
|
||||
- [32: Update the usage of mock APIs to use the new API](https://github.com/Ocramius/PackageVersions/pull/32)
|
||||
- [33: Fix for #18 - support running with --no-scripts flag](https://github.com/Ocramius/PackageVersions/pull/33)
|
||||
|
||||
## 1.0.4 - 2016-04-23
|
||||
|
||||
This release includes a fix/workaround for composer/composer#5237,
|
||||
which causes `ocramius/package-versions` to sometimes generate a
|
||||
`Versions` class with malformed name (something like
|
||||
`Versions_composer_tmp0`) when running `composer require <package-name>`.
|
||||
|
||||
Total issues resolved: **2**
|
||||
|
||||
- [16: Workaround for composer/composer#5237 - class parsing](https://github.com/Ocramius/PackageVersions/pull/16)
|
||||
- [17: Weird Class name being generated](https://github.com/Ocramius/PackageVersions/issues/17)
|
||||
|
||||
## 1.0.3 - 2016-02-26
|
||||
|
||||
This release fixes an issue related to concurrent autoloader
|
||||
re-generation caused by multiple composer plugins being installed.
|
||||
The issue was solved by removing autoloader re-generation from this
|
||||
package, but it may still affect other packages.
|
||||
|
||||
It is now recommended that you run `composer dump-autoload --optimize`
|
||||
after installation when using this particular package.
|
||||
Please note that `composer (install|update) -o` is not sufficient
|
||||
to avoid autoload overhead when using this particular package.
|
||||
|
||||
Total issues resolved: **1**
|
||||
|
||||
- [15: Remove autoload re-dump optimization](https://github.com/Ocramius/PackageVersions/pull/15)
|
||||
|
||||
## 1.0.2 - 2016-02-24
|
||||
|
||||
This release fixes issues related to installing the component without
|
||||
any dev dependencies or with packages that don't have a source or dist
|
||||
reference, which is usual with packages defined directly in the
|
||||
`composer.json`.
|
||||
|
||||
Total issues resolved: **3**
|
||||
|
||||
- [11: fix composer install --no-dev PHP7](https://github.com/Ocramius/PackageVersions/pull/11)
|
||||
- [12: Packages don't always have a source/reference](https://github.com/Ocramius/PackageVersions/issues/12)
|
||||
- [13: Fix #12 - support dist and missing package version references](https://github.com/Ocramius/PackageVersions/pull/13)
|
||||
|
||||
## 1.0.1 - 2016-02-01
|
||||
|
||||
This release fixes an issue related with composer updates to
|
||||
already installed versions.
|
||||
Using `composer require` within a package that already used
|
||||
`ocramius/package-versions` caused the installation to be unable
|
||||
to write the `PackageVersions\Versions` class to a file.
|
||||
|
||||
Total issues resolved: **6**
|
||||
|
||||
- [2: remove unused use statement](https://github.com/Ocramius/PackageVersions/pull/2)
|
||||
- [3: Remove useless files from dist package](https://github.com/Ocramius/PackageVersions/pull/3)
|
||||
- [5: failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly](https://github.com/Ocramius/PackageVersions/issues/5)
|
||||
- [6: Fix/#5 use composer vendor dir](https://github.com/Ocramius/PackageVersions/pull/6)
|
||||
- [7: Hotfix - #5 generate package versions also when in phar context](https://github.com/Ocramius/PackageVersions/pull/7)
|
||||
- [8: Versions class should be ignored by VCS, as it is an install-time artifact](https://github.com/Ocramius/PackageVersions/pull/8)
|
||||
@@ -1,39 +0,0 @@
|
||||
---
|
||||
title: Contributing
|
||||
---
|
||||
|
||||
# Contributing
|
||||
|
||||
* 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
|
||||
* Pull requests must be sent from a new hotfix/feature branch, not from `master`.
|
||||
|
||||
## Installation
|
||||
|
||||
To install the project and run the tests, you need to clone it first:
|
||||
|
||||
```sh
|
||||
$ git clone git://github.com/Ocramius/PackageVersions.git
|
||||
```
|
||||
|
||||
You will then need to run a composer installation:
|
||||
|
||||
```sh
|
||||
$ cd PackageVersions
|
||||
$ curl -s https://getcomposer.org/installer | php
|
||||
$ php composer.phar update
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
The PHPUnit version to be used is the one installed as a dev- dependency via composer:
|
||||
|
||||
```sh
|
||||
$ ./vendor/bin/phpunit
|
||||
```
|
||||
|
||||
Accepted coverage for new contributions is 80%. Any contribution not satisfying this requirement
|
||||
won't be merged.
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# Package Versions
|
||||
|
||||
**`composer/package-versions-deprecated` is a fully-compatible fork of [`ocramius/package-versions`](https://github.com/Ocramius/PackageVersions)** which provides compatibility with Composer 1 and 2 on PHP 7+. It replaces ocramius/package-versions so if you have a dependency requiring it and you want to use Composer v2 but can not upgrade to PHP 7.4 just yet, you can require this package instead.
|
||||
|
||||
If you have a **direct** dependency on `ocramius/package-versions`, we recommend that once you migrated to Composer 2.x you also migrate to use the [`Composer\InstalledVersions`](https://getcomposer.org/doc/07-runtime.md#installed-versions) class which offers the functionality present here out of the box. You can then remove the require on this package.
|
||||
|
||||
This package is EOL / deprecated and you should aim to migrate away from it as soon as possible!
|
||||
@@ -1,5 +0,0 @@
|
||||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the
|
||||
[Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure.
|
||||
@@ -1,48 +0,0 @@
|
||||
{
|
||||
"name": "composer/package-versions-deprecated",
|
||||
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
|
||||
"type": "composer-plugin",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7 || ^8",
|
||||
"composer-plugin-api": "^1.1.0 || ^2.0"
|
||||
},
|
||||
"replace": {
|
||||
"ocramius/package-versions": "1.11.99"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6.5 || ^7",
|
||||
"composer/composer": "^1.9.3 || ^2.0@dev",
|
||||
"ext-zip": "^1.13"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PackageVersions\\": "src/PackageVersions"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"PackageVersionsTest\\": "test/PackageVersionsTest"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"class": "PackageVersions\\Installer",
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-update-cmd": "PackageVersions\\Installer::dumpVersionsClass",
|
||||
"post-install-cmd": "PackageVersions\\Installer::dumpVersionsClass"
|
||||
}
|
||||
}
|
||||
2603
vendor/composer/package-versions-deprecated/composer.lock
generated
vendored
2603
vendor/composer/package-versions-deprecated/composer.lock
generated
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,128 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PackageVersions;
|
||||
|
||||
use Generator;
|
||||
use OutOfBoundsException;
|
||||
use UnexpectedValueException;
|
||||
use function array_key_exists;
|
||||
use function array_merge;
|
||||
use function basename;
|
||||
use function file_exists;
|
||||
use function file_get_contents;
|
||||
use function getcwd;
|
||||
use function iterator_to_array;
|
||||
use function json_decode;
|
||||
use function json_encode;
|
||||
use function sprintf;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* This is a fallback for {@see \PackageVersions\Versions::getVersion()}
|
||||
* Do not use this class directly: it is intended to be only used when
|
||||
* {@see \PackageVersions\Versions} fails to be generated, which typically
|
||||
* happens when running composer with `--no-scripts` flag)
|
||||
*/
|
||||
final class FallbackVersions
|
||||
{
|
||||
const ROOT_PACKAGE_NAME = 'unknown/root-package@UNKNOWN';
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws OutOfBoundsException If a version cannot be located.
|
||||
* @throws UnexpectedValueException If the composer.lock file could not be located.
|
||||
*/
|
||||
public static function getVersion(string $packageName): string
|
||||
{
|
||||
$versions = iterator_to_array(self::getVersions(self::getPackageData()));
|
||||
|
||||
if (! array_key_exists($packageName, $versions)) {
|
||||
throw new OutOfBoundsException(
|
||||
'Required package "' . $packageName . '" is not installed: check your ./vendor/composer/installed.json and/or ./composer.lock files'
|
||||
);
|
||||
}
|
||||
|
||||
return $versions[$packageName];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed[]
|
||||
*
|
||||
* @throws UnexpectedValueException
|
||||
*/
|
||||
private static function getPackageData(): array
|
||||
{
|
||||
$checkedPaths = [
|
||||
// The top-level project's ./vendor/composer/installed.json
|
||||
getcwd() . '/vendor/composer/installed.json',
|
||||
__DIR__ . '/../../../../composer/installed.json',
|
||||
// The top-level project's ./composer.lock
|
||||
getcwd() . '/composer.lock',
|
||||
__DIR__ . '/../../../../../composer.lock',
|
||||
// This package's composer.lock
|
||||
__DIR__ . '/../../composer.lock',
|
||||
];
|
||||
|
||||
$packageData = [];
|
||||
foreach ($checkedPaths as $path) {
|
||||
if (! file_exists($path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data = json_decode(file_get_contents($path), true);
|
||||
switch (basename($path)) {
|
||||
case 'installed.json':
|
||||
// composer 2.x installed.json format
|
||||
if (isset($data['packages'])) {
|
||||
$packageData[] = $data['packages'];
|
||||
} else {
|
||||
// composer 1.x installed.json format
|
||||
$packageData[] = $data;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'composer.lock':
|
||||
$packageData[] = $data['packages'] + ($data['packages-dev'] ?? []);
|
||||
break;
|
||||
default:
|
||||
// intentionally left blank
|
||||
}
|
||||
}
|
||||
|
||||
if ($packageData !== []) {
|
||||
return array_merge(...$packageData);
|
||||
}
|
||||
|
||||
throw new UnexpectedValueException(sprintf(
|
||||
'PackageVersions could not locate the `vendor/composer/installed.json` or your `composer.lock` '
|
||||
. 'location. This is assumed to be in %s. If you customized your composer vendor directory and ran composer '
|
||||
. 'installation with --no-scripts, or if you deployed without the required composer files, PackageVersions '
|
||||
. 'can\'t detect installed versions.',
|
||||
json_encode($checkedPaths)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed[] $packageData
|
||||
*
|
||||
* @return Generator&string[]
|
||||
*
|
||||
* @psalm-return Generator<string, string>
|
||||
*/
|
||||
private static function getVersions(array $packageData): Generator
|
||||
{
|
||||
foreach ($packageData as $package) {
|
||||
yield $package['name'] => $package['version'] . '@' . (
|
||||
$package['source']['reference'] ?? $package['dist']['reference'] ?? ''
|
||||
);
|
||||
}
|
||||
|
||||
yield self::ROOT_PACKAGE_NAME => self::ROOT_PACKAGE_NAME;
|
||||
}
|
||||
}
|
||||
@@ -1,290 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PackageVersions;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\Config;
|
||||
use Composer\EventDispatcher\EventSubscriberInterface;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Package\AliasPackage;
|
||||
use Composer\Package\Locker;
|
||||
use Composer\Package\PackageInterface;
|
||||
use Composer\Package\RootPackageInterface;
|
||||
use Composer\Plugin\PluginInterface;
|
||||
use Composer\Script\Event;
|
||||
use Composer\Script\ScriptEvents;
|
||||
use Generator;
|
||||
use RuntimeException;
|
||||
|
||||
use function array_key_exists;
|
||||
use function array_merge;
|
||||
use function chmod;
|
||||
use function dirname;
|
||||
use function file_exists;
|
||||
use function file_put_contents;
|
||||
use function is_writable;
|
||||
use function iterator_to_array;
|
||||
use function rename;
|
||||
use function sprintf;
|
||||
use function uniqid;
|
||||
use function var_export;
|
||||
|
||||
final class Installer implements PluginInterface, EventSubscriberInterface
|
||||
{
|
||||
private static $generatedClassTemplate = <<<'PHP'
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PackageVersions;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use OutOfBoundsException;
|
||||
|
||||
class_exists(InstalledVersions::class);
|
||||
|
||||
/**
|
||||
* This class is generated by composer/package-versions-deprecated, specifically by
|
||||
* @see \PackageVersions\Installer
|
||||
*
|
||||
* This file is overwritten at every run of `composer install` or `composer update`.
|
||||
*
|
||||
* @deprecated in favor of the Composer\InstalledVersions class provided by Composer 2. Require composer-runtime-api:^2 to ensure it is present.
|
||||
*/
|
||||
%s
|
||||
{
|
||||
/**
|
||||
* @deprecated please use {@see self::rootPackageName()} instead.
|
||||
* This constant will be removed in version 2.0.0.
|
||||
*/
|
||||
const ROOT_PACKAGE_NAME = '%s';
|
||||
|
||||
/**
|
||||
* Array of all available composer packages.
|
||||
* Dont read this array from your calling code, but use the \PackageVersions\Versions::getVersion() method instead.
|
||||
*
|
||||
* @var array<string, string>
|
||||
* @internal
|
||||
*/
|
||||
const VERSIONS = %s;
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-pure
|
||||
*
|
||||
* @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not
|
||||
* cause any side effects here.
|
||||
*/
|
||||
public static function rootPackageName() : string
|
||||
{
|
||||
if (!self::composer2ApiUsable()) {
|
||||
return self::ROOT_PACKAGE_NAME;
|
||||
}
|
||||
|
||||
return InstalledVersions::getRootPackage()['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws OutOfBoundsException If a version cannot be located.
|
||||
*
|
||||
* @psalm-param key-of<self::VERSIONS> $packageName
|
||||
* @psalm-pure
|
||||
*
|
||||
* @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not
|
||||
* cause any side effects here.
|
||||
*/
|
||||
public static function getVersion(string $packageName): string
|
||||
{
|
||||
if (self::composer2ApiUsable()) {
|
||||
return InstalledVersions::getPrettyVersion($packageName)
|
||||
. '@' . InstalledVersions::getReference($packageName);
|
||||
}
|
||||
|
||||
if (isset(self::VERSIONS[$packageName])) {
|
||||
return self::VERSIONS[$packageName];
|
||||
}
|
||||
|
||||
throw new OutOfBoundsException(
|
||||
'Required package "' . $packageName . '" is not installed: check your ./vendor/composer/installed.json and/or ./composer.lock files'
|
||||
);
|
||||
}
|
||||
|
||||
private static function composer2ApiUsable(): bool
|
||||
{
|
||||
if (!class_exists(InstalledVersions::class, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (method_exists(InstalledVersions::class, 'getAllRawData')) {
|
||||
$rawData = InstalledVersions::getAllRawData();
|
||||
if (count($rawData) === 1 && count($rawData[0]) === 0) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$rawData = InstalledVersions::getRawData();
|
||||
if ($rawData === null || $rawData === []) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
PHP;
|
||||
|
||||
public function activate(Composer $composer, IOInterface $io)
|
||||
{
|
||||
// Nothing to do here, as all features are provided through event listeners
|
||||
}
|
||||
|
||||
public function deactivate(Composer $composer, IOInterface $io)
|
||||
{
|
||||
// Nothing to do here, as all features are provided through event listeners
|
||||
}
|
||||
|
||||
public function uninstall(Composer $composer, IOInterface $io)
|
||||
{
|
||||
// Nothing to do here, as all features are provided through event listeners
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [ScriptEvents::POST_AUTOLOAD_DUMP => 'dumpVersionsClass'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public static function dumpVersionsClass(Event $composerEvent)
|
||||
{
|
||||
$composer = $composerEvent->getComposer();
|
||||
$rootPackage = $composer->getPackage();
|
||||
$versions = iterator_to_array(self::getVersions($composer->getLocker(), $rootPackage));
|
||||
|
||||
if (! array_key_exists('composer/package-versions-deprecated', $versions)) {
|
||||
//plugin must be globally installed - we only want to generate versions for projects which specifically
|
||||
//require composer/package-versions-deprecated
|
||||
return;
|
||||
}
|
||||
|
||||
$versionClass = self::generateVersionsClass($rootPackage->getName(), $versions);
|
||||
|
||||
self::writeVersionClassToFile($versionClass, $composer, $composerEvent->getIO());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $versions
|
||||
*/
|
||||
private static function generateVersionsClass(string $rootPackageName, array $versions): string
|
||||
{
|
||||
return sprintf(
|
||||
self::$generatedClassTemplate,
|
||||
'fin' . 'al ' . 'cla' . 'ss ' . 'Versions', // note: workaround for regex-based code parsers :-(
|
||||
$rootPackageName,
|
||||
var_export($versions, true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
private static function writeVersionClassToFile(string $versionClassSource, Composer $composer, IOInterface $io)
|
||||
{
|
||||
$installPath = self::locateRootPackageInstallPath($composer->getConfig(), $composer->getPackage())
|
||||
. '/src/PackageVersions/Versions.php';
|
||||
|
||||
$installDir = dirname($installPath);
|
||||
if (! file_exists($installDir)) {
|
||||
$io->write('<info>composer/package-versions-deprecated:</info> Package not found (probably scheduled for removal); generation of version class skipped.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (! is_writable($installDir)) {
|
||||
$io->write(
|
||||
sprintf(
|
||||
'<info>composer/package-versions-deprecated:</info> %s is not writable; generation of version class skipped.',
|
||||
$installDir
|
||||
)
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$io->write('<info>composer/package-versions-deprecated:</info> Generating version class...');
|
||||
|
||||
$installPathTmp = $installPath . '_' . uniqid('tmp', true);
|
||||
file_put_contents($installPathTmp, $versionClassSource);
|
||||
chmod($installPathTmp, 0664);
|
||||
rename($installPathTmp, $installPath);
|
||||
|
||||
$io->write('<info>composer/package-versions-deprecated:</info> ...done generating version class');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
private static function locateRootPackageInstallPath(
|
||||
Config $composerConfig,
|
||||
RootPackageInterface $rootPackage
|
||||
): string {
|
||||
if (self::getRootPackageAlias($rootPackage)->getName() === 'composer/package-versions-deprecated') {
|
||||
return dirname($composerConfig->get('vendor-dir'));
|
||||
}
|
||||
|
||||
return $composerConfig->get('vendor-dir') . '/composer/package-versions-deprecated';
|
||||
}
|
||||
|
||||
private static function getRootPackageAlias(RootPackageInterface $rootPackage): PackageInterface
|
||||
{
|
||||
$package = $rootPackage;
|
||||
|
||||
while ($package instanceof AliasPackage) {
|
||||
$package = $package->getAliasOf();
|
||||
}
|
||||
|
||||
return $package;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Generator&string[]
|
||||
*
|
||||
* @psalm-return Generator<string, string>
|
||||
*/
|
||||
private static function getVersions(Locker $locker, RootPackageInterface $rootPackage): Generator
|
||||
{
|
||||
$lockData = $locker->getLockData();
|
||||
|
||||
$lockData['packages-dev'] = $lockData['packages-dev'] ?? [];
|
||||
|
||||
$packages = $lockData['packages'];
|
||||
if (getenv('COMPOSER_DEV_MODE') !== '0') {
|
||||
$packages = array_merge($packages, $lockData['packages-dev']);
|
||||
}
|
||||
foreach ($packages as $package) {
|
||||
yield $package['name'] => $package['version'] . '@' . (
|
||||
$package['source']['reference'] ?? $package['dist']['reference'] ?? ''
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($rootPackage->getReplaces() as $replace) {
|
||||
$version = $replace->getPrettyConstraint();
|
||||
if ($version === 'self.version') {
|
||||
$version = $rootPackage->getPrettyVersion();
|
||||
}
|
||||
|
||||
yield $replace->getTarget() => $version . '@' . $rootPackage->getSourceReference();
|
||||
}
|
||||
|
||||
yield $rootPackage->getName() => $rootPackage->getPrettyVersion() . '@' . $rootPackage->getSourceReference();
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PackageVersions;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use OutOfBoundsException;
|
||||
use UnexpectedValueException;
|
||||
|
||||
class_exists(InstalledVersions::class);
|
||||
|
||||
/**
|
||||
* This is a stub class: it is in place only for scenarios where PackageVersions
|
||||
* is installed with a `--no-scripts` flag, in which scenarios the Versions class
|
||||
* is not being replaced.
|
||||
*
|
||||
* If you are reading this docBlock inside your `vendor/` dir, then this means
|
||||
* that PackageVersions didn't correctly install, and is in "fallback" mode.
|
||||
*
|
||||
* @deprecated in favor of the Composer\InstalledVersions class provided by Composer 2. Require composer-runtime-api:^2 to ensure it is present.
|
||||
*/
|
||||
final class Versions
|
||||
{
|
||||
/**
|
||||
* @deprecated please use {@see self::rootPackageName()} instead.
|
||||
* This constant will be removed in version 2.0.0.
|
||||
*/
|
||||
const ROOT_PACKAGE_NAME = 'unknown/root-package@UNKNOWN';
|
||||
|
||||
/** @internal */
|
||||
const VERSIONS = [];
|
||||
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-pure
|
||||
*
|
||||
* @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not
|
||||
* cause any side effects here.
|
||||
*/
|
||||
public static function rootPackageName() : string
|
||||
{
|
||||
if (!class_exists(InstalledVersions::class, false) || !InstalledVersions::getRawData()) {
|
||||
return self::ROOT_PACKAGE_NAME;
|
||||
}
|
||||
|
||||
return InstalledVersions::getRootPackage()['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws OutOfBoundsException if a version cannot be located.
|
||||
* @throws UnexpectedValueException if the composer.lock file could not be located.
|
||||
*/
|
||||
public static function getVersion(string $packageName): string
|
||||
{
|
||||
if (!self::composer2ApiUsable()) {
|
||||
return FallbackVersions::getVersion($packageName);
|
||||
}
|
||||
|
||||
/** @psalm-suppress DeprecatedConstant */
|
||||
if ($packageName === self::ROOT_PACKAGE_NAME) {
|
||||
$rootPackage = InstalledVersions::getRootPackage();
|
||||
|
||||
return $rootPackage['pretty_version'] . '@' . $rootPackage['reference'];
|
||||
}
|
||||
|
||||
return InstalledVersions::getPrettyVersion($packageName)
|
||||
. '@' . InstalledVersions::getReference($packageName);
|
||||
}
|
||||
|
||||
private static function composer2ApiUsable(): bool
|
||||
{
|
||||
if (!class_exists(InstalledVersions::class, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (method_exists(InstalledVersions::class, 'getAllRawData')) {
|
||||
$rawData = InstalledVersions::getAllRawData();
|
||||
if (count($rawData) === 1 && count($rawData[0]) === 0) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$rawData = InstalledVersions::getRawData();
|
||||
if ($rawData === null || $rawData === []) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2016 Marco Pivetta
|
||||
Copyright (c) 2020-2021 Doctrine Project
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
154
vendor/doctrine/deprecations/README.md
vendored
Normal file
154
vendor/doctrine/deprecations/README.md
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
# Doctrine Deprecations
|
||||
|
||||
A small (side-effect free by default) layer on top of
|
||||
`trigger_error(E_USER_DEPRECATED)` or PSR-3 logging.
|
||||
|
||||
- no side-effects by default, making it a perfect fit for libraries that don't know how the error handler works they operate under
|
||||
- options to avoid having to rely on error handlers global state by using PSR-3 logging
|
||||
- deduplicate deprecation messages to avoid excessive triggering and reduce overhead
|
||||
|
||||
We recommend to collect Deprecations using a PSR logger instead of relying on
|
||||
the global error handler.
|
||||
|
||||
## Usage from consumer perspective:
|
||||
|
||||
Enable Doctrine deprecations to be sent to a PSR3 logger:
|
||||
|
||||
```php
|
||||
\Doctrine\Deprecations\Deprecation::enableWithPsrLogger($logger);
|
||||
```
|
||||
|
||||
Enable Doctrine deprecations to be sent as `@trigger_error($message, E_USER_DEPRECATED)`
|
||||
messages.
|
||||
|
||||
```php
|
||||
\Doctrine\Deprecations\Deprecation::enableWithTriggerError();
|
||||
```
|
||||
|
||||
If you only want to enable deprecation tracking, without logging or calling `trigger_error` then call:
|
||||
|
||||
```php
|
||||
\Doctrine\Deprecations\Deprecation::enableTrackingDeprecations();
|
||||
```
|
||||
|
||||
Tracking is enabled with all three modes and provides access to all triggered
|
||||
deprecations and their individual count:
|
||||
|
||||
```php
|
||||
$deprecations = \Doctrine\Deprecations\Deprecation::getTriggeredDeprecations();
|
||||
|
||||
foreach ($deprecations as $identifier => $count) {
|
||||
echo $identifier . " was triggered " . $count . " times\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Suppressing Specific Deprecations
|
||||
|
||||
Disable triggering about specific deprecations:
|
||||
|
||||
```php
|
||||
\Doctrine\Deprecations\Deprecation::ignoreDeprecations("https://link/to/deprecations-description-identifier");
|
||||
```
|
||||
|
||||
Disable all deprecations from a package
|
||||
|
||||
```php
|
||||
\Doctrine\Deprecations\Deprecation::ignorePackage("doctrine/orm");
|
||||
```
|
||||
|
||||
### Other Operations
|
||||
|
||||
When used within PHPUnit or other tools that could collect multiple instances of the same deprecations
|
||||
the deduplication can be disabled:
|
||||
|
||||
```php
|
||||
\Doctrine\Deprecations\Deprecation::withoutDeduplication();
|
||||
```
|
||||
|
||||
Disable deprecation tracking again:
|
||||
|
||||
```php
|
||||
\Doctrine\Deprecations\Deprecation::disable();
|
||||
```
|
||||
|
||||
## Usage from a library/producer perspective:
|
||||
|
||||
When you want to unconditionally trigger a deprecation even when called
|
||||
from the library itself then the `trigger` method is the way to go:
|
||||
|
||||
```php
|
||||
\Doctrine\Deprecations\Deprecation::trigger(
|
||||
"doctrine/orm",
|
||||
"https://link/to/deprecations-description",
|
||||
"message"
|
||||
);
|
||||
```
|
||||
|
||||
If variable arguments are provided at the end, they are used with `sprintf` on
|
||||
the message.
|
||||
|
||||
```php
|
||||
\Doctrine\Deprecations\Deprecation::trigger(
|
||||
"doctrine/orm",
|
||||
"https://github.com/doctrine/orm/issue/1234",
|
||||
"message %s %d",
|
||||
"foo",
|
||||
1234
|
||||
);
|
||||
```
|
||||
|
||||
When you want to trigger a deprecation only when it is called by a function
|
||||
outside of the current package, but not trigger when the package itself is the cause,
|
||||
then use:
|
||||
|
||||
```php
|
||||
\Doctrine\Deprecations\Deprecation::triggerIfCalledFromOutside(
|
||||
"doctrine/orm",
|
||||
"https://link/to/deprecations-description",
|
||||
"message"
|
||||
);
|
||||
```
|
||||
|
||||
Based on the issue link each deprecation message is only triggered once per
|
||||
request.
|
||||
|
||||
A limited stacktrace is included in the deprecation message to find the
|
||||
offending location.
|
||||
|
||||
Note: A producer/library should never call `Deprecation::enableWith` methods
|
||||
and leave the decision how to handle deprecations to application and
|
||||
frameworks.
|
||||
|
||||
## Usage in PHPUnit tests
|
||||
|
||||
There is a `VerifyDeprecations` trait that you can use to make assertions on
|
||||
the occurrence of deprecations within a test.
|
||||
|
||||
```php
|
||||
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
|
||||
|
||||
class MyTest extends TestCase
|
||||
{
|
||||
use VerifyDeprecations;
|
||||
|
||||
public function testSomethingDeprecation()
|
||||
{
|
||||
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234');
|
||||
|
||||
triggerTheCodeWithDeprecation();
|
||||
}
|
||||
|
||||
public function testSomethingDeprecationFixed()
|
||||
{
|
||||
$this->expectNoDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234');
|
||||
|
||||
triggerTheCodeWithoutDeprecation();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## What is a deprecation identifier?
|
||||
|
||||
An identifier for deprecations is just a link to any resource, most often a
|
||||
Github Issue or Pull Request explaining the deprecation and potentially its
|
||||
alternative.
|
||||
32
vendor/doctrine/deprecations/composer.json
vendored
Normal file
32
vendor/doctrine/deprecations/composer.json
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "doctrine/deprecations",
|
||||
"type": "library",
|
||||
"description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.",
|
||||
"homepage": "https://www.doctrine-project.org/",
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.1|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7.5|^8.5|^9.5",
|
||||
"psr/log": "^1|^2|^3",
|
||||
"doctrine/coding-standard": "^9"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {"Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations"}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"DeprecationTests\\": "test_fixtures/src",
|
||||
"Doctrine\\Foo\\": "test_fixtures/vendor/doctrine/foo"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
266
vendor/doctrine/deprecations/lib/Doctrine/Deprecations/Deprecation.php
vendored
Normal file
266
vendor/doctrine/deprecations/lib/Doctrine/Deprecations/Deprecation.php
vendored
Normal file
@@ -0,0 +1,266 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\Deprecations;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
use function array_reduce;
|
||||
use function debug_backtrace;
|
||||
use function sprintf;
|
||||
use function strpos;
|
||||
use function strrpos;
|
||||
use function substr;
|
||||
use function trigger_error;
|
||||
|
||||
use const DEBUG_BACKTRACE_IGNORE_ARGS;
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
use const E_USER_DEPRECATED;
|
||||
|
||||
/**
|
||||
* Manages Deprecation logging in different ways.
|
||||
*
|
||||
* By default triggered exceptions are not logged.
|
||||
*
|
||||
* To enable different deprecation logging mechanisms you can call the
|
||||
* following methods:
|
||||
*
|
||||
* - Minimal collection of deprecations via getTriggeredDeprecations()
|
||||
* \Doctrine\Deprecations\Deprecation::enableTrackingDeprecations();
|
||||
*
|
||||
* - Uses @trigger_error with E_USER_DEPRECATED
|
||||
* \Doctrine\Deprecations\Deprecation::enableWithTriggerError();
|
||||
*
|
||||
* - Sends deprecation messages via a PSR-3 logger
|
||||
* \Doctrine\Deprecations\Deprecation::enableWithPsrLogger($logger);
|
||||
*
|
||||
* Packages that trigger deprecations should use the `trigger()` or
|
||||
* `triggerIfCalledFromOutside()` methods.
|
||||
*/
|
||||
class Deprecation
|
||||
{
|
||||
private const TYPE_NONE = 0;
|
||||
private const TYPE_TRACK_DEPRECATIONS = 1;
|
||||
private const TYPE_TRIGGER_ERROR = 2;
|
||||
private const TYPE_PSR_LOGGER = 4;
|
||||
|
||||
/** @var int */
|
||||
private static $type = self::TYPE_NONE;
|
||||
|
||||
/** @var LoggerInterface|null */
|
||||
private static $logger;
|
||||
|
||||
/** @var array<string,bool> */
|
||||
private static $ignoredPackages = [];
|
||||
|
||||
/** @var array<string,int> */
|
||||
private static $ignoredLinks = [];
|
||||
|
||||
/** @var bool */
|
||||
private static $deduplication = true;
|
||||
|
||||
/**
|
||||
* Trigger a deprecation for the given package and identfier.
|
||||
*
|
||||
* The link should point to a Github issue or Wiki entry detailing the
|
||||
* deprecation. It is additionally used to de-duplicate the trigger of the
|
||||
* same deprecation during a request.
|
||||
*
|
||||
* @param mixed $args
|
||||
*/
|
||||
public static function trigger(string $package, string $link, string $message, ...$args): void
|
||||
{
|
||||
if (self::$type === self::TYPE_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (array_key_exists($link, self::$ignoredLinks)) {
|
||||
self::$ignoredLinks[$link]++;
|
||||
} else {
|
||||
self::$ignoredLinks[$link] = 1;
|
||||
}
|
||||
|
||||
if (self::$deduplication === true && self::$ignoredLinks[$link] > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset(self::$ignoredPackages[$package])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
|
||||
|
||||
$message = sprintf($message, ...$args);
|
||||
|
||||
self::delegateTriggerToBackend($message, $backtrace, $link, $package);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger a deprecation for the given package and identifier when called from outside.
|
||||
*
|
||||
* "Outside" means we assume that $package is currently installed as a
|
||||
* dependency and the caller is not a file in that package. When $package
|
||||
* is installed as a root package then deprecations triggered from the
|
||||
* tests folder are also considered "outside".
|
||||
*
|
||||
* This deprecation method assumes that you are using Composer to install
|
||||
* the dependency and are using the default /vendor/ folder and not a
|
||||
* Composer plugin to change the install location. The assumption is also
|
||||
* that $package is the exact composer packge name.
|
||||
*
|
||||
* Compared to {@link trigger()} this method causes some overhead when
|
||||
* deprecation tracking is enabled even during deduplication, because it
|
||||
* needs to call {@link debug_backtrace()}
|
||||
*
|
||||
* @param mixed $args
|
||||
*/
|
||||
public static function triggerIfCalledFromOutside(string $package, string $link, string $message, ...$args): void
|
||||
{
|
||||
if (self::$type === self::TYPE_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
|
||||
|
||||
// first check that the caller is not from a tests folder, in which case we always let deprecations pass
|
||||
if (strpos($backtrace[1]['file'], DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR) === false) {
|
||||
$path = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR;
|
||||
|
||||
if (strpos($backtrace[0]['file'], $path) === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (strpos($backtrace[1]['file'], $path) !== false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists($link, self::$ignoredLinks)) {
|
||||
self::$ignoredLinks[$link]++;
|
||||
} else {
|
||||
self::$ignoredLinks[$link] = 1;
|
||||
}
|
||||
|
||||
if (self::$deduplication === true && self::$ignoredLinks[$link] > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset(self::$ignoredPackages[$package])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$message = sprintf($message, ...$args);
|
||||
|
||||
self::delegateTriggerToBackend($message, $backtrace, $link, $package);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<mixed> $backtrace
|
||||
*/
|
||||
private static function delegateTriggerToBackend(string $message, array $backtrace, string $link, string $package): void
|
||||
{
|
||||
if ((self::$type & self::TYPE_PSR_LOGGER) > 0) {
|
||||
$context = [
|
||||
'file' => $backtrace[0]['file'],
|
||||
'line' => $backtrace[0]['line'],
|
||||
'package' => $package,
|
||||
'link' => $link,
|
||||
];
|
||||
|
||||
self::$logger->notice($message, $context);
|
||||
}
|
||||
|
||||
if (! ((self::$type & self::TYPE_TRIGGER_ERROR) > 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$message .= sprintf(
|
||||
' (%s:%d called by %s:%d, %s, package %s)',
|
||||
self::basename($backtrace[0]['file']),
|
||||
$backtrace[0]['line'],
|
||||
self::basename($backtrace[1]['file']),
|
||||
$backtrace[1]['line'],
|
||||
$link,
|
||||
$package
|
||||
);
|
||||
|
||||
@trigger_error($message, E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
/**
|
||||
* A non-local-aware version of PHPs basename function.
|
||||
*/
|
||||
private static function basename(string $filename): string
|
||||
{
|
||||
$pos = strrpos($filename, DIRECTORY_SEPARATOR);
|
||||
|
||||
if ($pos === false) {
|
||||
return $filename;
|
||||
}
|
||||
|
||||
return substr($filename, $pos + 1);
|
||||
}
|
||||
|
||||
public static function enableTrackingDeprecations(): void
|
||||
{
|
||||
self::$type |= self::TYPE_TRACK_DEPRECATIONS;
|
||||
}
|
||||
|
||||
public static function enableWithTriggerError(): void
|
||||
{
|
||||
self::$type |= self::TYPE_TRIGGER_ERROR;
|
||||
}
|
||||
|
||||
public static function enableWithPsrLogger(LoggerInterface $logger): void
|
||||
{
|
||||
self::$type |= self::TYPE_PSR_LOGGER;
|
||||
self::$logger = $logger;
|
||||
}
|
||||
|
||||
public static function withoutDeduplication(): void
|
||||
{
|
||||
self::$deduplication = false;
|
||||
}
|
||||
|
||||
public static function disable(): void
|
||||
{
|
||||
self::$type = self::TYPE_NONE;
|
||||
self::$logger = null;
|
||||
self::$deduplication = true;
|
||||
|
||||
foreach (self::$ignoredLinks as $link => $count) {
|
||||
self::$ignoredLinks[$link] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static function ignorePackage(string $packageName): void
|
||||
{
|
||||
self::$ignoredPackages[$packageName] = true;
|
||||
}
|
||||
|
||||
public static function ignoreDeprecations(string ...$links): void
|
||||
{
|
||||
foreach ($links as $link) {
|
||||
self::$ignoredLinks[$link] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getUniqueTriggeredDeprecationsCount(): int
|
||||
{
|
||||
return array_reduce(self::$ignoredLinks, static function (int $carry, int $count) {
|
||||
return $carry + $count;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns each triggered deprecation link identifier and the amount of occurrences.
|
||||
*
|
||||
* @return array<string,int>
|
||||
*/
|
||||
public static function getTriggeredDeprecations(): array
|
||||
{
|
||||
return self::$ignoredLinks;
|
||||
}
|
||||
}
|
||||
66
vendor/doctrine/deprecations/lib/Doctrine/Deprecations/PHPUnit/VerifyDeprecations.php
vendored
Normal file
66
vendor/doctrine/deprecations/lib/Doctrine/Deprecations/PHPUnit/VerifyDeprecations.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Doctrine\Deprecations\PHPUnit;
|
||||
|
||||
use Doctrine\Deprecations\Deprecation;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
trait VerifyDeprecations
|
||||
{
|
||||
/** @var array<string,int> */
|
||||
private $doctrineDeprecationsExpectations = [];
|
||||
|
||||
/** @var array<string,int> */
|
||||
private $doctrineNoDeprecationsExpectations = [];
|
||||
|
||||
public function expectDeprecationWithIdentifier(string $identifier): void
|
||||
{
|
||||
$this->doctrineDeprecationsExpectations[$identifier] = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0;
|
||||
}
|
||||
|
||||
public function expectNoDeprecationWithIdentifier(string $identifier): void
|
||||
{
|
||||
$this->doctrineNoDeprecationsExpectations[$identifier] = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @before
|
||||
*/
|
||||
public function enableDeprecationTracking(): void
|
||||
{
|
||||
Deprecation::enableTrackingDeprecations();
|
||||
}
|
||||
|
||||
/**
|
||||
* @after
|
||||
*/
|
||||
public function verifyDeprecationsAreTriggered(): void
|
||||
{
|
||||
foreach ($this->doctrineDeprecationsExpectations as $identifier => $expectation) {
|
||||
$actualCount = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0;
|
||||
|
||||
$this->assertTrue(
|
||||
$actualCount > $expectation,
|
||||
sprintf(
|
||||
"Expected deprecation with identifier '%s' was not triggered by code executed in test.",
|
||||
$identifier
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($this->doctrineNoDeprecationsExpectations as $identifier => $expectation) {
|
||||
$actualCount = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0;
|
||||
|
||||
$this->assertTrue(
|
||||
$actualCount === $expectation,
|
||||
sprintf(
|
||||
"Expected deprecation with identifier '%s' was triggered by code executed in test, but expected not to.",
|
||||
$identifier
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
vendor/doctrine/deprecations/phpcs.xml
vendored
Normal file
22
vendor/doctrine/deprecations/phpcs.xml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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"/>
|
||||
|
||||
<config name="php_version" value="70100"/>
|
||||
|
||||
<!-- Directories to be checked -->
|
||||
<file>lib</file>
|
||||
<file>tests</file>
|
||||
|
||||
<!-- Include full Doctrine Coding Standard -->
|
||||
<rule ref="Doctrine">
|
||||
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint" />
|
||||
</rule>
|
||||
</ruleset>
|
||||
@@ -1,65 +0,0 @@
|
||||
extends: "default"
|
||||
|
||||
ignore: |
|
||||
.build/
|
||||
.notes/
|
||||
vendor/
|
||||
rules:
|
||||
braces:
|
||||
max-spaces-inside-empty: 0
|
||||
max-spaces-inside: 1
|
||||
min-spaces-inside-empty: 0
|
||||
min-spaces-inside: 1
|
||||
brackets:
|
||||
max-spaces-inside-empty: 0
|
||||
max-spaces-inside: 0
|
||||
min-spaces-inside-empty: 0
|
||||
min-spaces-inside: 0
|
||||
colons:
|
||||
max-spaces-after: 1
|
||||
max-spaces-before: 0
|
||||
commas:
|
||||
max-spaces-after: 1
|
||||
max-spaces-before: 0
|
||||
min-spaces-after: 1
|
||||
comments:
|
||||
ignore-shebangs: true
|
||||
min-spaces-from-content: 1
|
||||
require-starting-space: true
|
||||
comments-indentation: "enable"
|
||||
document-end:
|
||||
present: false
|
||||
document-start:
|
||||
present: false
|
||||
indentation:
|
||||
check-multi-line-strings: false
|
||||
indent-sequences: true
|
||||
spaces: 2
|
||||
empty-lines:
|
||||
max-end: 0
|
||||
max-start: 0
|
||||
max: 1
|
||||
empty-values:
|
||||
forbid-in-block-mappings: true
|
||||
forbid-in-flow-mappings: true
|
||||
hyphens:
|
||||
max-spaces-after: 2
|
||||
key-duplicates: "enable"
|
||||
key-ordering: "disable"
|
||||
line-length: "disable"
|
||||
new-line-at-end-of-file: "enable"
|
||||
new-lines:
|
||||
type: "unix"
|
||||
octal-values:
|
||||
forbid-implicit-octal: true
|
||||
quoted-strings:
|
||||
quote-type: "double"
|
||||
trailing-spaces: "enable"
|
||||
truthy:
|
||||
allowed-values:
|
||||
- "false"
|
||||
- "true"
|
||||
|
||||
yaml-files:
|
||||
- "*.yaml"
|
||||
- "*.yml"
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"symbol-whitelist" : [
|
||||
"null", "true", "false",
|
||||
"static", "self", "parent",
|
||||
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "XSLTProcessor",
|
||||
"T_NAME_QUALIFIED", "T_NAME_FULLY_QUALIFIED"
|
||||
],
|
||||
"php-core-extensions" : [
|
||||
"Core",
|
||||
"pcre",
|
||||
"Reflection",
|
||||
"tokenizer",
|
||||
"SPL",
|
||||
"standard"
|
||||
]
|
||||
}
|
||||
@@ -11,7 +11,9 @@
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"phpdocumentor/reflection-common": "^2.0"
|
||||
"phpdocumentor/reflection-common": "^2.0",
|
||||
"phpstan/phpdoc-parser": "^1.13",
|
||||
"doctrine/deprecations": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-tokenizer": "*",
|
||||
@@ -20,7 +22,8 @@
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"vimeo/psalm": "^4.25",
|
||||
"rector/rector": "^0.13.9"
|
||||
"rector/rector": "^0.13.9",
|
||||
"phpbench/phpbench": "^1.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
26
vendor/phpdocumentor/type-resolver/rector.php
vendored
26
vendor/phpdocumentor/type-resolver/rector.php
vendored
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
|
||||
return static function (RectorConfig $rectorConfig): void {
|
||||
$rectorConfig->paths([
|
||||
__DIR__ . '/src',
|
||||
__DIR__ . '/tests/unit'
|
||||
]);
|
||||
|
||||
// register a single rule
|
||||
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
|
||||
$rectorConfig->rule(Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class);
|
||||
$rectorConfig->rule(Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector::class);
|
||||
$rectorConfig->rule(Rector\PHPUnit\Rector\Class_\AddProphecyTraitRector::class);
|
||||
$rectorConfig->importNames();
|
||||
|
||||
// define sets of rules
|
||||
$rectorConfig->sets([
|
||||
LevelSetList::UP_TO_PHP_74
|
||||
]);
|
||||
};
|
||||
44
vendor/phpdocumentor/type-resolver/src/PseudoTypes/ArrayShape.php
vendored
Normal file
44
vendor/phpdocumentor/type-resolver/src/PseudoTypes/ArrayShape.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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.
|
||||
*
|
||||
* @link http://phpdoc.org
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpDocumentor\Reflection\PseudoTypes;
|
||||
|
||||
use phpDocumentor\Reflection\PseudoType;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\Types\Array_;
|
||||
use phpDocumentor\Reflection\Types\ArrayKey;
|
||||
use phpDocumentor\Reflection\Types\Mixed_;
|
||||
|
||||
use function implode;
|
||||
|
||||
/** @psalm-immutable */
|
||||
class ArrayShape implements PseudoType
|
||||
{
|
||||
/** @var ArrayShapeItem[] */
|
||||
private array $items;
|
||||
|
||||
public function __construct(ArrayShapeItem ...$items)
|
||||
{
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
public function underlyingType(): Type
|
||||
{
|
||||
return new Array_(new Mixed_(), new ArrayKey());
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'array{' . implode(', ', $this->items) . '}';
|
||||
}
|
||||
}
|
||||
62
vendor/phpdocumentor/type-resolver/src/PseudoTypes/ArrayShapeItem.php
vendored
Normal file
62
vendor/phpdocumentor/type-resolver/src/PseudoTypes/ArrayShapeItem.php
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?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.
|
||||
*
|
||||
* @link http://phpdoc.org
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpDocumentor\Reflection\PseudoTypes;
|
||||
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\Types\Mixed_;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
final class ArrayShapeItem
|
||||
{
|
||||
private ?string $key;
|
||||
private Type $value;
|
||||
private bool $optional;
|
||||
|
||||
public function __construct(?string $key, ?Type $value, bool $optional)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->value = $value ?? new Mixed_();
|
||||
$this->optional = $optional;
|
||||
}
|
||||
|
||||
public function getKey(): ?string
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
public function getValue(): Type
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function isOptional(): bool
|
||||
{
|
||||
return $this->optional;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->key !== null) {
|
||||
return sprintf(
|
||||
'%s%s: %s',
|
||||
$this->key,
|
||||
$this->optional ? '?' : '',
|
||||
(string) $this->value
|
||||
);
|
||||
}
|
||||
|
||||
return (string) $this->value;
|
||||
}
|
||||
}
|
||||
53
vendor/phpdocumentor/type-resolver/src/PseudoTypes/ConstExpression.php
vendored
Normal file
53
vendor/phpdocumentor/type-resolver/src/PseudoTypes/ConstExpression.php
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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.
|
||||
*
|
||||
* @link http://phpdoc.org
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpDocumentor\Reflection\PseudoTypes;
|
||||
|
||||
use phpDocumentor\Reflection\PseudoType;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\Types\Mixed_;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class ConstExpression implements PseudoType
|
||||
{
|
||||
private Type $owner;
|
||||
private string $expression;
|
||||
|
||||
public function __construct(Type $owner, string $expression)
|
||||
{
|
||||
$this->owner = $owner;
|
||||
$this->expression = $expression;
|
||||
}
|
||||
|
||||
public function getOwner(): Type
|
||||
{
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
public function getExpression(): string
|
||||
{
|
||||
return $this->expression;
|
||||
}
|
||||
|
||||
public function underlyingType(): Type
|
||||
{
|
||||
return new Mixed_();
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return sprintf('%s::%s', (string) $this->owner, $this->expression);
|
||||
}
|
||||
}
|
||||
44
vendor/phpdocumentor/type-resolver/src/PseudoTypes/FloatValue.php
vendored
Normal file
44
vendor/phpdocumentor/type-resolver/src/PseudoTypes/FloatValue.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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.
|
||||
*
|
||||
* @link http://phpdoc.org
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpDocumentor\Reflection\PseudoTypes;
|
||||
|
||||
use phpDocumentor\Reflection\PseudoType;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\Types\Float_;
|
||||
|
||||
/** @psalm-immutable */
|
||||
class FloatValue implements PseudoType
|
||||
{
|
||||
private float $value;
|
||||
|
||||
public function __construct(float $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getValue(): float
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function underlyingType(): Type
|
||||
{
|
||||
return new Float_();
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string) $this->value;
|
||||
}
|
||||
}
|
||||
44
vendor/phpdocumentor/type-resolver/src/PseudoTypes/IntegerValue.php
vendored
Normal file
44
vendor/phpdocumentor/type-resolver/src/PseudoTypes/IntegerValue.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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.
|
||||
*
|
||||
* @link http://phpdoc.org
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpDocumentor\Reflection\PseudoTypes;
|
||||
|
||||
use phpDocumentor\Reflection\PseudoType;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\Types\Integer;
|
||||
|
||||
/** @psalm-immutable */
|
||||
final class IntegerValue implements PseudoType
|
||||
{
|
||||
private int $value;
|
||||
|
||||
public function __construct(int $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getValue(): int
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function underlyingType(): Type
|
||||
{
|
||||
return new Integer();
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string) $this->value;
|
||||
}
|
||||
}
|
||||
50
vendor/phpdocumentor/type-resolver/src/PseudoTypes/NonEmptyList.php
vendored
Normal file
50
vendor/phpdocumentor/type-resolver/src/PseudoTypes/NonEmptyList.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?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\PseudoTypes;
|
||||
|
||||
use phpDocumentor\Reflection\PseudoType;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\Types\Array_;
|
||||
use phpDocumentor\Reflection\Types\Integer;
|
||||
use phpDocumentor\Reflection\Types\Mixed_;
|
||||
|
||||
/**
|
||||
* Value Object representing the type 'non-empty-list'.
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
final class NonEmptyList extends Array_ implements PseudoType
|
||||
{
|
||||
public function underlyingType(): Type
|
||||
{
|
||||
return new Array_();
|
||||
}
|
||||
|
||||
public function __construct(?Type $valueType = null)
|
||||
{
|
||||
parent::__construct($valueType, new Integer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rendered output of the Type as it would be used in a DocBlock.
|
||||
*/
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->valueType instanceof Mixed_) {
|
||||
return 'non-empty-list';
|
||||
}
|
||||
|
||||
return 'non-empty-list<' . $this->valueType . '>';
|
||||
}
|
||||
}
|
||||
46
vendor/phpdocumentor/type-resolver/src/PseudoTypes/StringValue.php
vendored
Normal file
46
vendor/phpdocumentor/type-resolver/src/PseudoTypes/StringValue.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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.
|
||||
*
|
||||
* @link http://phpdoc.org
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpDocumentor\Reflection\PseudoTypes;
|
||||
|
||||
use phpDocumentor\Reflection\PseudoType;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use phpDocumentor\Reflection\Types\Float_;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
/** @psalm-immutable */
|
||||
class StringValue implements PseudoType
|
||||
{
|
||||
private string $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function getValue(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function underlyingType(): Type
|
||||
{
|
||||
return new Float_();
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return sprintf('"%s"', $this->value);
|
||||
}
|
||||
}
|
||||
@@ -13,27 +13,36 @@ declare(strict_types=1);
|
||||
|
||||
namespace phpDocumentor\Reflection;
|
||||
|
||||
use ArrayIterator;
|
||||
use Doctrine\Deprecations\Deprecation;
|
||||
use InvalidArgumentException;
|
||||
use phpDocumentor\Reflection\PseudoTypes\ArrayShape;
|
||||
use phpDocumentor\Reflection\PseudoTypes\ArrayShapeItem;
|
||||
use phpDocumentor\Reflection\PseudoTypes\CallableString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\ConstExpression;
|
||||
use phpDocumentor\Reflection\PseudoTypes\False_;
|
||||
use phpDocumentor\Reflection\PseudoTypes\FloatValue;
|
||||
use phpDocumentor\Reflection\PseudoTypes\HtmlEscapedString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\IntegerRange;
|
||||
use phpDocumentor\Reflection\PseudoTypes\IntegerValue;
|
||||
use phpDocumentor\Reflection\PseudoTypes\List_;
|
||||
use phpDocumentor\Reflection\PseudoTypes\LiteralString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\LowercaseString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\NegativeInteger;
|
||||
use phpDocumentor\Reflection\PseudoTypes\NonEmptyList;
|
||||
use phpDocumentor\Reflection\PseudoTypes\NonEmptyLowercaseString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\NonEmptyString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\Numeric_;
|
||||
use phpDocumentor\Reflection\PseudoTypes\NumericString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\PositiveInteger;
|
||||
use phpDocumentor\Reflection\PseudoTypes\StringValue;
|
||||
use phpDocumentor\Reflection\PseudoTypes\TraitString;
|
||||
use phpDocumentor\Reflection\PseudoTypes\True_;
|
||||
use phpDocumentor\Reflection\Types\AggregatedType;
|
||||
use phpDocumentor\Reflection\Types\Array_;
|
||||
use phpDocumentor\Reflection\Types\ArrayKey;
|
||||
use phpDocumentor\Reflection\Types\Boolean;
|
||||
use phpDocumentor\Reflection\Types\Callable_;
|
||||
use phpDocumentor\Reflection\Types\CallableParameter;
|
||||
use phpDocumentor\Reflection\Types\ClassString;
|
||||
use phpDocumentor\Reflection\Types\Collection;
|
||||
use phpDocumentor\Reflection\Types\Compound;
|
||||
@@ -57,46 +66,51 @@ use phpDocumentor\Reflection\Types\Static_;
|
||||
use phpDocumentor\Reflection\Types\String_;
|
||||
use phpDocumentor\Reflection\Types\This;
|
||||
use phpDocumentor\Reflection\Types\Void_;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprFloatNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprIntegerNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprStringNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstFetchNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\ArrayShapeItemNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\CallableTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\CallableTypeParameterNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\ConditionalTypeForParameterNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\ConditionalTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\ConstTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\NullableTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\OffsetAccessTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\ThisTypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
|
||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||
use PHPStan\PhpDocParser\Parser\ConstExprParser;
|
||||
use PHPStan\PhpDocParser\Parser\ParserException;
|
||||
use PHPStan\PhpDocParser\Parser\TokenIterator;
|
||||
use PHPStan\PhpDocParser\Parser\TypeParser;
|
||||
use RuntimeException;
|
||||
|
||||
use function array_filter;
|
||||
use function array_key_exists;
|
||||
use function array_key_last;
|
||||
use function array_pop;
|
||||
use function array_values;
|
||||
use function array_map;
|
||||
use function array_reverse;
|
||||
use function class_exists;
|
||||
use function class_implements;
|
||||
use function count;
|
||||
use function current;
|
||||
use function get_class;
|
||||
use function in_array;
|
||||
use function is_numeric;
|
||||
use function preg_split;
|
||||
use function sprintf;
|
||||
use function strpos;
|
||||
use function strtolower;
|
||||
use function trim;
|
||||
|
||||
use const PREG_SPLIT_DELIM_CAPTURE;
|
||||
use const PREG_SPLIT_NO_EMPTY;
|
||||
|
||||
final class TypeResolver
|
||||
{
|
||||
/** @var string Definition of the ARRAY operator for types */
|
||||
private 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;
|
||||
|
||||
/** @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>>
|
||||
@@ -142,10 +156,15 @@ final class TypeResolver
|
||||
'iterable' => Iterable_::class,
|
||||
'never' => Never_::class,
|
||||
'list' => List_::class,
|
||||
'non-empty-list' => NonEmptyList::class,
|
||||
];
|
||||
|
||||
/** @psalm-readonly */
|
||||
private FqsenResolver $fqsenResolver;
|
||||
/** @psalm-readonly */
|
||||
private TypeParser $typeParser;
|
||||
/** @psalm-readonly */
|
||||
private Lexer $lexer;
|
||||
|
||||
/**
|
||||
* Initializes this TypeResolver with the means to create and resolve Fqsen objects.
|
||||
@@ -153,6 +172,8 @@ final class TypeResolver
|
||||
public function __construct(?FqsenResolver $fqsenResolver = null)
|
||||
{
|
||||
$this->fqsenResolver = $fqsenResolver ?: new FqsenResolver();
|
||||
$this->typeParser = new TypeParser(new ConstExprParser());
|
||||
$this->lexer = new Lexer();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,9 +186,9 @@ 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::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.
|
||||
* @uses Context::getNamespace() to determine with what to prefix the type name.
|
||||
*
|
||||
* @param string $type The relative or absolute type.
|
||||
*/
|
||||
@@ -182,178 +203,219 @@ final class TypeResolver
|
||||
$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
|
||||
);
|
||||
$tokens = $this->lexer->tokenize($type);
|
||||
$tokenIterator = new TokenIterator($tokens);
|
||||
|
||||
if ($tokens === false) {
|
||||
throw new InvalidArgumentException('Unable to split the type string "' . $type . '" into tokens');
|
||||
}
|
||||
$ast = $this->parse($tokenIterator);
|
||||
$type = $this->createType($ast, $context);
|
||||
|
||||
/** @var ArrayIterator<int, string|null> $tokenIterator */
|
||||
$tokenIterator = new ArrayIterator($tokens);
|
||||
|
||||
return $this->parseTypes($tokenIterator, $context, self::PARSER_IN_COMPOUND);
|
||||
return $this->tryParseRemainingCompoundTypes($tokenIterator, $context, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyse each tokens and creates types
|
||||
*
|
||||
* @param ArrayIterator<int, string|null> $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
|
||||
public function createType(?TypeNode $type, Context $context): Type
|
||||
{
|
||||
$types = [];
|
||||
$token = '';
|
||||
$compoundToken = '|';
|
||||
while ($tokens->valid()) {
|
||||
$token = $tokens->current();
|
||||
if ($token === null) {
|
||||
throw new RuntimeException(
|
||||
'Unexpected nullable character'
|
||||
);
|
||||
}
|
||||
if ($type === null) {
|
||||
return new Mixed_();
|
||||
}
|
||||
|
||||
if ($token === '|' || $token === '&') {
|
||||
if (count($types) === 0) {
|
||||
switch (get_class($type)) {
|
||||
case ArrayTypeNode::class:
|
||||
return new Array_(
|
||||
$this->createType($type->type, $context)
|
||||
);
|
||||
|
||||
case ArrayShapeNode::class:
|
||||
return new ArrayShape(
|
||||
...array_map(
|
||||
fn (ArrayShapeItemNode $item) => new ArrayShapeItem(
|
||||
(string) $item->keyName,
|
||||
$this->createType($item->valueType, $context),
|
||||
$item->optional
|
||||
),
|
||||
$type->items
|
||||
)
|
||||
);
|
||||
|
||||
case CallableTypeNode::class:
|
||||
return $this->createFromCallable($type, $context);
|
||||
|
||||
case ConstTypeNode::class:
|
||||
return $this->createFromConst($type, $context);
|
||||
|
||||
case GenericTypeNode::class:
|
||||
return $this->createFromGeneric($type, $context);
|
||||
|
||||
case IdentifierTypeNode::class:
|
||||
return $this->resolveSingleType($type->name, $context);
|
||||
|
||||
case IntersectionTypeNode::class:
|
||||
return new Intersection(
|
||||
array_filter(
|
||||
array_map(
|
||||
function (TypeNode $nestedType) use ($context) {
|
||||
$type = $this->createType($nestedType, $context);
|
||||
if ($type instanceof AggregatedType) {
|
||||
return new Expression($type);
|
||||
}
|
||||
|
||||
return $type;
|
||||
},
|
||||
$type->types
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
case NullableTypeNode::class:
|
||||
$nestedType = $this->createType($type->type, $context);
|
||||
|
||||
return new Nullable($nestedType);
|
||||
|
||||
case UnionTypeNode::class:
|
||||
return new Compound(
|
||||
array_filter(
|
||||
array_map(
|
||||
function (TypeNode $nestedType) use ($context) {
|
||||
$type = $this->createType($nestedType, $context);
|
||||
if ($type instanceof AggregatedType) {
|
||||
return new Expression($type);
|
||||
}
|
||||
|
||||
return $type;
|
||||
},
|
||||
$type->types
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
case ThisTypeNode::class:
|
||||
return new This();
|
||||
|
||||
case ConditionalTypeNode::class:
|
||||
case ConditionalTypeForParameterNode::class:
|
||||
case OffsetAccessTypeNode::class:
|
||||
default:
|
||||
return new Mixed_();
|
||||
}
|
||||
}
|
||||
|
||||
private function createFromGeneric(GenericTypeNode $type, Context $context): Type
|
||||
{
|
||||
switch (strtolower($type->type->name)) {
|
||||
case 'array':
|
||||
return $this->createArray($type->genericTypes, $context);
|
||||
|
||||
case 'class-string':
|
||||
$subType = $this->createType($type->genericTypes[0], $context);
|
||||
if (!$subType instanceof Object_ || $subType->getFqsen() === null) {
|
||||
throw new RuntimeException(
|
||||
'A type is missing before a type separator'
|
||||
$subType . ' is not a class string'
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
!in_array($parserContext, [
|
||||
self::PARSER_IN_COMPOUND,
|
||||
self::PARSER_IN_ARRAY_EXPRESSION,
|
||||
self::PARSER_IN_COLLECTION_EXPRESSION,
|
||||
self::PARSER_IN_NULLABLE,
|
||||
], true)
|
||||
) {
|
||||
return new ClassString(
|
||||
$subType->getFqsen()
|
||||
);
|
||||
|
||||
case 'interface-string':
|
||||
$subType = $this->createType($type->genericTypes[0], $context);
|
||||
if (!$subType instanceof Object_ || $subType->getFqsen() === null) {
|
||||
throw new RuntimeException(
|
||||
'Unexpected type separator'
|
||||
$subType . ' is not a class string'
|
||||
);
|
||||
}
|
||||
|
||||
$compoundToken = $token;
|
||||
$tokens->next();
|
||||
} elseif ($token === '?') {
|
||||
if (
|
||||
!in_array($parserContext, [
|
||||
self::PARSER_IN_COMPOUND,
|
||||
self::PARSER_IN_ARRAY_EXPRESSION,
|
||||
self::PARSER_IN_COLLECTION_EXPRESSION,
|
||||
self::PARSER_IN_NULLABLE,
|
||||
], true)
|
||||
) {
|
||||
throw new RuntimeException(
|
||||
'Unexpected nullable character'
|
||||
return new InterfaceString(
|
||||
$subType->getFqsen()
|
||||
);
|
||||
|
||||
case 'list':
|
||||
return new List_(
|
||||
$this->createType($type->genericTypes[0], $context)
|
||||
);
|
||||
|
||||
case 'non-empty-list':
|
||||
return new NonEmptyList(
|
||||
$this->createType($type->genericTypes[0], $context)
|
||||
);
|
||||
|
||||
case 'int':
|
||||
if (isset($type->genericTypes[1]) === false) {
|
||||
throw new RuntimeException('int<min,max> has not the correct format');
|
||||
}
|
||||
|
||||
return new IntegerRange(
|
||||
(string) $type->genericTypes[0],
|
||||
(string) $type->genericTypes[1],
|
||||
);
|
||||
|
||||
case 'iterable':
|
||||
return new Iterable_(
|
||||
...array_reverse(
|
||||
array_map(
|
||||
fn (TypeNode $genericType) => $this->createType($genericType, $context),
|
||||
$type->genericTypes
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
default:
|
||||
$collectionType = $this->createType($type->type, $context);
|
||||
if ($collectionType instanceof Object_ === false) {
|
||||
throw new RuntimeException(sprintf('%s is not a collection', (string) $collectionType));
|
||||
}
|
||||
|
||||
return new Collection(
|
||||
$collectionType->getFqsen(),
|
||||
...array_reverse(
|
||||
array_map(
|
||||
fn (TypeNode $genericType) => $this->createType($genericType, $context),
|
||||
$type->genericTypes
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function createFromCallable(CallableTypeNode $type, Context $context): Callable_
|
||||
{
|
||||
return new Callable_(
|
||||
array_map(
|
||||
function (CallableTypeParameterNode $param) use ($context) {
|
||||
return new CallableParameter(
|
||||
$this->createType($param->type, $context),
|
||||
$param->parameterName !== '' ? trim($param->parameterName, '$') : null,
|
||||
$param->isReference,
|
||||
$param->isVariadic,
|
||||
$param->isOptional
|
||||
);
|
||||
}
|
||||
},
|
||||
$type->parameters
|
||||
),
|
||||
$this->createType($type->returnType, $context),
|
||||
);
|
||||
}
|
||||
|
||||
$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);
|
||||
private function createFromConst(ConstTypeNode $type, Context $context): Type
|
||||
{
|
||||
switch (true) {
|
||||
case $type->constExpr instanceof ConstExprIntegerNode:
|
||||
return new IntegerValue((int) $type->constExpr->value);
|
||||
|
||||
$token = $tokens->current();
|
||||
if ($token === null) { // Someone did not properly close their array expression ..
|
||||
break;
|
||||
}
|
||||
case $type->constExpr instanceof ConstExprFloatNode:
|
||||
return new FloatValue((float) $type->constExpr->value);
|
||||
|
||||
$tokens->next();
|
||||
case $type->constExpr instanceof ConstExprStringNode:
|
||||
return new StringValue($type->constExpr->value);
|
||||
|
||||
$resolvedType = new Expression($type);
|
||||
|
||||
$types[] = $resolvedType;
|
||||
} elseif ($parserContext === self::PARSER_IN_ARRAY_EXPRESSION && isset($token[0]) && $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) {
|
||||
if ((string) $classType === 'class-string') {
|
||||
$types[] = $this->resolveClassString($tokens, $context);
|
||||
} elseif ((string) $classType === 'int') {
|
||||
$types[] = $this->resolveIntRange($tokens);
|
||||
} elseif ((string) $classType === 'interface-string') {
|
||||
$types[] = $this->resolveInterfaceString($tokens, $context);
|
||||
} else {
|
||||
$types[] = $this->resolveCollection($tokens, $classType, $context);
|
||||
}
|
||||
}
|
||||
|
||||
$tokens->next();
|
||||
} elseif (
|
||||
$parserContext === self::PARSER_IN_COLLECTION_EXPRESSION
|
||||
&& ($token === '>' || trim($token) === ',')
|
||||
) {
|
||||
break;
|
||||
} elseif ($token === self::OPERATOR_ARRAY) {
|
||||
$last = array_key_last($types);
|
||||
if ($last === null) {
|
||||
throw new InvalidArgumentException('Unexpected array operator');
|
||||
}
|
||||
|
||||
$lastItem = $types[$last];
|
||||
if ($lastItem instanceof Expression) {
|
||||
$lastItem = $lastItem->getValueType();
|
||||
}
|
||||
|
||||
$types[$last] = new Array_($lastItem);
|
||||
|
||||
$tokens->next();
|
||||
} else {
|
||||
$types[] = $this->resolveSingleType($token, $context);
|
||||
$tokens->next();
|
||||
}
|
||||
}
|
||||
|
||||
if ($token === '|' || $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'
|
||||
case $type->constExpr instanceof ConstFetchNode:
|
||||
return new ConstExpression(
|
||||
$this->resolve($type->constExpr->className, $context),
|
||||
$type->constExpr->name
|
||||
);
|
||||
}
|
||||
|
||||
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 current($types);
|
||||
default:
|
||||
throw new RuntimeException(sprintf('Unsupported constant type %s', get_class($type)));
|
||||
}
|
||||
|
||||
if ($compoundToken === '|') {
|
||||
return new Compound(array_values($types));
|
||||
}
|
||||
|
||||
return new Intersection(array_values($types));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -475,244 +537,87 @@ final class TypeResolver
|
||||
return new Object_($this->fqsenResolver->resolve($type, $context));
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves class string
|
||||
*
|
||||
* @param ArrayIterator<int, (string|null)> $tokens
|
||||
*/
|
||||
private function resolveClassString(ArrayIterator $tokens, Context $context): Type
|
||||
/** @param TypeNode[] $typeNodes */
|
||||
private function createArray(array $typeNodes, Context $context): Array_
|
||||
{
|
||||
$tokens->next();
|
||||
$types = array_reverse(
|
||||
array_map(
|
||||
fn (TypeNode $node) => $this->createType($node, $context),
|
||||
$typeNodes
|
||||
)
|
||||
);
|
||||
|
||||
$classType = $this->parseTypes($tokens, $context, self::PARSER_IN_COLLECTION_EXPRESSION);
|
||||
|
||||
if (!$classType instanceof Object_ || $classType->getFqsen() === null) {
|
||||
throw new RuntimeException(
|
||||
$classType . ' is not a class string'
|
||||
);
|
||||
if (isset($types[1]) === false) {
|
||||
return new Array_(...$types);
|
||||
}
|
||||
|
||||
$token = $tokens->current();
|
||||
if ($token !== '>') {
|
||||
if (empty($token)) {
|
||||
throw new RuntimeException(
|
||||
'class-string: ">" is missing'
|
||||
);
|
||||
if ($this->validArrayKeyType($types[1]) || $types[1] instanceof ArrayKey) {
|
||||
return new Array_(...$types);
|
||||
}
|
||||
|
||||
if ($types[1] instanceof Compound && $types[1]->getIterator()->count() === 2) {
|
||||
if ($this->validArrayKeyType($types[1]->get(0)) && $this->validArrayKeyType($types[1]->get(1))) {
|
||||
return new Array_(...$types);
|
||||
}
|
||||
|
||||
throw new RuntimeException(
|
||||
'Unexpected character "' . $token . '", ">" is missing'
|
||||
);
|
||||
}
|
||||
|
||||
return new ClassString($classType->getFqsen());
|
||||
throw new RuntimeException('An array can have only integers or strings as keys');
|
||||
}
|
||||
|
||||
private function validArrayKeyType(?Type $type): bool
|
||||
{
|
||||
return $type instanceof String_ || $type instanceof Integer;
|
||||
}
|
||||
|
||||
private function parse(TokenIterator $tokenIterator): TypeNode
|
||||
{
|
||||
try {
|
||||
$ast = $this->typeParser->parse($tokenIterator);
|
||||
} catch (ParserException $e) {
|
||||
throw new RuntimeException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
return $ast;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves integer ranges
|
||||
* Will try to parse unsupported type notations by phpstan
|
||||
*
|
||||
* @param ArrayIterator<int, (string|null)> $tokens
|
||||
* The phpstan parser doesn't support the illegal nullable combinations like this library does.
|
||||
* This method will warn the user about those notations but for bc purposes we will still have it here.
|
||||
*/
|
||||
private function resolveIntRange(ArrayIterator $tokens): Type
|
||||
private function tryParseRemainingCompoundTypes(TokenIterator $tokenIterator, Context $context, Type $type): Type
|
||||
{
|
||||
$tokens->next();
|
||||
|
||||
$token = '';
|
||||
$minValue = null;
|
||||
$maxValue = null;
|
||||
$commaFound = false;
|
||||
$tokenCounter = 0;
|
||||
while ($tokens->valid()) {
|
||||
$tokenCounter++;
|
||||
$token = $tokens->current();
|
||||
if ($token === null) {
|
||||
throw new RuntimeException(
|
||||
'Unexpected nullable character'
|
||||
);
|
||||
}
|
||||
|
||||
$token = trim($token);
|
||||
|
||||
if ($token === '>') {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($token === ',') {
|
||||
$commaFound = true;
|
||||
}
|
||||
|
||||
if ($commaFound === false && $minValue === null) {
|
||||
if (is_numeric($token) || $token === 'max' || $token === 'min') {
|
||||
$minValue = $token;
|
||||
}
|
||||
}
|
||||
|
||||
if ($commaFound === true && $maxValue === null) {
|
||||
if (is_numeric($token) || $token === 'max' || $token === 'min') {
|
||||
$maxValue = $token;
|
||||
}
|
||||
}
|
||||
|
||||
$tokens->next();
|
||||
}
|
||||
|
||||
if ($token !== '>') {
|
||||
if (empty($token)) {
|
||||
throw new RuntimeException(
|
||||
'interface-string: ">" is missing'
|
||||
);
|
||||
}
|
||||
|
||||
throw new RuntimeException(
|
||||
'Unexpected character "' . $token . '", ">" is missing'
|
||||
);
|
||||
}
|
||||
|
||||
if ($minValue === null || $maxValue === null || $tokenCounter > 4) {
|
||||
throw new RuntimeException(
|
||||
'int<min,max> has not the correct format'
|
||||
);
|
||||
}
|
||||
|
||||
return new IntegerRange($minValue, $maxValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves class string
|
||||
*
|
||||
* @param ArrayIterator<int, (string|null)> $tokens
|
||||
*/
|
||||
private function resolveInterfaceString(ArrayIterator $tokens, Context $context): Type
|
||||
{
|
||||
$tokens->next();
|
||||
|
||||
$classType = $this->parseTypes($tokens, $context, self::PARSER_IN_COLLECTION_EXPRESSION);
|
||||
|
||||
if (!$classType instanceof Object_ || $classType->getFqsen() === null) {
|
||||
throw new RuntimeException(
|
||||
$classType . ' is not a interface string'
|
||||
);
|
||||
}
|
||||
|
||||
$token = $tokens->current();
|
||||
if ($token !== '>') {
|
||||
if (empty($token)) {
|
||||
throw new RuntimeException(
|
||||
'interface-string: ">" is missing'
|
||||
);
|
||||
}
|
||||
|
||||
throw new RuntimeException(
|
||||
'Unexpected character "' . $token . '", ">" is missing'
|
||||
);
|
||||
}
|
||||
|
||||
return new InterfaceString($classType->getFqsen());
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the collection values and keys
|
||||
*
|
||||
* @param ArrayIterator<int, (string|null)> $tokens
|
||||
*
|
||||
* @return Array_|Iterable_|Collection
|
||||
*/
|
||||
private function resolveCollection(ArrayIterator $tokens, Type $classType, Context $context): Type
|
||||
{
|
||||
$isArray = ((string) $classType === 'array');
|
||||
$isIterable = ((string) $classType === 'iterable');
|
||||
$isList = ((string) $classType === 'list');
|
||||
|
||||
// allow only "array", "iterable" or class name before "<"
|
||||
if (
|
||||
!$isArray && !$isIterable && !$isList
|
||||
&& (!$classType instanceof Object_ || $classType->getFqsen() === null)
|
||||
$tokenIterator->isCurrentTokenType(Lexer::TOKEN_UNION) ||
|
||||
$tokenIterator->isCurrentTokenType(Lexer::TOKEN_INTERSECTION)
|
||||
) {
|
||||
throw new RuntimeException(
|
||||
$classType . ' is not a collection'
|
||||
Deprecation::trigger(
|
||||
'phpdocumentor/type-resolver',
|
||||
'https://github.com/phpDocumentor/TypeResolver/issues/184',
|
||||
'Legacy nullable type detected, please update your code as
|
||||
you are using nullable types in a docblock. support will be removed in v2.0.0',
|
||||
);
|
||||
}
|
||||
|
||||
$tokens->next();
|
||||
|
||||
$valueType = $this->parseTypes($tokens, $context, self::PARSER_IN_COLLECTION_EXPRESSION);
|
||||
$keyType = null;
|
||||
|
||||
$token = $tokens->current();
|
||||
if ($token !== null && trim($token) === ',' && !$isList) {
|
||||
// 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 ArrayKey &&
|
||||
!$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 ArrayKey &&
|
||||
!$item instanceof String_ &&
|
||||
!$item instanceof Integer
|
||||
) {
|
||||
throw new RuntimeException(
|
||||
'An array can have only integers or strings as keys'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$continue = true;
|
||||
while ($continue) {
|
||||
$continue = false;
|
||||
while ($tokenIterator->tryConsumeTokenType(Lexer::TOKEN_UNION)) {
|
||||
$ast = $this->parse($tokenIterator);
|
||||
$type2 = $this->createType($ast, $context);
|
||||
$type = new Compound([$type, $type2]);
|
||||
$continue = true;
|
||||
}
|
||||
|
||||
$tokens->next();
|
||||
// now let's parse the value type
|
||||
$valueType = $this->parseTypes($tokens, $context, self::PARSER_IN_COLLECTION_EXPRESSION);
|
||||
}
|
||||
|
||||
$token = $tokens->current();
|
||||
if ($token !== '>') {
|
||||
if (empty($token)) {
|
||||
throw new RuntimeException(
|
||||
'Collection: ">" is missing'
|
||||
);
|
||||
while ($tokenIterator->tryConsumeTokenType(Lexer::TOKEN_INTERSECTION)) {
|
||||
$ast = $this->typeParser->parse($tokenIterator);
|
||||
$type2 = $this->createType($ast, $context);
|
||||
$type = new Intersection([$type, $type2]);
|
||||
$continue = true;
|
||||
}
|
||||
|
||||
throw new RuntimeException(
|
||||
'Unexpected character "' . $token . '", ">" is missing'
|
||||
);
|
||||
}
|
||||
|
||||
if ($isArray) {
|
||||
return new Array_($valueType, $keyType);
|
||||
}
|
||||
|
||||
if ($isIterable) {
|
||||
return new Iterable_($valueType, $keyType);
|
||||
}
|
||||
|
||||
if ($isList) {
|
||||
return new List_($valueType);
|
||||
}
|
||||
|
||||
if ($classType instanceof Object_) {
|
||||
return $this->makeCollectionFromObject($classType, $valueType, $keyType);
|
||||
}
|
||||
|
||||
throw new RuntimeException('Invalid $classType provided');
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-pure
|
||||
*/
|
||||
private function makeCollectionFromObject(Object_ $object, Type $valueType, ?Type $keyType = null): Collection
|
||||
{
|
||||
return new Collection($object->getFqsen(), $valueType, $keyType);
|
||||
return $type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ abstract class AggregatedType implements Type, IteratorAggregate
|
||||
*/
|
||||
private function add(Type $type): void
|
||||
{
|
||||
if ($type instanceof self) {
|
||||
if ($type instanceof static) {
|
||||
foreach ($type->getIterator() as $subType) {
|
||||
$this->add($subType);
|
||||
}
|
||||
|
||||
72
vendor/phpdocumentor/type-resolver/src/Types/CallableParameter.php
vendored
Normal file
72
vendor/phpdocumentor/type-resolver/src/Types/CallableParameter.php
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
<?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.
|
||||
*
|
||||
* @link http://phpdoc.org
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpDocumentor\Reflection\Types;
|
||||
|
||||
use phpDocumentor\Reflection\Type;
|
||||
|
||||
/**
|
||||
* Value Object representing a Callable parameters.
|
||||
*
|
||||
* @psalm-immutable
|
||||
*/
|
||||
final class CallableParameter
|
||||
{
|
||||
private Type $type;
|
||||
|
||||
private bool $isReference;
|
||||
|
||||
private bool $isVariadic;
|
||||
|
||||
private bool $isOptional;
|
||||
|
||||
private ?string $name;
|
||||
|
||||
public function __construct(
|
||||
Type $type,
|
||||
?string $name = null,
|
||||
bool $isReference = false,
|
||||
bool $isVariadic = false,
|
||||
bool $isOptional = false
|
||||
) {
|
||||
$this->type = $type;
|
||||
$this->isReference = $isReference;
|
||||
$this->isVariadic = $isVariadic;
|
||||
$this->isOptional = $isOptional;
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getType(): Type
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function isReference(): bool
|
||||
{
|
||||
return $this->isReference;
|
||||
}
|
||||
|
||||
public function isVariadic(): bool
|
||||
{
|
||||
return $this->isVariadic;
|
||||
}
|
||||
|
||||
public function isOptional(): bool
|
||||
{
|
||||
return $this->isOptional;
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,30 @@ use phpDocumentor\Reflection\Type;
|
||||
*/
|
||||
final class Callable_ implements Type
|
||||
{
|
||||
private ?Type $returnType;
|
||||
/** @var CallableParameter[] */
|
||||
private array $parameters;
|
||||
|
||||
/**
|
||||
* @param CallableParameter[] $parameters
|
||||
*/
|
||||
public function __construct(array $parameters = [], ?Type $returnType = null)
|
||||
{
|
||||
$this->parameters = $parameters;
|
||||
$this->returnType = $returnType;
|
||||
}
|
||||
|
||||
/** @return CallableParameter[] */
|
||||
public function getParameters(): array
|
||||
{
|
||||
return $this->parameters;
|
||||
}
|
||||
|
||||
public function getReturnType(): ?Type
|
||||
{
|
||||
return $this->returnType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a rendered output of the Type as it would be used in a DocBlock.
|
||||
*/
|
||||
|
||||
21
vendor/phpstan/phpdoc-parser/LICENSE
vendored
Normal file
21
vendor/phpstan/phpdoc-parser/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 Ondřej Mirtes
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
30
vendor/phpstan/phpdoc-parser/README.md
vendored
Normal file
30
vendor/phpstan/phpdoc-parser/README.md
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<h1 align="center">PHPDoc-Parser for PHPStan</h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/phpstan/phpdoc-parser/actions"><img src="https://github.com/phpstan/phpdoc-parser/workflows/Build/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/phpstan/phpdoc-parser"><img src="https://poser.pugx.org/phpstan/phpdoc-parser/v/stable" alt="Latest Stable Version"></a>
|
||||
<a href="https://choosealicense.com/licenses/mit/"><img src="https://poser.pugx.org/phpstan/phpstan/license" alt="License"></a>
|
||||
<a href="https://phpstan.org/"><img src="https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat" alt="PHPStan Enabled"></a>
|
||||
</p>
|
||||
|
||||
* [PHPStan](https://phpstan.org)
|
||||
|
||||
------
|
||||
|
||||
Next generation phpDoc parser with support for intersection types and generics.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
This project adheres to a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project and its community, you are expected to uphold this code.
|
||||
|
||||
## Building
|
||||
|
||||
Initially you need to run `composer install`, or `composer update` in case you aren't working in a folder which was built before.
|
||||
|
||||
Afterwards you can either run the whole build including linting and coding standards using
|
||||
|
||||
make
|
||||
|
||||
or run only tests using
|
||||
|
||||
make tests
|
||||
42
vendor/phpstan/phpdoc-parser/composer.json
vendored
Normal file
42
vendor/phpstan/phpdoc-parser/composer.json
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/extension-installer": "^1.0",
|
||||
"phpstan/phpstan": "^1.5",
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
"phpstan/phpstan-strict-rules": "^1.0",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"symfony/process": "^5.2"
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.4.6"
|
||||
},
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"phpstan/extension-installer": true
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPStan\\PhpDocParser\\": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"PHPStan\\PhpDocParser\\": [
|
||||
"tests/PHPStan"
|
||||
]
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
36
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprArrayItemNode.php
vendored
Normal file
36
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprArrayItemNode.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function sprintf;
|
||||
|
||||
class ConstExprArrayItemNode implements ConstExprNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var ConstExprNode|null */
|
||||
public $key;
|
||||
|
||||
/** @var ConstExprNode */
|
||||
public $value;
|
||||
|
||||
public function __construct(?ConstExprNode $key, ConstExprNode $value)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->key !== null) {
|
||||
return sprintf('%s => %s', $this->key, $this->value);
|
||||
|
||||
}
|
||||
|
||||
return (string) $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
30
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprArrayNode.php
vendored
Normal file
30
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprArrayNode.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function implode;
|
||||
|
||||
class ConstExprArrayNode implements ConstExprNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var ConstExprArrayItemNode[] */
|
||||
public $items;
|
||||
|
||||
/**
|
||||
* @param ConstExprArrayItemNode[] $items
|
||||
*/
|
||||
public function __construct(array $items)
|
||||
{
|
||||
$this->items = $items;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return '[' . implode(', ', $this->items) . ']';
|
||||
}
|
||||
|
||||
}
|
||||
17
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprFalseNode.php
vendored
Normal file
17
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprFalseNode.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class ConstExprFalseNode implements ConstExprNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'false';
|
||||
}
|
||||
|
||||
}
|
||||
26
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprFloatNode.php
vendored
Normal file
26
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprFloatNode.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class ConstExprFloatNode implements ConstExprNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
26
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprIntegerNode.php
vendored
Normal file
26
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprIntegerNode.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class ConstExprIntegerNode implements ConstExprNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
10
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprNode.php
vendored
Normal file
10
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprNode.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
|
||||
interface ConstExprNode extends Node
|
||||
{
|
||||
|
||||
}
|
||||
17
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprNullNode.php
vendored
Normal file
17
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprNullNode.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class ConstExprNullNode implements ConstExprNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'null';
|
||||
}
|
||||
|
||||
}
|
||||
26
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprStringNode.php
vendored
Normal file
26
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprStringNode.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class ConstExprStringNode implements ConstExprNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
17
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprTrueNode.php
vendored
Normal file
17
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstExprTrueNode.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class ConstExprTrueNode implements ConstExprNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'true';
|
||||
}
|
||||
|
||||
}
|
||||
35
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstFetchNode.php
vendored
Normal file
35
vendor/phpstan/phpdoc-parser/src/Ast/ConstExpr/ConstFetchNode.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class ConstFetchNode implements ConstExprNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string class name for class constants or empty string for non-class constants */
|
||||
public $className;
|
||||
|
||||
/** @var string */
|
||||
public $name;
|
||||
|
||||
public function __construct(string $className, string $name)
|
||||
{
|
||||
$this->className = $className;
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->className === '') {
|
||||
return $this->name;
|
||||
|
||||
}
|
||||
|
||||
return "{$this->className}::{$this->name}";
|
||||
}
|
||||
|
||||
}
|
||||
22
vendor/phpstan/phpdoc-parser/src/Ast/Node.php
vendored
Normal file
22
vendor/phpstan/phpdoc-parser/src/Ast/Node.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast;
|
||||
|
||||
interface Node
|
||||
{
|
||||
|
||||
public function __toString(): string;
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setAttribute(string $key, $value): void;
|
||||
|
||||
public function hasAttribute(string $key): bool;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAttribute(string $key);
|
||||
|
||||
}
|
||||
38
vendor/phpstan/phpdoc-parser/src/Ast/NodeAttributes.php
vendored
Normal file
38
vendor/phpstan/phpdoc-parser/src/Ast/NodeAttributes.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast;
|
||||
|
||||
use function array_key_exists;
|
||||
|
||||
trait NodeAttributes
|
||||
{
|
||||
|
||||
/** @var array<string, mixed> */
|
||||
private $attributes = [];
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setAttribute(string $key, $value): void
|
||||
{
|
||||
$this->attributes[$key] = $value;
|
||||
}
|
||||
|
||||
public function hasAttribute(string $key): bool
|
||||
{
|
||||
return array_key_exists($key, $this->attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAttribute(string $key)
|
||||
{
|
||||
if ($this->hasAttribute($key)) {
|
||||
return $this->attributes[$key];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
50
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagMethodValueNode.php
vendored
Normal file
50
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagMethodValueNode.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class AssertTagMethodValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string */
|
||||
public $parameter;
|
||||
|
||||
/** @var string */
|
||||
public $method;
|
||||
|
||||
/** @var bool */
|
||||
public $isNegated;
|
||||
|
||||
/** @var bool */
|
||||
public $isEquality;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(TypeNode $type, string $parameter, string $method, bool $isNegated, string $description, bool $isEquality = false)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->parameter = $parameter;
|
||||
$this->method = $method;
|
||||
$this->isNegated = $isNegated;
|
||||
$this->isEquality = $isEquality;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$isNegated = $this->isNegated ? '!' : '';
|
||||
$isEquality = $this->isEquality ? '=' : '';
|
||||
return trim("{$isNegated}{$isEquality}{$this->type} {$this->parameter}->{$this->method}() {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
50
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagPropertyValueNode.php
vendored
Normal file
50
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagPropertyValueNode.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class AssertTagPropertyValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string */
|
||||
public $parameter;
|
||||
|
||||
/** @var string */
|
||||
public $property;
|
||||
|
||||
/** @var bool */
|
||||
public $isNegated;
|
||||
|
||||
/** @var bool */
|
||||
public $isEquality;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(TypeNode $type, string $parameter, string $property, bool $isNegated, string $description, bool $isEquality = false)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->parameter = $parameter;
|
||||
$this->property = $property;
|
||||
$this->isNegated = $isNegated;
|
||||
$this->isEquality = $isEquality;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$isNegated = $this->isNegated ? '!' : '';
|
||||
$isEquality = $this->isEquality ? '=' : '';
|
||||
return trim("{$isNegated}{$isEquality}{$this->type} {$this->parameter}->{$this->property} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
46
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagValueNode.php
vendored
Normal file
46
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/AssertTagValueNode.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class AssertTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string */
|
||||
public $parameter;
|
||||
|
||||
/** @var bool */
|
||||
public $isNegated;
|
||||
|
||||
/** @var bool */
|
||||
public $isEquality;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(TypeNode $type, string $parameter, bool $isNegated, string $description, bool $isEquality = false)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->parameter = $parameter;
|
||||
$this->isNegated = $isNegated;
|
||||
$this->isEquality = $isEquality;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$isNegated = $this->isNegated ? '!' : '';
|
||||
$isEquality = $this->isEquality ? '=' : '';
|
||||
return trim("{$isNegated}{$isEquality}{$this->type} {$this->parameter} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
27
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/DeprecatedTagValueNode.php
vendored
Normal file
27
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/DeprecatedTagValueNode.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function trim;
|
||||
|
||||
class DeprecatedTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(string $description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim($this->description);
|
||||
}
|
||||
|
||||
}
|
||||
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ExtendsTagValueNode.php
vendored
Normal file
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ExtendsTagValueNode.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
|
||||
use function trim;
|
||||
|
||||
class ExtendsTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var GenericTypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(GenericTypeNode $type, string $description)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim("{$this->type} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
26
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/GenericTagValueNode.php
vendored
Normal file
26
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/GenericTagValueNode.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class GenericTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ImplementsTagValueNode.php
vendored
Normal file
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ImplementsTagValueNode.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
|
||||
use function trim;
|
||||
|
||||
class ImplementsTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var GenericTypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(GenericTypeNode $type, string $description)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim("{$this->type} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
52
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/InvalidTagValueNode.php
vendored
Normal file
52
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/InvalidTagValueNode.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Parser\ParserException;
|
||||
use function sprintf;
|
||||
use function trigger_error;
|
||||
use const E_USER_WARNING;
|
||||
|
||||
/**
|
||||
* @property ParserException $exception
|
||||
*/
|
||||
class InvalidTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $value;
|
||||
|
||||
/** @var mixed[] */
|
||||
private $exceptionArgs;
|
||||
|
||||
public function __construct(string $value, ParserException $exception)
|
||||
{
|
||||
$this->value = $value;
|
||||
$this->exceptionArgs = [
|
||||
$exception->getCurrentTokenValue(),
|
||||
$exception->getCurrentTokenType(),
|
||||
$exception->getCurrentOffset(),
|
||||
$exception->getExpectedTokenType(),
|
||||
$exception->getExpectedTokenValue(),
|
||||
];
|
||||
}
|
||||
|
||||
public function __get(string $name)
|
||||
{
|
||||
if ($name !== 'exception') {
|
||||
trigger_error(sprintf('Undefined property: %s::$%s', self::class, $name), E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ParserException(...$this->exceptionArgs);
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
54
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MethodTagValueNode.php
vendored
Normal file
54
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MethodTagValueNode.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function count;
|
||||
use function implode;
|
||||
|
||||
class MethodTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var bool */
|
||||
public $isStatic;
|
||||
|
||||
/** @var TypeNode|null */
|
||||
public $returnType;
|
||||
|
||||
/** @var string */
|
||||
public $methodName;
|
||||
|
||||
/** @var TemplateTagValueNode[] */
|
||||
public $templateTypes;
|
||||
|
||||
/** @var MethodTagValueParameterNode[] */
|
||||
public $parameters;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(bool $isStatic, ?TypeNode $returnType, string $methodName, array $parameters, string $description, array $templateTypes = [])
|
||||
{
|
||||
$this->isStatic = $isStatic;
|
||||
$this->returnType = $returnType;
|
||||
$this->methodName = $methodName;
|
||||
$this->parameters = $parameters;
|
||||
$this->description = $description;
|
||||
$this->templateTypes = $templateTypes;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$static = $this->isStatic ? 'static ' : '';
|
||||
$returnType = $this->returnType !== null ? "{$this->returnType} " : '';
|
||||
$parameters = implode(', ', $this->parameters);
|
||||
$description = $this->description !== '' ? " {$this->description}" : '';
|
||||
$templateTypes = count($this->templateTypes) > 0 ? '<' . implode(', ', $this->templateTypes) . '>' : '';
|
||||
return "{$static}{$returnType}{$this->methodName}{$templateTypes}({$parameters}){$description}";
|
||||
}
|
||||
|
||||
}
|
||||
49
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MethodTagValueParameterNode.php
vendored
Normal file
49
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MethodTagValueParameterNode.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode;
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
|
||||
class MethodTagValueParameterNode implements Node
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode|null */
|
||||
public $type;
|
||||
|
||||
/** @var bool */
|
||||
public $isReference;
|
||||
|
||||
/** @var bool */
|
||||
public $isVariadic;
|
||||
|
||||
/** @var string */
|
||||
public $parameterName;
|
||||
|
||||
/** @var ConstExprNode|null */
|
||||
public $defaultValue;
|
||||
|
||||
public function __construct(?TypeNode $type, bool $isReference, bool $isVariadic, string $parameterName, ?ConstExprNode $defaultValue)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->isReference = $isReference;
|
||||
$this->isVariadic = $isVariadic;
|
||||
$this->parameterName = $parameterName;
|
||||
$this->defaultValue = $defaultValue;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$type = $this->type !== null ? "{$this->type} " : '';
|
||||
$isReference = $this->isReference ? '&' : '';
|
||||
$isVariadic = $this->isVariadic ? '...' : '';
|
||||
$default = $this->defaultValue !== null ? " = {$this->defaultValue}" : '';
|
||||
return "{$type}{$isReference}{$isVariadic}{$this->parameterName}{$default}";
|
||||
}
|
||||
|
||||
}
|
||||
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MixinTagValueNode.php
vendored
Normal file
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/MixinTagValueNode.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class MixinTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(TypeNode $type, string $description)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim("{$this->type} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
35
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamOutTagValueNode.php
vendored
Normal file
35
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamOutTagValueNode.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class ParamOutTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string */
|
||||
public $parameterName;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(TypeNode $type, string $parameterName, string $description)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->parameterName = $parameterName;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim("{$this->type} {$this->parameterName} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
46
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamTagValueNode.php
vendored
Normal file
46
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ParamTagValueNode.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class ParamTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var bool */
|
||||
public $isReference;
|
||||
|
||||
/** @var bool */
|
||||
public $isVariadic;
|
||||
|
||||
/** @var string */
|
||||
public $parameterName;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(TypeNode $type, bool $isVariadic, string $parameterName, string $description, bool $isReference = false)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->isReference = $isReference;
|
||||
$this->isVariadic = $isVariadic;
|
||||
$this->parameterName = $parameterName;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$reference = $this->isReference ? '&' : '';
|
||||
$variadic = $this->isVariadic ? '...' : '';
|
||||
return trim("{$this->type} {$reference}{$variadic}{$this->parameterName} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
10
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocChildNode.php
vendored
Normal file
10
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocChildNode.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
|
||||
interface PhpDocChildNode extends Node
|
||||
{
|
||||
|
||||
}
|
||||
371
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocNode.php
vendored
Normal file
371
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocNode.php
vendored
Normal file
@@ -0,0 +1,371 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function array_column;
|
||||
use function array_filter;
|
||||
use function array_map;
|
||||
use function implode;
|
||||
|
||||
class PhpDocNode implements Node
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var PhpDocChildNode[] */
|
||||
public $children;
|
||||
|
||||
/**
|
||||
* @param PhpDocChildNode[] $children
|
||||
*/
|
||||
public function __construct(array $children)
|
||||
{
|
||||
$this->children = $children;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return PhpDocTagNode[]
|
||||
*/
|
||||
public function getTags(): array
|
||||
{
|
||||
return array_filter($this->children, static function (PhpDocChildNode $child): bool {
|
||||
return $child instanceof PhpDocTagNode;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return PhpDocTagNode[]
|
||||
*/
|
||||
public function getTagsByName(string $tagName): array
|
||||
{
|
||||
return array_filter($this->getTags(), static function (PhpDocTagNode $tag) use ($tagName): bool {
|
||||
return $tag->name === $tagName;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return VarTagValueNode[]
|
||||
*/
|
||||
public function getVarTagValues(string $tagName = '@var'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof VarTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return ParamTagValueNode[]
|
||||
*/
|
||||
public function getParamTagValues(string $tagName = '@param'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof ParamTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return TypelessParamTagValueNode[]
|
||||
*/
|
||||
public function getTypelessParamTagValues(string $tagName = '@param'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof TypelessParamTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return TemplateTagValueNode[]
|
||||
*/
|
||||
public function getTemplateTagValues(string $tagName = '@template'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof TemplateTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return ExtendsTagValueNode[]
|
||||
*/
|
||||
public function getExtendsTagValues(string $tagName = '@extends'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof ExtendsTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return ImplementsTagValueNode[]
|
||||
*/
|
||||
public function getImplementsTagValues(string $tagName = '@implements'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof ImplementsTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return UsesTagValueNode[]
|
||||
*/
|
||||
public function getUsesTagValues(string $tagName = '@use'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof UsesTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return ReturnTagValueNode[]
|
||||
*/
|
||||
public function getReturnTagValues(string $tagName = '@return'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof ReturnTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return ThrowsTagValueNode[]
|
||||
*/
|
||||
public function getThrowsTagValues(string $tagName = '@throws'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof ThrowsTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return MixinTagValueNode[]
|
||||
*/
|
||||
public function getMixinTagValues(string $tagName = '@mixin'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof MixinTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return DeprecatedTagValueNode[]
|
||||
*/
|
||||
public function getDeprecatedTagValues(): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName('@deprecated'), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof DeprecatedTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return PropertyTagValueNode[]
|
||||
*/
|
||||
public function getPropertyTagValues(string $tagName = '@property'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof PropertyTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return PropertyTagValueNode[]
|
||||
*/
|
||||
public function getPropertyReadTagValues(string $tagName = '@property-read'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof PropertyTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return PropertyTagValueNode[]
|
||||
*/
|
||||
public function getPropertyWriteTagValues(string $tagName = '@property-write'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof PropertyTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return MethodTagValueNode[]
|
||||
*/
|
||||
public function getMethodTagValues(string $tagName = '@method'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof MethodTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return TypeAliasTagValueNode[]
|
||||
*/
|
||||
public function getTypeAliasTagValues(string $tagName = '@phpstan-type'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof TypeAliasTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return TypeAliasImportTagValueNode[]
|
||||
*/
|
||||
public function getTypeAliasImportTagValues(string $tagName = '@phpstan-import-type'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof TypeAliasImportTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return AssertTagValueNode[]
|
||||
*/
|
||||
public function getAssertTagValues(string $tagName = '@phpstan-assert'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof AssertTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return AssertTagPropertyValueNode[]
|
||||
*/
|
||||
public function getAssertPropertyTagValues(string $tagName = '@phpstan-assert'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof AssertTagPropertyValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return AssertTagMethodValueNode[]
|
||||
*/
|
||||
public function getAssertMethodTagValues(string $tagName = '@phpstan-assert'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof AssertTagMethodValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return SelfOutTagValueNode[]
|
||||
*/
|
||||
public function getSelfOutTypeTagValues(string $tagName = '@phpstan-this-out'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof SelfOutTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return ParamOutTagValueNode[]
|
||||
*/
|
||||
public function getParamOutTypeTagValues(string $tagName = '@param-out'): array
|
||||
{
|
||||
return array_filter(
|
||||
array_column($this->getTagsByName($tagName), 'value'),
|
||||
static function (PhpDocTagValueNode $value): bool {
|
||||
return $value instanceof ParamOutTagValueNode;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$children = array_map(
|
||||
static function (PhpDocChildNode $child): string {
|
||||
$s = (string) $child;
|
||||
return $s === '' ? '' : ' ' . $s;
|
||||
},
|
||||
$this->children
|
||||
);
|
||||
return "/**\n *" . implode("\n *", $children) . "\n */";
|
||||
}
|
||||
|
||||
}
|
||||
31
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTagNode.php
vendored
Normal file
31
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTagNode.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function trim;
|
||||
|
||||
class PhpDocTagNode implements PhpDocChildNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string */
|
||||
public $name;
|
||||
|
||||
/** @var PhpDocTagValueNode */
|
||||
public $value;
|
||||
|
||||
public function __construct(string $name, PhpDocTagValueNode $value)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim("{$this->name} {$this->value}");
|
||||
}
|
||||
|
||||
}
|
||||
10
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTagValueNode.php
vendored
Normal file
10
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTagValueNode.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
|
||||
interface PhpDocTagValueNode extends Node
|
||||
{
|
||||
|
||||
}
|
||||
26
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTextNode.php
vendored
Normal file
26
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PhpDocTextNode.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class PhpDocTextNode implements PhpDocChildNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string */
|
||||
public $text;
|
||||
|
||||
public function __construct(string $text)
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
}
|
||||
36
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PropertyTagValueNode.php
vendored
Normal file
36
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/PropertyTagValueNode.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class PropertyTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string */
|
||||
public $propertyName;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(TypeNode $type, string $propertyName, string $description)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->propertyName = $propertyName;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim("{$this->type} {$this->propertyName} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ReturnTagValueNode.php
vendored
Normal file
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ReturnTagValueNode.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class ReturnTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(TypeNode $type, string $description)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim("{$this->type} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/SelfOutTagValueNode.php
vendored
Normal file
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/SelfOutTagValueNode.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class SelfOutTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(TypeNode $type, string $description)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim($this->type . ' ' . $this->description);
|
||||
}
|
||||
|
||||
}
|
||||
42
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TemplateTagValueNode.php
vendored
Normal file
42
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TemplateTagValueNode.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class TemplateTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string */
|
||||
public $name;
|
||||
|
||||
/** @var TypeNode|null */
|
||||
public $bound;
|
||||
|
||||
/** @var TypeNode|null */
|
||||
public $default;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(string $name, ?TypeNode $bound, string $description, ?TypeNode $default = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->bound = $bound;
|
||||
$this->default = $default;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$bound = $this->bound !== null ? " of {$this->bound}" : '';
|
||||
$default = $this->default !== null ? " = {$this->default}" : '';
|
||||
return trim("{$this->name}{$bound}{$default} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ThrowsTagValueNode.php
vendored
Normal file
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/ThrowsTagValueNode.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class ThrowsTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(TypeNode $type, string $description)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim("{$this->type} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
38
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypeAliasImportTagValueNode.php
vendored
Normal file
38
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypeAliasImportTagValueNode.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use function trim;
|
||||
|
||||
class TypeAliasImportTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string */
|
||||
public $importedAlias;
|
||||
|
||||
/** @var IdentifierTypeNode */
|
||||
public $importedFrom;
|
||||
|
||||
/** @var string|null */
|
||||
public $importedAs;
|
||||
|
||||
public function __construct(string $importedAlias, IdentifierTypeNode $importedFrom, ?string $importedAs)
|
||||
{
|
||||
$this->importedAlias = $importedAlias;
|
||||
$this->importedFrom = $importedFrom;
|
||||
$this->importedAs = $importedAs;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim(
|
||||
"{$this->importedAlias} from {$this->importedFrom}"
|
||||
. ($this->importedAs !== null ? " as {$this->importedAs}" : '')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypeAliasTagValueNode.php
vendored
Normal file
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypeAliasTagValueNode.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class TypeAliasTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string */
|
||||
public $alias;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
public function __construct(string $alias, TypeNode $type)
|
||||
{
|
||||
$this->alias = $alias;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim("{$this->alias} {$this->type}");
|
||||
}
|
||||
|
||||
}
|
||||
41
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypelessParamTagValueNode.php
vendored
Normal file
41
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/TypelessParamTagValueNode.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function trim;
|
||||
|
||||
class TypelessParamTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var bool */
|
||||
public $isReference;
|
||||
|
||||
/** @var bool */
|
||||
public $isVariadic;
|
||||
|
||||
/** @var string */
|
||||
public $parameterName;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(bool $isVariadic, string $parameterName, string $description, bool $isReference = false)
|
||||
{
|
||||
$this->isReference = $isReference;
|
||||
$this->isVariadic = $isVariadic;
|
||||
$this->parameterName = $parameterName;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$reference = $this->isReference ? '&' : '';
|
||||
$variadic = $this->isVariadic ? '...' : '';
|
||||
return trim("{$reference}{$variadic}{$this->parameterName} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/UsesTagValueNode.php
vendored
Normal file
32
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/UsesTagValueNode.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
|
||||
use function trim;
|
||||
|
||||
class UsesTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var GenericTypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(GenericTypeNode $type, string $description)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim("{$this->type} {$this->description}");
|
||||
}
|
||||
|
||||
}
|
||||
36
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/VarTagValueNode.php
vendored
Normal file
36
vendor/phpstan/phpdoc-parser/src/Ast/PhpDoc/VarTagValueNode.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\PhpDoc;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use function trim;
|
||||
|
||||
class VarTagValueNode implements PhpDocTagValueNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $variableName;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $description;
|
||||
|
||||
public function __construct(TypeNode $type, string $variableName, string $description)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->variableName = $variableName;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return trim("$this->type " . trim("{$this->variableName} {$this->description}"));
|
||||
}
|
||||
|
||||
}
|
||||
49
vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeItemNode.php
vendored
Normal file
49
vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeItemNode.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprIntegerNode;
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprStringNode;
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function sprintf;
|
||||
|
||||
class ArrayShapeItemNode implements TypeNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var ConstExprIntegerNode|ConstExprStringNode|IdentifierTypeNode|null */
|
||||
public $keyName;
|
||||
|
||||
/** @var bool */
|
||||
public $optional;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $valueType;
|
||||
|
||||
/**
|
||||
* @param ConstExprIntegerNode|ConstExprStringNode|IdentifierTypeNode|null $keyName
|
||||
*/
|
||||
public function __construct($keyName, bool $optional, TypeNode $valueType)
|
||||
{
|
||||
$this->keyName = $keyName;
|
||||
$this->optional = $optional;
|
||||
$this->valueType = $valueType;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
if ($this->keyName !== null) {
|
||||
return sprintf(
|
||||
'%s%s: %s',
|
||||
(string) $this->keyName,
|
||||
$this->optional ? '?' : '',
|
||||
(string) $this->valueType
|
||||
);
|
||||
}
|
||||
|
||||
return (string) $this->valueType;
|
||||
}
|
||||
|
||||
}
|
||||
47
vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeNode.php
vendored
Normal file
47
vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayShapeNode.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function implode;
|
||||
|
||||
class ArrayShapeNode implements TypeNode
|
||||
{
|
||||
|
||||
public const KIND_ARRAY = 'array';
|
||||
public const KIND_LIST = 'list';
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var ArrayShapeItemNode[] */
|
||||
public $items;
|
||||
|
||||
/** @var bool */
|
||||
public $sealed;
|
||||
|
||||
/** @var self::KIND_* */
|
||||
public $kind;
|
||||
|
||||
/**
|
||||
* @param self::KIND_* $kind
|
||||
*/
|
||||
public function __construct(array $items, bool $sealed = true, string $kind = self::KIND_ARRAY)
|
||||
{
|
||||
$this->items = $items;
|
||||
$this->sealed = $sealed;
|
||||
$this->kind = $kind;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$items = $this->items;
|
||||
|
||||
if (! $this->sealed) {
|
||||
$items[] = '...';
|
||||
}
|
||||
|
||||
return $this->kind . '{' . implode(', ', $items) . '}';
|
||||
}
|
||||
|
||||
}
|
||||
26
vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayTypeNode.php
vendored
Normal file
26
vendor/phpstan/phpdoc-parser/src/Ast/Type/ArrayTypeNode.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class ArrayTypeNode implements TypeNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
public function __construct(TypeNode $type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->type . '[]';
|
||||
}
|
||||
|
||||
}
|
||||
36
vendor/phpstan/phpdoc-parser/src/Ast/Type/CallableTypeNode.php
vendored
Normal file
36
vendor/phpstan/phpdoc-parser/src/Ast/Type/CallableTypeNode.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function implode;
|
||||
|
||||
class CallableTypeNode implements TypeNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var IdentifierTypeNode */
|
||||
public $identifier;
|
||||
|
||||
/** @var CallableTypeParameterNode[] */
|
||||
public $parameters;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $returnType;
|
||||
|
||||
public function __construct(IdentifierTypeNode $identifier, array $parameters, TypeNode $returnType)
|
||||
{
|
||||
$this->identifier = $identifier;
|
||||
$this->parameters = $parameters;
|
||||
$this->returnType = $returnType;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$parameters = implode(', ', $this->parameters);
|
||||
return "{$this->identifier}({$parameters}): {$this->returnType}";
|
||||
}
|
||||
|
||||
}
|
||||
48
vendor/phpstan/phpdoc-parser/src/Ast/Type/CallableTypeParameterNode.php
vendored
Normal file
48
vendor/phpstan/phpdoc-parser/src/Ast/Type/CallableTypeParameterNode.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function trim;
|
||||
|
||||
class CallableTypeParameterNode implements Node
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var bool */
|
||||
public $isReference;
|
||||
|
||||
/** @var bool */
|
||||
public $isVariadic;
|
||||
|
||||
/** @var string (may be empty) */
|
||||
public $parameterName;
|
||||
|
||||
/** @var bool */
|
||||
public $isOptional;
|
||||
|
||||
public function __construct(TypeNode $type, bool $isReference, bool $isVariadic, string $parameterName, bool $isOptional)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->isReference = $isReference;
|
||||
$this->isVariadic = $isVariadic;
|
||||
$this->parameterName = $parameterName;
|
||||
$this->isOptional = $isOptional;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$type = "{$this->type} ";
|
||||
$isReference = $this->isReference ? '&' : '';
|
||||
$isVariadic = $this->isVariadic ? '...' : '';
|
||||
$default = $this->isOptional ? ' = default' : '';
|
||||
return trim("{$type}{$isReference}{$isVariadic}{$this->parameterName}") . $default;
|
||||
}
|
||||
|
||||
}
|
||||
49
vendor/phpstan/phpdoc-parser/src/Ast/Type/ConditionalTypeForParameterNode.php
vendored
Normal file
49
vendor/phpstan/phpdoc-parser/src/Ast/Type/ConditionalTypeForParameterNode.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function sprintf;
|
||||
|
||||
class ConditionalTypeForParameterNode implements TypeNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string */
|
||||
public $parameterName;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $targetType;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $if;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $else;
|
||||
|
||||
/** @var bool */
|
||||
public $negated;
|
||||
|
||||
public function __construct(string $parameterName, TypeNode $targetType, TypeNode $if, TypeNode $else, bool $negated)
|
||||
{
|
||||
$this->parameterName = $parameterName;
|
||||
$this->targetType = $targetType;
|
||||
$this->if = $if;
|
||||
$this->else = $else;
|
||||
$this->negated = $negated;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return sprintf(
|
||||
'(%s %s %s ? %s : %s)',
|
||||
$this->parameterName,
|
||||
$this->negated ? 'is not' : 'is',
|
||||
$this->targetType,
|
||||
$this->if,
|
||||
$this->else
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
49
vendor/phpstan/phpdoc-parser/src/Ast/Type/ConditionalTypeNode.php
vendored
Normal file
49
vendor/phpstan/phpdoc-parser/src/Ast/Type/ConditionalTypeNode.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function sprintf;
|
||||
|
||||
class ConditionalTypeNode implements TypeNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $subjectType;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $targetType;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $if;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $else;
|
||||
|
||||
/** @var bool */
|
||||
public $negated;
|
||||
|
||||
public function __construct(TypeNode $subjectType, TypeNode $targetType, TypeNode $if, TypeNode $else, bool $negated)
|
||||
{
|
||||
$this->subjectType = $subjectType;
|
||||
$this->targetType = $targetType;
|
||||
$this->if = $if;
|
||||
$this->else = $else;
|
||||
$this->negated = $negated;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return sprintf(
|
||||
'(%s %s %s ? %s : %s)',
|
||||
$this->subjectType,
|
||||
$this->negated ? 'is not' : 'is',
|
||||
$this->targetType,
|
||||
$this->if,
|
||||
$this->else
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
26
vendor/phpstan/phpdoc-parser/src/Ast/Type/ConstTypeNode.php
vendored
Normal file
26
vendor/phpstan/phpdoc-parser/src/Ast/Type/ConstTypeNode.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\ConstExpr\ConstExprNode;
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class ConstTypeNode implements TypeNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var ConstExprNode */
|
||||
public $constExpr;
|
||||
|
||||
public function __construct(ConstExprNode $constExpr)
|
||||
{
|
||||
$this->constExpr = $constExpr;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->constExpr->__toString();
|
||||
}
|
||||
|
||||
}
|
||||
54
vendor/phpstan/phpdoc-parser/src/Ast/Type/GenericTypeNode.php
vendored
Normal file
54
vendor/phpstan/phpdoc-parser/src/Ast/Type/GenericTypeNode.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function implode;
|
||||
use function sprintf;
|
||||
|
||||
class GenericTypeNode implements TypeNode
|
||||
{
|
||||
|
||||
public const VARIANCE_INVARIANT = 'invariant';
|
||||
public const VARIANCE_COVARIANT = 'covariant';
|
||||
public const VARIANCE_CONTRAVARIANT = 'contravariant';
|
||||
public const VARIANCE_BIVARIANT = 'bivariant';
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var IdentifierTypeNode */
|
||||
public $type;
|
||||
|
||||
/** @var TypeNode[] */
|
||||
public $genericTypes;
|
||||
|
||||
/** @var (self::VARIANCE_*)[] */
|
||||
public $variances;
|
||||
|
||||
public function __construct(IdentifierTypeNode $type, array $genericTypes, array $variances = [])
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->genericTypes = $genericTypes;
|
||||
$this->variances = $variances;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$genericTypes = [];
|
||||
|
||||
foreach ($this->genericTypes as $index => $type) {
|
||||
$variance = $this->variances[$index] ?? self::VARIANCE_INVARIANT;
|
||||
if ($variance === self::VARIANCE_INVARIANT) {
|
||||
$genericTypes[] = (string) $type;
|
||||
} elseif ($variance === self::VARIANCE_BIVARIANT) {
|
||||
$genericTypes[] = '*';
|
||||
} else {
|
||||
$genericTypes[] = sprintf('%s %s', $variance, $type);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->type . '<' . implode(', ', $genericTypes) . '>';
|
||||
}
|
||||
|
||||
}
|
||||
26
vendor/phpstan/phpdoc-parser/src/Ast/Type/IdentifierTypeNode.php
vendored
Normal file
26
vendor/phpstan/phpdoc-parser/src/Ast/Type/IdentifierTypeNode.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class IdentifierTypeNode implements TypeNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var string */
|
||||
public $name;
|
||||
|
||||
public function __construct(string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
}
|
||||
27
vendor/phpstan/phpdoc-parser/src/Ast/Type/IntersectionTypeNode.php
vendored
Normal file
27
vendor/phpstan/phpdoc-parser/src/Ast/Type/IntersectionTypeNode.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
use function implode;
|
||||
|
||||
class IntersectionTypeNode implements TypeNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode[] */
|
||||
public $types;
|
||||
|
||||
public function __construct(array $types)
|
||||
{
|
||||
$this->types = $types;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return '(' . implode(' & ', $this->types) . ')';
|
||||
}
|
||||
|
||||
}
|
||||
26
vendor/phpstan/phpdoc-parser/src/Ast/Type/NullableTypeNode.php
vendored
Normal file
26
vendor/phpstan/phpdoc-parser/src/Ast/Type/NullableTypeNode.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace PHPStan\PhpDocParser\Ast\Type;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\NodeAttributes;
|
||||
|
||||
class NullableTypeNode implements TypeNode
|
||||
{
|
||||
|
||||
use NodeAttributes;
|
||||
|
||||
/** @var TypeNode */
|
||||
public $type;
|
||||
|
||||
public function __construct(TypeNode $type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return '?' . $this->type;
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user