[Web] Update libs

master
andryyy 2021-05-23 13:20:53 +02:00
parent e6d5516c7f
commit 8779a1a873
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
48 changed files with 656 additions and 272 deletions

View File

@ -144,16 +144,16 @@
}, },
{ {
"name": "directorytree/ldaprecord", "name": "directorytree/ldaprecord",
"version": "v2.4.4", "version": "v2.4.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/DirectoryTree/LdapRecord.git", "url": "https://github.com/DirectoryTree/LdapRecord.git",
"reference": "2d1c4d71dd900b2f8245a6e32f67274795fac8a2" "reference": "824a49feae4da52a522b3ec60ecad508b8f4ed23"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/DirectoryTree/LdapRecord/zipball/2d1c4d71dd900b2f8245a6e32f67274795fac8a2", "url": "https://api.github.com/repos/DirectoryTree/LdapRecord/zipball/824a49feae4da52a522b3ec60ecad508b8f4ed23",
"reference": "2d1c4d71dd900b2f8245a6e32f67274795fac8a2", "reference": "824a49feae4da52a522b3ec60ecad508b8f4ed23",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -167,6 +167,7 @@
"tightenco/collect": "^5.6|^6.0|^7.0|^8.0" "tightenco/collect": "^5.6|^6.0|^7.0|^8.0"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"mockery/mockery": "^1.0", "mockery/mockery": "^1.0",
"phpunit/phpunit": "^8.0" "phpunit/phpunit": "^8.0"
}, },
@ -212,20 +213,20 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-05-01T17:48:47+00:00" "time": "2021-05-11T13:29:46+00:00"
}, },
{ {
"name": "illuminate/contracts", "name": "illuminate/contracts",
"version": "v8.40.0", "version": "v8.42.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/contracts.git", "url": "https://github.com/illuminate/contracts.git",
"reference": "5152041a5c4ac4dbebb3c8ee72d05666c592ae08" "reference": "68036b4fb17ad40a599323bda3f2c0845c8100d8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/contracts/zipball/5152041a5c4ac4dbebb3c8ee72d05666c592ae08", "url": "https://api.github.com/repos/illuminate/contracts/zipball/68036b4fb17ad40a599323bda3f2c0845c8100d8",
"reference": "5152041a5c4ac4dbebb3c8ee72d05666c592ae08", "reference": "68036b4fb17ad40a599323bda3f2c0845c8100d8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -260,7 +261,7 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2021-04-23T13:31:10+00:00" "time": "2021-05-18T12:49:19+00:00"
}, },
{ {
"name": "matthiasmullie/minify", "name": "matthiasmullie/minify",
@ -445,16 +446,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.47.0", "version": "2.48.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "606262fd8888b75317ba9461825a24fc34001e1e" "reference": "d3c447f21072766cddec3522f9468a5849a76147"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/606262fd8888b75317ba9461825a24fc34001e1e", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d3c447f21072766cddec3522f9468a5849a76147",
"reference": "606262fd8888b75317ba9461825a24fc34001e1e", "reference": "d3c447f21072766cddec3522f9468a5849a76147",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -534,7 +535,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-04-13T21:54:02+00:00" "time": "2021-05-07T10:08:30+00:00"
}, },
{ {
"name": "paragonie/random_compat", "name": "paragonie/random_compat",
@ -1187,16 +1188,16 @@
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
"version": "v5.2.7", "version": "v5.2.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/translation.git", "url": "https://github.com/symfony/translation.git",
"reference": "e37ece5242564bceea54d709eafc948377ec9749" "reference": "61af68dba333e2d376a325a29c2a3f2a605b4876"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/e37ece5242564bceea54d709eafc948377ec9749", "url": "https://api.github.com/repos/symfony/translation/zipball/61af68dba333e2d376a325a29c2a3f2a605b4876",
"reference": "e37ece5242564bceea54d709eafc948377ec9749", "reference": "61af68dba333e2d376a325a29c2a3f2a605b4876",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1260,7 +1261,7 @@
"description": "Provides tools to internationalize your application", "description": "Provides tools to internationalize your application",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/translation/tree/v5.2.7" "source": "https://github.com/symfony/translation/tree/v5.2.9"
}, },
"funding": [ "funding": [
{ {
@ -1276,7 +1277,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-04-01T08:15:21+00:00" "time": "2021-05-16T13:07:46+00:00"
}, },
{ {
"name": "symfony/translation-contracts", "name": "symfony/translation-contracts",
@ -1358,16 +1359,16 @@
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v5.2.7", "version": "v5.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "27cb9f7cfa3853c736425c7233a8f68814b19636" "reference": "d693200a73fae179d27f8f1b16b4faf3e8569eba"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/27cb9f7cfa3853c736425c7233a8f68814b19636", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/d693200a73fae179d27f8f1b16b4faf3e8569eba",
"reference": "27cb9f7cfa3853c736425c7233a8f68814b19636", "reference": "d693200a73fae179d27f8f1b16b4faf3e8569eba",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1426,7 +1427,7 @@
"dump" "dump"
], ],
"support": { "support": {
"source": "https://github.com/symfony/var-dumper/tree/v5.2.7" "source": "https://github.com/symfony/var-dumper/tree/v5.2.8"
}, },
"funding": [ "funding": [
{ {
@ -1442,7 +1443,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-04-19T14:07:32+00:00" "time": "2021-05-07T13:42:21+00:00"
}, },
{ {
"name": "tightenco/collect", "name": "tightenco/collect",

View File

@ -20,6 +20,8 @@ use Composer\Semver\VersionParser;
class InstalledVersions class InstalledVersions
{ {
private static $installed = array ( private static $installed = array (
@ -64,12 +66,12 @@ private static $installed = array (
), ),
'directorytree/ldaprecord' => 'directorytree/ldaprecord' =>
array ( array (
'pretty_version' => 'v2.4.4', 'pretty_version' => 'v2.4.6',
'version' => '2.4.4.0', 'version' => '2.4.6.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '2d1c4d71dd900b2f8245a6e32f67274795fac8a2', 'reference' => '824a49feae4da52a522b3ec60ecad508b8f4ed23',
), ),
'exorus/php-mime-mail-parser' => 'exorus/php-mime-mail-parser' =>
array ( array (
@ -80,12 +82,12 @@ private static $installed = array (
), ),
'illuminate/contracts' => 'illuminate/contracts' =>
array ( array (
'pretty_version' => 'v8.40.0', 'pretty_version' => 'v8.42.1',
'version' => '8.40.0.0', 'version' => '8.42.1.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '5152041a5c4ac4dbebb3c8ee72d05666c592ae08', 'reference' => '68036b4fb17ad40a599323bda3f2c0845c8100d8',
), ),
'matthiasmullie/minify' => 'matthiasmullie/minify' =>
array ( array (
@ -123,12 +125,12 @@ private static $installed = array (
), ),
'nesbot/carbon' => 'nesbot/carbon' =>
array ( array (
'pretty_version' => '2.47.0', 'pretty_version' => '2.48.0',
'version' => '2.47.0.0', 'version' => '2.48.0.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '606262fd8888b75317ba9461825a24fc34001e1e', 'reference' => 'd3c447f21072766cddec3522f9468a5849a76147',
), ),
'paragonie/random_compat' => 'paragonie/random_compat' =>
array ( array (
@ -222,12 +224,12 @@ private static $installed = array (
), ),
'symfony/translation' => 'symfony/translation' =>
array ( array (
'pretty_version' => 'v5.2.7', 'pretty_version' => 'v5.2.9',
'version' => '5.2.7.0', 'version' => '5.2.9.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'e37ece5242564bceea54d709eafc948377ec9749', 'reference' => '61af68dba333e2d376a325a29c2a3f2a605b4876',
), ),
'symfony/translation-contracts' => 'symfony/translation-contracts' =>
array ( array (
@ -247,12 +249,12 @@ private static $installed = array (
), ),
'symfony/var-dumper' => 'symfony/var-dumper' =>
array ( array (
'pretty_version' => 'v5.2.7', 'pretty_version' => 'v5.2.8',
'version' => '5.2.7.0', 'version' => '5.2.8.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '27cb9f7cfa3853c736425c7233a8f68814b19636', 'reference' => 'd693200a73fae179d27f8f1b16b4faf3e8569eba',
), ),
'tightenco/collect' => 'tightenco/collect' =>
array ( array (
@ -290,7 +292,6 @@ foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']); $packages[] = array_keys($installed['versions']);
} }
if (1 === \count($packages)) { if (1 === \count($packages)) {
return $packages[0]; return $packages[0];
} }
@ -486,6 +487,7 @@ self::$installedByVendor = array();
private static function getInstalled() private static function getInstalled()
{ {
if (null === self::$canGetVendors) { if (null === self::$canGetVendors) {

View File

@ -140,17 +140,17 @@
}, },
{ {
"name": "directorytree/ldaprecord", "name": "directorytree/ldaprecord",
"version": "v2.4.4", "version": "v2.4.6",
"version_normalized": "2.4.4.0", "version_normalized": "2.4.6.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/DirectoryTree/LdapRecord.git", "url": "https://github.com/DirectoryTree/LdapRecord.git",
"reference": "2d1c4d71dd900b2f8245a6e32f67274795fac8a2" "reference": "824a49feae4da52a522b3ec60ecad508b8f4ed23"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/DirectoryTree/LdapRecord/zipball/2d1c4d71dd900b2f8245a6e32f67274795fac8a2", "url": "https://api.github.com/repos/DirectoryTree/LdapRecord/zipball/824a49feae4da52a522b3ec60ecad508b8f4ed23",
"reference": "2d1c4d71dd900b2f8245a6e32f67274795fac8a2", "reference": "824a49feae4da52a522b3ec60ecad508b8f4ed23",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -164,10 +164,11 @@
"tightenco/collect": "^5.6|^6.0|^7.0|^8.0" "tightenco/collect": "^5.6|^6.0|^7.0|^8.0"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"mockery/mockery": "^1.0", "mockery/mockery": "^1.0",
"phpunit/phpunit": "^8.0" "phpunit/phpunit": "^8.0"
}, },
"time": "2021-05-01T17:48:47+00:00", "time": "2021-05-11T13:29:46+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -215,17 +216,17 @@
}, },
{ {
"name": "illuminate/contracts", "name": "illuminate/contracts",
"version": "v8.40.0", "version": "v8.42.1",
"version_normalized": "8.40.0.0", "version_normalized": "8.42.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/contracts.git", "url": "https://github.com/illuminate/contracts.git",
"reference": "5152041a5c4ac4dbebb3c8ee72d05666c592ae08" "reference": "68036b4fb17ad40a599323bda3f2c0845c8100d8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/contracts/zipball/5152041a5c4ac4dbebb3c8ee72d05666c592ae08", "url": "https://api.github.com/repos/illuminate/contracts/zipball/68036b4fb17ad40a599323bda3f2c0845c8100d8",
"reference": "5152041a5c4ac4dbebb3c8ee72d05666c592ae08", "reference": "68036b4fb17ad40a599323bda3f2c0845c8100d8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -233,7 +234,7 @@
"psr/container": "^1.0", "psr/container": "^1.0",
"psr/simple-cache": "^1.0" "psr/simple-cache": "^1.0"
}, },
"time": "2021-04-23T13:31:10+00:00", "time": "2021-05-18T12:49:19+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
@ -452,17 +453,17 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.47.0", "version": "2.48.0",
"version_normalized": "2.47.0.0", "version_normalized": "2.48.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "606262fd8888b75317ba9461825a24fc34001e1e" "reference": "d3c447f21072766cddec3522f9468a5849a76147"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/606262fd8888b75317ba9461825a24fc34001e1e", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d3c447f21072766cddec3522f9468a5849a76147",
"reference": "606262fd8888b75317ba9461825a24fc34001e1e", "reference": "d3c447f21072766cddec3522f9468a5849a76147",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -481,7 +482,7 @@
"phpunit/phpunit": "^7.5.20 || ^8.5.14", "phpunit/phpunit": "^7.5.20 || ^8.5.14",
"squizlabs/php_codesniffer": "^3.4" "squizlabs/php_codesniffer": "^3.4"
}, },
"time": "2021-04-13T21:54:02+00:00", "time": "2021-05-07T10:08:30+00:00",
"bin": [ "bin": [
"bin/carbon" "bin/carbon"
], ],
@ -1218,17 +1219,17 @@
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
"version": "v5.2.7", "version": "v5.2.9",
"version_normalized": "5.2.7.0", "version_normalized": "5.2.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/translation.git", "url": "https://github.com/symfony/translation.git",
"reference": "e37ece5242564bceea54d709eafc948377ec9749" "reference": "61af68dba333e2d376a325a29c2a3f2a605b4876"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/e37ece5242564bceea54d709eafc948377ec9749", "url": "https://api.github.com/repos/symfony/translation/zipball/61af68dba333e2d376a325a29c2a3f2a605b4876",
"reference": "e37ece5242564bceea54d709eafc948377ec9749", "reference": "61af68dba333e2d376a325a29c2a3f2a605b4876",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1263,7 +1264,7 @@
"symfony/config": "", "symfony/config": "",
"symfony/yaml": "" "symfony/yaml": ""
}, },
"time": "2021-04-01T08:15:21+00:00", "time": "2021-05-16T13:07:46+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -1294,7 +1295,7 @@
"description": "Provides tools to internationalize your application", "description": "Provides tools to internationalize your application",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/translation/tree/v5.2.7" "source": "https://github.com/symfony/translation/tree/v5.2.9"
}, },
"funding": [ "funding": [
{ {
@ -1395,17 +1396,17 @@
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v5.2.7", "version": "v5.2.8",
"version_normalized": "5.2.7.0", "version_normalized": "5.2.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "27cb9f7cfa3853c736425c7233a8f68814b19636" "reference": "d693200a73fae179d27f8f1b16b4faf3e8569eba"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/27cb9f7cfa3853c736425c7233a8f68814b19636", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/d693200a73fae179d27f8f1b16b4faf3e8569eba",
"reference": "27cb9f7cfa3853c736425c7233a8f68814b19636", "reference": "d693200a73fae179d27f8f1b16b4faf3e8569eba",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1428,7 +1429,7 @@
"ext-intl": "To show region name in time zone dump", "ext-intl": "To show region name in time zone dump",
"symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script"
}, },
"time": "2021-04-19T14:07:32+00:00", "time": "2021-05-07T13:42:21+00:00",
"bin": [ "bin": [
"Resources/bin/var-dump-server" "Resources/bin/var-dump-server"
], ],
@ -1466,7 +1467,7 @@
"dump" "dump"
], ],
"support": { "support": {
"source": "https://github.com/symfony/var-dumper/tree/v5.2.7" "source": "https://github.com/symfony/var-dumper/tree/v5.2.8"
}, },
"funding": [ "funding": [
{ {

View File

@ -40,12 +40,12 @@
), ),
'directorytree/ldaprecord' => 'directorytree/ldaprecord' =>
array ( array (
'pretty_version' => 'v2.4.4', 'pretty_version' => 'v2.4.6',
'version' => '2.4.4.0', 'version' => '2.4.6.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '2d1c4d71dd900b2f8245a6e32f67274795fac8a2', 'reference' => '824a49feae4da52a522b3ec60ecad508b8f4ed23',
), ),
'exorus/php-mime-mail-parser' => 'exorus/php-mime-mail-parser' =>
array ( array (
@ -56,12 +56,12 @@
), ),
'illuminate/contracts' => 'illuminate/contracts' =>
array ( array (
'pretty_version' => 'v8.40.0', 'pretty_version' => 'v8.42.1',
'version' => '8.40.0.0', 'version' => '8.42.1.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '5152041a5c4ac4dbebb3c8ee72d05666c592ae08', 'reference' => '68036b4fb17ad40a599323bda3f2c0845c8100d8',
), ),
'matthiasmullie/minify' => 'matthiasmullie/minify' =>
array ( array (
@ -99,12 +99,12 @@
), ),
'nesbot/carbon' => 'nesbot/carbon' =>
array ( array (
'pretty_version' => '2.47.0', 'pretty_version' => '2.48.0',
'version' => '2.47.0.0', 'version' => '2.48.0.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '606262fd8888b75317ba9461825a24fc34001e1e', 'reference' => 'd3c447f21072766cddec3522f9468a5849a76147',
), ),
'paragonie/random_compat' => 'paragonie/random_compat' =>
array ( array (
@ -198,12 +198,12 @@
), ),
'symfony/translation' => 'symfony/translation' =>
array ( array (
'pretty_version' => 'v5.2.7', 'pretty_version' => 'v5.2.9',
'version' => '5.2.7.0', 'version' => '5.2.9.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'e37ece5242564bceea54d709eafc948377ec9749', 'reference' => '61af68dba333e2d376a325a29c2a3f2a605b4876',
), ),
'symfony/translation-contracts' => 'symfony/translation-contracts' =>
array ( array (
@ -223,12 +223,12 @@
), ),
'symfony/var-dumper' => 'symfony/var-dumper' =>
array ( array (
'pretty_version' => 'v5.2.7', 'pretty_version' => 'v5.2.8',
'version' => '5.2.7.0', 'version' => '5.2.8.0',
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => '27cb9f7cfa3853c736425c7233a8f68814b19636', 'reference' => 'd693200a73fae179d27f8f1b16b4faf3e8569eba',
), ),
'tightenco/collect' => 'tightenco/collect' =>
array ( array (

View File

@ -10,17 +10,24 @@ jobs:
php-cs-fixer: php-cs-fixer:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout Code
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
ref: ${{ github.head_ref }} ref: ${{ github.head_ref }}
- name: Fix style - name: Setup PHP
uses: docker://oskarstark/php-cs-fixer-ga uses: shivammathur/setup-php@v1
with: with:
args: --config=.php_cs --allow-risky=yes php-version: '7.4'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
- name: Commit changes - name: Install Dependencies
run: composer install --prefer-dist
- name: Fix Style
run: ./vendor/bin/php-cs-fixer fix --diff --allow-risky=yes
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v4 uses: stefanzweifel/git-auto-commit-action@v4
with: with:
commit_message: Fix styling changes commit_message: Fix styling changes

View File

@ -2,3 +2,4 @@ vendor
composer.lock composer.lock
.php_cs.cache .php_cs.cache
.phpunit.result.cache .phpunit.result.cache
.php-cs-fixer.cache

View File

@ -1,35 +1,36 @@
<?php <?php
$finder = Symfony\Component\Finder\Finder::create() $finder = (new Symfony\Component\Finder\Finder)
->in([ ->in([
__DIR__ . '/src', __DIR__.'/src',
__DIR__ . '/tests', __DIR__.'/tests',
]) ])
->name('*.php') ->name('*.php')
->ignoreVCS(true) ->ignoreVCS(true)
->ignoreDotFiles(true); ->ignoreDotFiles(true);
return PhpCsFixer\Config::create() return (new PhpCsFixer\Config)
->setRules([ ->setRules([
'array_syntax' => ['syntax' => 'short'], 'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [ 'binary_operator_spaces' => [
'default' => 'single_space', 'default' => 'single_space',
'operators' => ['=>' => null] 'operators' => ['=>' => null],
], ],
'blank_line_after_namespace' => true, 'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true, 'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => [ 'blank_line_before_statement' => [
'statements' => ['return'] 'statements' => ['return'],
], ],
'braces' => true, 'braces' => true,
'cast_spaces' => true, 'cast_spaces' => true,
'class_attributes_separation' => [ 'class_attributes_separation' => [
'elements' => ['method'] 'elements' => ['method' => 'one'],
], ],
'class_definition' => true, 'class_definition' => true,
'concat_space' => [ 'concat_space' => [
'spacing' => 'none' 'spacing' => 'none',
], ],
'constant_case' => true,
'declare_equal_normalize' => true, 'declare_equal_normalize' => true,
'elseif' => true, 'elseif' => true,
'encoding' => true, 'encoding' => true,
@ -37,6 +38,7 @@ return PhpCsFixer\Config::create()
'fully_qualified_strict_types' => true, 'fully_qualified_strict_types' => true,
'function_declaration' => true, 'function_declaration' => true,
'function_typehint_space' => true, 'function_typehint_space' => true,
'general_phpdoc_tag_rename' => true,
'heredoc_to_nowdoc' => true, 'heredoc_to_nowdoc' => true,
'include' => true, 'include' => true,
'increment_style' => ['style' => 'post'], 'increment_style' => ['style' => 'post'],
@ -44,7 +46,6 @@ return PhpCsFixer\Config::create()
'linebreak_after_opening_tag' => true, 'linebreak_after_opening_tag' => true,
'line_ending' => true, 'line_ending' => true,
'lowercase_cast' => true, 'lowercase_cast' => true,
'lowercase_constants' => true,
'lowercase_keywords' => true, 'lowercase_keywords' => true,
'lowercase_static_reference' => true, 'lowercase_static_reference' => true,
'magic_method_casing' => true, 'magic_method_casing' => true,
@ -58,7 +59,7 @@ return PhpCsFixer\Config::create()
'throw', 'throw',
'use', 'use',
'use_trait', 'use_trait',
] ],
], ],
'no_blank_lines_after_class_opening' => true, 'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true, 'no_blank_lines_after_phpdoc' => true,
@ -68,11 +69,11 @@ return PhpCsFixer\Config::create()
'no_leading_import_slash' => true, 'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true, 'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => [ 'no_mixed_echo_print' => [
'use' => 'echo' 'use' => 'echo',
], ],
'no_multiline_whitespace_around_double_arrow' => true, 'no_multiline_whitespace_around_double_arrow' => true,
'multiline_whitespace_before_semicolons' => [ 'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line' 'strategy' => 'no_multi_line',
], ],
'no_short_bool_cast' => true, 'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true, 'no_singleline_whitespace_before_semicolons' => true,
@ -92,10 +93,10 @@ return PhpCsFixer\Config::create()
'normalize_index_brace' => true, 'normalize_index_brace' => true,
'not_operator_with_successor_space' => true, 'not_operator_with_successor_space' => true,
'object_operator_without_whitespace' => true, 'object_operator_without_whitespace' => true,
'ordered_imports' => ['sortAlgorithm' => 'alpha'], 'ordered_imports' => ['sort_algorithm' => 'alpha'],
'phpdoc_align' => true, 'phpdoc_align' => true,
'phpdoc_indent' => true, 'phpdoc_indent' => true,
'phpdoc_inline_tag' => true, 'phpdoc_inline_tag_normalizer' => true,
'phpdoc_no_access' => true, 'phpdoc_no_access' => true,
'phpdoc_no_package' => true, 'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true, 'phpdoc_no_useless_inheritdoc' => true,
@ -103,13 +104,14 @@ return PhpCsFixer\Config::create()
'phpdoc_single_line_var_spacing' => true, 'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => true, 'phpdoc_summary' => true,
'phpdoc_to_comment' => true, 'phpdoc_to_comment' => true,
'phpdoc_tag_type' => true,
'phpdoc_trim' => true, 'phpdoc_trim' => true,
'phpdoc_types' => true, 'phpdoc_types' => true,
'phpdoc_var_without_name' => true, 'phpdoc_var_without_name' => true,
'php_unit_method_casing' => [ 'php_unit_method_casing' => [
'case' => 'snake_case', 'case' => 'snake_case',
], ],
'psr4' => true, 'psr_autoloading' => true,
'self_accessor' => true, 'self_accessor' => true,
'short_scalar_cast' => true, 'short_scalar_cast' => true,
'simplified_null_return' => false, 'simplified_null_return' => false,
@ -119,7 +121,7 @@ return PhpCsFixer\Config::create()
'single_import_per_statement' => true, 'single_import_per_statement' => true,
'single_line_after_imports' => true, 'single_line_after_imports' => true,
'single_line_comment_style' => [ 'single_line_comment_style' => [
'comment_types' => ['hash'] 'comment_types' => ['hash'],
], ],
'single_quote' => true, 'single_quote' => true,
'space_after_semicolon' => true, 'space_after_semicolon' => true,
@ -127,11 +129,13 @@ return PhpCsFixer\Config::create()
'switch_case_semicolon_to_colon' => true, 'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true, 'switch_case_space' => true,
'ternary_operator_spaces' => true, 'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true, 'trailing_comma_in_multiline' => [
'elements' => ['arrays'],
],
'trim_array_spaces' => true, 'trim_array_spaces' => true,
'unary_operator_spaces' => true, 'unary_operator_spaces' => true,
'visibility_required' => [ 'visibility_required' => [
'elements' => ['method', 'property'] 'elements' => ['method', 'property'],
], ],
'whitespace_after_comma_in_array' => true, 'whitespace_after_comma_in_array' => true,
])->setFinder($finder); ])->setFinder($finder);

View File

@ -40,7 +40,8 @@
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^8.0", "phpunit/phpunit": "^8.0",
"mockery/mockery": "^1.0" "mockery/mockery": "^1.0",
"friendsofphp/php-cs-fixer": "^3.0"
}, },
"archive": { "archive": {
"exclude": ["/tests"] "exclude": ["/tests"]

View File

@ -7,7 +7,7 @@ use LdapRecord\Configuration\ConfigurationException;
class ArrayValidator extends Validator class ArrayValidator extends Validator
{ {
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function validate() public function validate()
{ {

View File

@ -7,7 +7,7 @@ use LdapRecord\Configuration\ConfigurationException;
class BooleanValidator extends Validator class BooleanValidator extends Validator
{ {
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function validate() public function validate()
{ {

View File

@ -7,7 +7,7 @@ use LdapRecord\Configuration\ConfigurationException;
class IntegerValidator extends Validator class IntegerValidator extends Validator
{ {
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function validate() public function validate()
{ {

View File

@ -7,7 +7,7 @@ use LdapRecord\Configuration\ConfigurationException;
class StringOrNullValidator extends Validator class StringOrNullValidator extends Validator
{ {
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function validate() public function validate()
{ {

View File

@ -4,7 +4,6 @@ namespace LdapRecord;
use Carbon\Carbon; use Carbon\Carbon;
use Closure; use Closure;
use Exception;
use LdapRecord\Auth\Guard; use LdapRecord\Auth\Guard;
use LdapRecord\Configuration\DomainConfiguration; use LdapRecord\Configuration\DomainConfiguration;
use LdapRecord\Events\DispatcherInterface; use LdapRecord\Events\DispatcherInterface;
@ -138,8 +137,6 @@ class Connection
{ {
$this->ldap = $ldap; $this->ldap = $ldap;
$this->initialize();
return $this; return $this;
} }
@ -404,6 +401,10 @@ class Connection
*/ */
public function auth() public function auth()
{ {
if (! $this->ldap->isConnected()) {
$this->initialize();
}
$guard = call_user_func($this->authGuardResolver); $guard = call_user_func($this->authGuardResolver);
$guard->setDispatcher( $guard->setDispatcher(

View File

@ -41,7 +41,7 @@ class Dispatcher implements DispatcherInterface
protected $wildcardsCache = []; protected $wildcardsCache = [];
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function listen($events, $listener) public function listen($events, $listener)
{ {
@ -70,7 +70,7 @@ class Dispatcher implements DispatcherInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function hasListeners($eventName) public function hasListeners($eventName)
{ {
@ -78,7 +78,7 @@ class Dispatcher implements DispatcherInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function until($event, $payload = []) public function until($event, $payload = [])
{ {
@ -86,7 +86,7 @@ class Dispatcher implements DispatcherInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function fire($event, $payload = [], $halt = false) public function fire($event, $payload = [], $halt = false)
{ {
@ -94,7 +94,7 @@ class Dispatcher implements DispatcherInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function dispatch($event, $payload = [], $halt = false) public function dispatch($event, $payload = [], $halt = false)
{ {
@ -149,7 +149,7 @@ class Dispatcher implements DispatcherInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getListeners($eventName) public function getListeners($eventName)
{ {
@ -321,7 +321,7 @@ class Dispatcher implements DispatcherInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function forget($event) public function forget($event)
{ {

View File

@ -5,7 +5,7 @@ namespace LdapRecord;
class Ldap extends LdapBase class Ldap extends LdapBase
{ {
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getEntries($searchResults) public function getEntries($searchResults)
{ {
@ -97,7 +97,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getLastError() public function getLastError()
{ {
@ -109,18 +109,18 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getDetailedError() public function getDetailedError()
{ {
// If the returned error number is zero, the last LDAP operation if (! $number = $this->errNo()) {
// succeeded. In such case we won't return a detailed error. return;
if ($number = $this->errNo()) { }
$this->getOption(LDAP_OPT_DIAGNOSTIC_MESSAGE, $message); $this->getOption(LDAP_OPT_DIAGNOSTIC_MESSAGE, $message);
return new DetailedError($number, $this->err2Str($number), $message); return new DetailedError($number, $this->err2Str($number), $message);
} }
}
/** /**
* Get all binary values from the specified result entry. * Get all binary values from the specified result entry.
@ -140,7 +140,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function setOption($option, $value) public function setOption($option, $value)
{ {
@ -148,7 +148,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getOption($option, &$value = null) public function getOption($option, &$value = null)
{ {
@ -172,7 +172,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function startTLS() public function startTLS()
{ {
@ -182,7 +182,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function connect($hosts = [], $port = 389) public function connect($hosts = [], $port = 389)
{ {
@ -196,7 +196,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function close() public function close()
{ {
@ -210,12 +210,19 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function search($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = null, $serverControls = []) public function search($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = null, $serverControls = [])
{ {
return $this->executeFailableOperation(function () use ( return $this->executeFailableOperation(function () use (
$dn, $filter, $fields, $onlyAttributes, $size, $time, $deref, $serverControls $dn,
$filter,
$fields,
$onlyAttributes,
$size,
$time,
$deref,
$serverControls
) { ) {
return $this->supportsServerControlsInMethods() && ! empty($serverControls) return $this->supportsServerControlsInMethods() && ! empty($serverControls)
? ldap_search($this->connection, $dn, $filter, $fields, $onlyAttributes, $size, $time, $deref, $serverControls) ? ldap_search($this->connection, $dn, $filter, $fields, $onlyAttributes, $size, $time, $deref, $serverControls)
@ -224,12 +231,19 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function listing($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = null, $serverControls = []) public function listing($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = null, $serverControls = [])
{ {
return $this->executeFailableOperation(function () use ( return $this->executeFailableOperation(function () use (
$dn, $filter, $fields, $onlyAttributes, $size, $time, $deref, $serverControls $dn,
$filter,
$fields,
$onlyAttributes,
$size,
$time,
$deref,
$serverControls
) { ) {
return $this->supportsServerControlsInMethods() && ! empty($serverControls) return $this->supportsServerControlsInMethods() && ! empty($serverControls)
? ldap_list($this->connection, $dn, $filter, $fields, $onlyAttributes, $size, $time, $deref, $serverControls) ? ldap_list($this->connection, $dn, $filter, $fields, $onlyAttributes, $size, $time, $deref, $serverControls)
@ -238,12 +252,19 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function read($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = null, $serverControls = []) public function read($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = null, $serverControls = [])
{ {
return $this->executeFailableOperation(function () use ( return $this->executeFailableOperation(function () use (
$dn, $filter, $fields, $onlyAttributes, $size, $time, $deref, $serverControls $dn,
$filter,
$fields,
$onlyAttributes,
$size,
$time,
$deref,
$serverControls
) { ) {
return $this->supportsServerControlsInMethods() && ! empty($serverControls) return $this->supportsServerControlsInMethods() && ! empty($serverControls)
? ldap_read($this->connection, $dn, $filter, $fields, $onlyAttributes, $size, $time, $deref, $serverControls) ? ldap_read($this->connection, $dn, $filter, $fields, $onlyAttributes, $size, $time, $deref, $serverControls)
@ -252,12 +273,17 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function parseResult($result, &$errorCode, &$dn, &$errorMessage, &$referrals, &$serverControls = []) public function parseResult($result, &$errorCode, &$dn, &$errorMessage, &$referrals, &$serverControls = [])
{ {
return $this->executeFailableOperation(function () use ( return $this->executeFailableOperation(function () use (
$result, &$errorCode, &$dn, &$errorMessage, &$referrals, &$serverControls $result,
&$errorCode,
&$dn,
&$errorMessage,
&$referrals,
&$serverControls
) { ) {
return $this->supportsServerControlsInMethods() && ! empty($serverControls) return $this->supportsServerControlsInMethods() && ! empty($serverControls)
? ldap_parse_result($this->connection, $result, $errorCode, $dn, $errorMessage, $referrals, $serverControls) ? ldap_parse_result($this->connection, $result, $errorCode, $dn, $errorMessage, $referrals, $serverControls)
@ -266,7 +292,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function bind($username, $password) public function bind($username, $password)
{ {
@ -276,7 +302,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function add($dn, array $entry) public function add($dn, array $entry)
{ {
@ -286,7 +312,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function delete($dn) public function delete($dn)
{ {
@ -296,19 +322,22 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function rename($dn, $newRdn, $newParent, $deleteOldRdn = false) public function rename($dn, $newRdn, $newParent, $deleteOldRdn = false)
{ {
return $this->executeFailableOperation(function () use ( return $this->executeFailableOperation(function () use (
$dn, $newRdn, $newParent, $deleteOldRdn $dn,
$newRdn,
$newParent,
$deleteOldRdn
) { ) {
return ldap_rename($this->connection, $dn, $newRdn, $newParent, $deleteOldRdn); return ldap_rename($this->connection, $dn, $newRdn, $newParent, $deleteOldRdn);
}); });
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function modify($dn, array $entry) public function modify($dn, array $entry)
{ {
@ -318,7 +347,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function modifyBatch($dn, array $values) public function modifyBatch($dn, array $values)
{ {
@ -328,7 +357,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function modAdd($dn, array $entry) public function modAdd($dn, array $entry)
{ {
@ -338,7 +367,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function modReplace($dn, array $entry) public function modReplace($dn, array $entry)
{ {
@ -348,7 +377,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function modDelete($dn, array $entry) public function modDelete($dn, array $entry)
{ {
@ -358,7 +387,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function controlPagedResult($pageSize = 1000, $isCritical = false, $cookie = '') public function controlPagedResult($pageSize = 1000, $isCritical = false, $cookie = '')
{ {
@ -368,7 +397,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function controlPagedResultResponse($result, &$cookie, &$estimated = null) public function controlPagedResultResponse($result, &$cookie, &$estimated = null)
{ {
@ -378,7 +407,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function freeResult($result) public function freeResult($result)
{ {
@ -386,7 +415,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function errNo() public function errNo()
{ {
@ -396,7 +425,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function err2Str($number) public function err2Str($number)
{ {
@ -440,7 +469,7 @@ class Ldap extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getDiagnosticMessage() public function getDiagnosticMessage()
{ {

View File

@ -46,7 +46,7 @@ abstract class LdapBase implements LdapInterface
protected $useTLS = false; protected $useTLS = false;
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function isUsingSSL() public function isUsingSSL()
{ {
@ -54,7 +54,7 @@ abstract class LdapBase implements LdapInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function isUsingTLS() public function isUsingTLS()
{ {
@ -62,7 +62,7 @@ abstract class LdapBase implements LdapInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function isBound() public function isBound()
{ {
@ -70,7 +70,15 @@ abstract class LdapBase implements LdapInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/
public function isConnected()
{
return ! is_null($this->connection);
}
/**
* @inheritdoc
*/ */
public function canChangePasswords() public function canChangePasswords()
{ {
@ -78,7 +86,7 @@ abstract class LdapBase implements LdapInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function ssl($enabled = true) public function ssl($enabled = true)
{ {
@ -88,7 +96,7 @@ abstract class LdapBase implements LdapInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function tls($enabled = true) public function tls($enabled = true)
{ {
@ -98,7 +106,7 @@ abstract class LdapBase implements LdapInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function setOptions(array $options = []) public function setOptions(array $options = [])
{ {
@ -108,7 +116,7 @@ abstract class LdapBase implements LdapInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getHost() public function getHost()
{ {
@ -116,7 +124,7 @@ abstract class LdapBase implements LdapInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getConnection() public function getConnection()
{ {
@ -124,7 +132,7 @@ abstract class LdapBase implements LdapInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getProtocol() public function getProtocol()
{ {
@ -132,7 +140,7 @@ abstract class LdapBase implements LdapInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getExtendedError() public function getExtendedError()
{ {

View File

@ -103,6 +103,13 @@ interface LdapInterface
*/ */
public function isBound(); public function isBound();
/**
* Determine if the connection has been created.
*
* @return bool
*/
public function isConnected();
/** /**
* Determine the connection is able to modify passwords. * Determine the connection is able to modify passwords.
* *

View File

@ -32,7 +32,7 @@ class Entry extends BaseEntry implements ActiveDirectory
protected $sidKey = 'objectsid'; protected $sidKey = 'objectsid';
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getObjectSidKey() public function getObjectSidKey()
{ {
@ -40,7 +40,7 @@ class Entry extends BaseEntry implements ActiveDirectory
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getObjectSid() public function getObjectSid()
{ {
@ -48,7 +48,7 @@ class Entry extends BaseEntry implements ActiveDirectory
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getConvertedSid() public function getConvertedSid()
{ {

View File

@ -5,12 +5,12 @@ namespace LdapRecord\Models\ActiveDirectory;
class ExchangeDatabase extends Entry class ExchangeDatabase extends Entry
{ {
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public static $objectClasses = ['msExchMDB']; public static $objectClasses = ['msExchMDB'];
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public static function boot() public static function boot()
{ {

View File

@ -5,12 +5,12 @@ namespace LdapRecord\Models\ActiveDirectory;
class ExchangeServer extends Entry class ExchangeServer extends Entry
{ {
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public static $objectClasses = ['msExchExchangeServer']; public static $objectClasses = ['msExchExchangeServer'];
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public static function boot() public static function boot()
{ {

View File

@ -57,7 +57,7 @@ class User extends Entry implements Authenticatable
]; ];
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected static function boot() protected static function boot()
{ {

View File

@ -144,7 +144,8 @@ class AccountControl
// of possible flags. This will allow us to see if // of possible flags. This will allow us to see if
// our AccountControl object contains any of them. // our AccountControl object contains any of them.
$flagsUsed = array_intersect( $flagsUsed = array_intersect(
$this->extractFlags($flag), $this->values $this->extractFlags($flag),
$this->values
); );
return in_array($flag, $flagsUsed); return in_array($flag, $flagsUsed);

View File

@ -160,7 +160,8 @@ class Timestamp
protected function convertLdapTimeToDateTime($value) protected function convertLdapTimeToDateTime($value)
{ {
return DateTime::createFromFormat( return DateTime::createFromFormat(
strpos($value, 'Z') !== false ? 'YmdHis\Z' : 'YmdHisT', $value strpos($value, 'Z') !== false ? 'YmdHis\Z' : 'YmdHisT',
$value
); );
} }
@ -188,7 +189,8 @@ class Timestamp
protected function convertWindowsTimeToDateTime($value) protected function convertWindowsTimeToDateTime($value)
{ {
return DateTime::createFromFormat( return DateTime::createFromFormat(
strpos($value, '0Z') !== false ? 'YmdHis.0\Z' : 'YmdHis.0T', $value strpos($value, '0Z') !== false ? 'YmdHis.0\Z' : 'YmdHis.0T',
$value
); );
} }

View File

@ -215,16 +215,18 @@ trait HasPassword
*/ */
public function determinePasswordHashMethod() public function determinePasswordHashMethod()
{ {
if (! ($password = $this->password)) { if (! $password = $this->password) {
return; return;
} }
if (! ($method = Password::getHashMethod($password))) { if (! $method = Password::getHashMethod($password)) {
return; return;
} }
[,$algo] = array_pad( [,$algo] = array_pad(
Password::getHashMethodAndAlgo($password) ?? [], $length = 2, $value = null Password::getHashMethodAndAlgo($password) ?? [],
$length = 2,
$value = null
); );
switch ($algo) { switch ($algo) {

View File

@ -29,7 +29,7 @@ class Entry extends BaseEntry implements FreeIPA
]; ];
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected static function boot() protected static function boot()
{ {

View File

@ -19,7 +19,7 @@ class Entry extends BaseEntry implements OpenLDAP
protected $guidKey = 'entryuuid'; protected $guidKey = 'entryuuid';
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected static function boot() protected static function boot()
{ {

View File

@ -159,7 +159,9 @@ class HasMany extends OneToMany
public function attach($model) public function attach($model)
{ {
return $this->attemptFailableOperation( return $this->attemptFailableOperation(
$this->buildAttachCallback($model), $this->bypass['attach'], $model $this->buildAttachCallback($model),
$this->bypass['attach'],
$model
); );
} }
@ -213,7 +215,9 @@ class HasMany extends OneToMany
public function detach($model) public function detach($model)
{ {
return $this->attemptFailableOperation( return $this->attemptFailableOperation(
$this->buildDetachCallback($model), $this->bypass['detach'], $model $this->buildDetachCallback($model),
$this->bypass['detach'],
$model
); );
} }
@ -275,7 +279,8 @@ class HasMany extends OneToMany
} }
throw ModelNotFoundException::forQuery( throw ModelNotFoundException::forQuery(
$this->query->getUnescapedQuery(), $this->query->getDn() $this->query->getUnescapedQuery(),
$this->query->getDn()
); );
} }

View File

@ -16,7 +16,7 @@ class ArrayCacheStore implements CacheInterface
protected $storage = []; protected $storage = [];
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function get($key, $default = null) public function get($key, $default = null)
{ {
@ -38,7 +38,7 @@ class ArrayCacheStore implements CacheInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function set($key, $value, $ttl = null) public function set($key, $value, $ttl = null)
{ {
@ -51,7 +51,7 @@ class ArrayCacheStore implements CacheInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function delete($key) public function delete($key)
{ {
@ -61,7 +61,7 @@ class ArrayCacheStore implements CacheInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function clear() public function clear()
{ {
@ -71,7 +71,7 @@ class ArrayCacheStore implements CacheInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getMultiple($keys, $default = null) public function getMultiple($keys, $default = null)
{ {
@ -85,7 +85,7 @@ class ArrayCacheStore implements CacheInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function setMultiple($values, $ttl = null) public function setMultiple($values, $ttl = null)
{ {
@ -97,7 +97,7 @@ class ArrayCacheStore implements CacheInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function deleteMultiple($keys) public function deleteMultiple($keys)
{ {
@ -109,7 +109,7 @@ class ArrayCacheStore implements CacheInterface
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function has($key) public function has($key)
{ {

View File

@ -382,7 +382,9 @@ class Builder
protected function substituteBaseInDn($dn) protected function substituteBaseInDn($dn)
{ {
return str_replace( return str_replace(
'{base}', $this->baseDn, $dn instanceof Model ? $dn->getDn() : $dn '{base}',
$this->baseDn,
$dn instanceof Model ? $dn->getDn() : $dn
); );
} }

View File

@ -8,7 +8,7 @@ use Tightenco\Collect\Support\Collection as BaseCollection;
class Collection extends BaseCollection class Collection extends BaseCollection
{ {
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected function valueRetriever($value) protected function valueRetriever($value)
{ {

View File

@ -287,7 +287,7 @@ class Builder extends BaseBuilder
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getQuery() public function getQuery()
{ {
@ -424,7 +424,7 @@ class Builder extends BaseBuilder
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected function prepareWhereValue($field, $value, $raw = false) protected function prepareWhereValue($field, $value, $raw = false)
{ {

View File

@ -14,7 +14,7 @@ class DeprecatedPaginator extends AbstractPaginator
protected $cookie = ''; protected $cookie = '';
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected function fetchCookie() protected function fetchCookie()
{ {
@ -22,7 +22,7 @@ class DeprecatedPaginator extends AbstractPaginator
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected function prepareServerControls() protected function prepareServerControls()
{ {
@ -30,7 +30,7 @@ class DeprecatedPaginator extends AbstractPaginator
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected function applyServerControls(LdapInterface $ldap) protected function applyServerControls(LdapInterface $ldap)
{ {
@ -38,7 +38,7 @@ class DeprecatedPaginator extends AbstractPaginator
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected function updateServerControls(LdapInterface $ldap, $resource) protected function updateServerControls(LdapInterface $ldap, $resource)
{ {
@ -46,7 +46,7 @@ class DeprecatedPaginator extends AbstractPaginator
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected function resetServerControls(LdapInterface $ldap) protected function resetServerControls(LdapInterface $ldap)
{ {

View File

@ -7,7 +7,7 @@ use LdapRecord\LdapInterface;
class Paginator extends AbstractPaginator class Paginator extends AbstractPaginator
{ {
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected function fetchCookie() protected function fetchCookie()
{ {
@ -15,7 +15,7 @@ class Paginator extends AbstractPaginator
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected function prepareServerControls() protected function prepareServerControls()
{ {
@ -25,7 +25,7 @@ class Paginator extends AbstractPaginator
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected function applyServerControls(LdapInterface $ldap) protected function applyServerControls(LdapInterface $ldap)
{ {
@ -33,7 +33,7 @@ class Paginator extends AbstractPaginator
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected function updateServerControls(LdapInterface $ldap, $resource) protected function updateServerControls(LdapInterface $ldap, $resource)
{ {
@ -62,7 +62,7 @@ class Paginator extends AbstractPaginator
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
protected function resetServerControls(LdapInterface $ldap) protected function resetServerControls(LdapInterface $ldap)
{ {

View File

@ -84,7 +84,7 @@ class ConnectionFake extends Connection
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function isConnected() public function isConnected()
{ {

View File

@ -193,7 +193,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getDiagnosticMessage() public function getDiagnosticMessage()
{ {
@ -215,7 +215,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getEntries($searchResults) public function getEntries($searchResults)
{ {
@ -223,7 +223,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function isUsingSSL() public function isUsingSSL()
{ {
@ -233,7 +233,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function isUsingTLS() public function isUsingTLS()
{ {
@ -243,7 +243,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function isBound() public function isBound()
{ {
@ -253,7 +253,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function setOption($option, $value) public function setOption($option, $value)
{ {
@ -263,7 +263,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function getOption($option, &$value = null) public function getOption($option, &$value = null)
{ {
@ -271,7 +271,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function startTLS() public function startTLS()
{ {
@ -279,7 +279,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function connect($hosts = [], $port = 389) public function connect($hosts = [], $port = 389)
{ {
@ -293,7 +293,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function close() public function close()
{ {
@ -307,7 +307,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function bind($username, $password) public function bind($username, $password)
{ {
@ -315,7 +315,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function search($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = null, $serverControls = []) public function search($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = null, $serverControls = [])
{ {
@ -323,7 +323,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function listing($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = null, $serverControls = []) public function listing($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = null, $serverControls = [])
{ {
@ -331,7 +331,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function read($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = null, $serverControls = []) public function read($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = null, $serverControls = [])
{ {
@ -339,7 +339,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function parseResult($result, &$errorCode, &$dn, &$errorMessage, &$referrals, &$serverControls = []) public function parseResult($result, &$errorCode, &$dn, &$errorMessage, &$referrals, &$serverControls = [])
{ {
@ -347,7 +347,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function add($dn, array $entry) public function add($dn, array $entry)
{ {
@ -355,7 +355,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function delete($dn) public function delete($dn)
{ {
@ -363,7 +363,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function rename($dn, $newRdn, $newParent, $deleteOldRdn = false) public function rename($dn, $newRdn, $newParent, $deleteOldRdn = false)
{ {
@ -371,7 +371,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function modify($dn, array $entry) public function modify($dn, array $entry)
{ {
@ -379,7 +379,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function modifyBatch($dn, array $values) public function modifyBatch($dn, array $values)
{ {
@ -387,7 +387,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function modAdd($dn, array $entry) public function modAdd($dn, array $entry)
{ {
@ -395,7 +395,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function modReplace($dn, array $entry) public function modReplace($dn, array $entry)
{ {
@ -403,7 +403,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function modDelete($dn, array $entry) public function modDelete($dn, array $entry)
{ {
@ -411,7 +411,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function controlPagedResult($pageSize = 1000, $isCritical = false, $cookie = '') public function controlPagedResult($pageSize = 1000, $isCritical = false, $cookie = '')
{ {
@ -419,7 +419,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function controlPagedResultResponse($result, &$cookie) public function controlPagedResultResponse($result, &$cookie)
{ {
@ -427,7 +427,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function freeResult($result) public function freeResult($result)
{ {
@ -435,7 +435,7 @@ class LdapFake extends LdapBase
} }
/** /**
* {@inheritdoc} * @inheritdoc
*/ */
public function err2Str($number) public function err2Str($number)
{ {
@ -506,11 +506,14 @@ class LdapFake extends LdapBase
$argNumber = $key + 1; $argNumber = $key + 1;
PHPUnit::assertArrayHasKey( PHPUnit::assertArrayHasKey(
$key, $methodArgs, "LDAP method [$method] argument #{$argNumber} does not exist." $key,
$methodArgs,
"LDAP method [$method] argument #{$argNumber} does not exist."
); );
$constraint->evaluate( $constraint->evaluate(
$methodArgs[$key], "LDAP method [$method] expectation failed." $methodArgs[$key],
"LDAP method [$method] expectation failed."
); );
} }
} }

View File

@ -0,0 +1,23 @@
<?php
namespace Illuminate\Contracts\Database\Eloquent;
interface SupportsPartialRelations
{
/**
* Indicate that the relation is a single result of a larger one-to-many relationship.
*
* @param \Closure|string|null $column
* @param string|null $relation
* @param string $relation
* @return $this
*/
public function ofMany($column = 'id', $aggregate = 'MAX', $relation = null);
/**
* Determine whether the relationship is a one-of-many relationship.
*
* @return bool
*/
public function isOneOfMany();
}

View File

@ -0,0 +1,117 @@
<?php
namespace Illuminate\Contracts\Pagination;
interface CursorPaginator
{
/**
* Get the URL for a given cursor.
*
* @param \Illuminate\Pagination\Cursor|null $cursor
* @return string
*/
public function url($cursor);
/**
* Add a set of query string values to the paginator.
*
* @param array|string|null $key
* @param string|null $value
* @return $this
*/
public function appends($key, $value = null);
/**
* Get / set the URL fragment to be appended to URLs.
*
* @param string|null $fragment
* @return $this|string|null
*/
public function fragment($fragment = null);
/**
* Get the URL for the previous page, or null.
*
* @return string|null
*/
public function previousPageUrl();
/**
* The URL for the next page, or null.
*
* @return string|null
*/
public function nextPageUrl();
/**
* Get all of the items being paginated.
*
* @return array
*/
public function items();
/**
* Get the "cursor" of the previous set of items.
*
* @return \Illuminate\Pagination\Cursor|null
*/
public function previousCursor();
/**
* Get the "cursor" of the next set of items.
*
* @return \Illuminate\Pagination\Cursor|null
*/
public function nextCursor();
/**
* Determine how many items are being shown per page.
*
* @return int
*/
public function perPage();
/**
* Get the current cursor being paginated.
*
* @return \Illuminate\Pagination\Cursor|null
*/
public function cursor();
/**
* Determine if there are enough items to split into multiple pages.
*
* @return bool
*/
public function hasPages();
/**
* Get the base path for paginator generated URLs.
*
* @return string|null
*/
public function path();
/**
* Determine if the list of items is empty or not.
*
* @return bool
*/
public function isEmpty();
/**
* Determine if the list of items is not empty.
*
* @return bool
*/
public function isNotEmpty();
/**
* Render the paginator using a given view.
*
* @param string|null $view
* @param array $data
* @return string
*/
public function render($view = null, $data = []);
}

View File

@ -509,5 +509,64 @@ use DateTimeZone;
*/ */
class CarbonImmutable extends DateTimeImmutable implements CarbonInterface class CarbonImmutable extends DateTimeImmutable implements CarbonInterface
{ {
use Date; use Date {
__clone as dateTraitClone;
}
public function __clone()
{
$this->dateTraitClone();
$this->endOfTime = false;
$this->startOfTime = false;
}
/**
* Create a very old date representing start of time.
*
* @return static
*/
public static function startOfTime(): self
{
$date = static::parse('0001-01-01')->years(self::getStartOfTimeYear());
$date->startOfTime = true;
return $date;
}
/**
* Create a very far date representing end of time.
*
* @return static
*/
public static function endOfTime(): self
{
$date = static::parse('9999-12-31 23:59:59.999999')->years(self::getEndOfTimeYear());
$date->endOfTime = true;
return $date;
}
/**
* @codeCoverageIgnore
*/
private static function getEndOfTimeYear(): int
{
if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) {
return 145261681241552;
}
return PHP_INT_MAX;
}
/**
* @codeCoverageIgnore
*/
private static function getStartOfTimeYear(): int
{
if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) {
return -135908816449551;
}
return max(PHP_INT_MIN, -9223372036854773760);
}
} }

View File

@ -668,7 +668,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
* Please see the testing aids section (specifically static::setTestNow()) * Please see the testing aids section (specifically static::setTestNow())
* for more on the possibility of this constructor returning a test instance. * for more on the possibility of this constructor returning a test instance.
* *
* @param string|null $time * @param DateTimeInterface|string|null $time
* @param DateTimeZone|string|null $tz * @param DateTimeZone|string|null $tz
* *
* @throws InvalidFormatException * @throws InvalidFormatException
@ -2629,6 +2629,13 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
*/ */
public function isEndOfDay($checkMicroseconds = false); public function isEndOfDay($checkMicroseconds = false);
/**
* Returns true if the date was created using CarbonImmutable::endOfTime()
*
* @return bool
*/
public function isEndOfTime(): bool;
/** /**
* Determines if the instance is in the future, ie. greater (after) than now. * Determines if the instance is in the future, ie. greater (after) than now.
* *
@ -2839,6 +2846,13 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable
*/ */
public function isStartOfDay($checkMicroseconds = false); public function isStartOfDay($checkMicroseconds = false);
/**
* Returns true if the date was created using CarbonImmutable::startOfTime()
*
* @return bool
*/
public function isStartOfTime(): bool;
/** /**
* Returns true if the strict mode is globally in use, false else. * Returns true if the strict mode is globally in use, false else.
* (It can be overridden in specific instances.) * (It can be overridden in specific instances.)

View File

@ -37,7 +37,7 @@ use RuntimeException;
/** /**
* Substitution of DatePeriod with some modifications and many more features. * Substitution of DatePeriod with some modifications and many more features.
* *
* @property-read int $recurrences number of recurrences (if end not set). * @property-read int|float $recurrences number of recurrences (if end not set).
* @property-read bool $include_start_date rather the start date is included in the iteration. * @property-read bool $include_start_date rather the start date is included in the iteration.
* @property-read bool $include_end_date rather the end date is included in the iteration (if recurrences not set). * @property-read bool $include_end_date rather the end date is included in the iteration (if recurrences not set).
* @property-read CarbonInterface $start Period start date. * @property-read CarbonInterface $start Period start date.
@ -212,6 +212,13 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
*/ */
public const NEXT_MAX_ATTEMPTS = 1000; public const NEXT_MAX_ATTEMPTS = 1000;
/**
* Number of maximum attempts before giving up on finding end date.
*
* @var int
*/
public const END_MAX_ATTEMPTS = 10000;
/** /**
* The registered macros. * The registered macros.
* *
@ -981,7 +988,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
/** /**
* Get number of recurrences. * Get number of recurrences.
* *
* @return int|null * @return int|float|null
*/ */
public function getRecurrences() public function getRecurrences()
{ {
@ -1205,9 +1212,9 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
/** /**
* Add a recurrences filter (set maximum number of recurrences). * Add a recurrences filter (set maximum number of recurrences).
* *
* @param int|null $recurrences * @param int|float|null $recurrences
* *
* @throws \InvalidArgumentException * @throws InvalidArgumentException
* *
* @return $this * @return $this
*/ */
@ -1221,7 +1228,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
return $this->removeFilter(static::RECURRENCES_FILTER); return $this->removeFilter(static::RECURRENCES_FILTER);
} }
$this->recurrences = (int) $recurrences; $this->recurrences = $recurrences === INF ? INF : (int) $recurrences;
if (!$this->hasFilter(static::RECURRENCES_FILTER)) { if (!$this->hasFilter(static::RECURRENCES_FILTER)) {
return $this->addFilter(static::RECURRENCES_FILTER); return $this->addFilter(static::RECURRENCES_FILTER);
@ -1708,9 +1715,11 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
return $end; return $end;
} }
$dates = iterator_to_array($this); if ($this->dateInterval->isEmpty()) {
return $this->getStartDate($rounding);
}
$date = end($dates); $date = $this->getEndFromRecurrences() ?? $this->iterateUntilEnd();
if ($date && $rounding) { if ($date && $rounding) {
$date = $date->copy()->round($this->getDateInterval(), $rounding); $date = $date->copy()->round($this->getDateInterval(), $rounding);
@ -1719,6 +1728,56 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
return $date; return $date;
} }
/**
* @return CarbonInterface|null
*/
private function getEndFromRecurrences()
{
if ($this->recurrences === null) {
throw new UnreachableException(
"Could not calculate period end without either explicit end or recurrences.\n".
"If you're looking for a forever-period, use ->setRecurrences(INF)."
);
}
if ($this->recurrences === INF) {
$start = $this->getStartDate();
return $start < $start->copy()->add($this->getDateInterval())
? CarbonImmutable::endOfTime()
: CarbonImmutable::startOfTime();
}
if ($this->filters === [[static::RECURRENCES_FILTER, null]]) {
return $this->getStartDate()->copy()->add(
$this->getDateInterval()->times(
$this->recurrences - ($this->isStartExcluded() ? 0 : 1)
)
);
}
return null;
}
/**
* @return CarbonInterface|null
*/
private function iterateUntilEnd()
{
$attempts = 0;
$date = null;
foreach ($this as $date) {
if (++$attempts > static::END_MAX_ATTEMPTS) {
throw new UnreachableException(
'Could not calculate period end after iterating '.static::END_MAX_ATTEMPTS.' times.'
);
}
}
return $date;
}
/** /**
* Returns true if the current period overlaps the given one (if 1 parameter passed) * Returns true if the current period overlaps the given one (if 1 parameter passed)
* or the period between 2 dates (if 2 parameters passed). * or the period between 2 dates (if 2 parameters passed).
@ -1736,7 +1795,15 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable
$range = static::create($range); $range = static::create($range);
} }
return $this->calculateEnd() > $range->getStartDate() && $range->calculateEnd() > $this->getStartDate(); $thisDates = [$this->getStartDate(), $this->calculateEnd()];
sort($thisDates);
[$start, $end] = $thisDates;
$rangeDates = [$range->getStartDate(), $range->calculateEnd()];
sort($rangeDates);
[$rangeStart, $rangeEnd] = $rangeDates;
return $end > $rangeStart && $rangeEnd > $start;
} }
/** /**

View File

@ -31,22 +31,23 @@
* - João Magalhães * - João Magalhães
* - Ingmar * - Ingmar
* - Illimar Tambek * - Illimar Tambek
* - Mihkel
*/ */
return [ return [
'year' => ':count aasta|:count aastat', 'year' => ':count aasta|:count aastat',
'y' => ':count aasta|:count aastat', 'y' => ':count a',
'month' => ':count kuu|:count kuud', 'month' => ':count kuu|:count kuud',
'm' => ':count kuu|:count kuud', 'm' => ':count k',
'week' => ':count nädal|:count nädalat', 'week' => ':count nädal|:count nädalat',
'w' => ':count nädal|:count nädalat', 'w' => ':count näd',
'day' => ':count päev|:count päeva', 'day' => ':count päev|:count päeva',
'd' => ':count päev|:count päeva', 'd' => ':count p',
'hour' => ':count tund|:count tundi', 'hour' => ':count tund|:count tundi',
'h' => ':count tund|:count tundi', 'h' => ':count t',
'minute' => ':count minut|:count minutit', 'minute' => ':count minut|:count minutit',
'min' => ':count minut|:count minutit', 'min' => ':count min',
'second' => ':count sekund|:count sekundit', 'second' => ':count sekund|:count sekundit',
's' => ':count sekund|:count sekundit', 's' => ':count s',
'ago' => ':time tagasi', 'ago' => ':time tagasi',
'from_now' => ':time pärast', 'from_now' => ':time pärast',
'after' => ':time pärast', 'after' => ':time pärast',

View File

@ -31,6 +31,12 @@ use InvalidArgumentException;
*/ */
trait Comparison trait Comparison
{ {
/** @var bool */
protected $endOfTime = false;
/** @var bool */
protected $startOfTime = false;
/** /**
* Determines if the instance is equal to another * Determines if the instance is equal to another
* *
@ -1040,4 +1046,24 @@ trait Comparison
return (bool) @preg_match('/^'.$regex.'$/', $date); return (bool) @preg_match('/^'.$regex.'$/', $date);
} }
/**
* Returns true if the date was created using CarbonImmutable::startOfTime()
*
* @return bool
*/
public function isStartOfTime(): bool
{
return $this->startOfTime ?? false;
}
/**
* Returns true if the date was created using CarbonImmutable::endOfTime()
*
* @return bool
*/
public function isEndOfTime(): bool
{
return $this->endOfTime ?? false;
}
} }

View File

@ -97,6 +97,7 @@ trait Options
'I' => '(0|1)', 'I' => '(0|1)',
'O' => '([+-](1[012]|0[0-9])[0134][05])', 'O' => '([+-](1[012]|0[0-9])[0134][05])',
'P' => '([+-](1[012]|0[0-9]):[0134][05])', 'P' => '([+-](1[012]|0[0-9]):[0134][05])',
'p' => '(Z|[+-](1[012]|0[0-9]):[0134][05])',
'T' => '([a-zA-Z]{1,5})', 'T' => '([a-zA-Z]{1,5})',
'Z' => '(-?[1-5]?[0-9]{1,4})', 'Z' => '(-?[1-5]?[0-9]{1,4})',
'U' => '([0-9]*)', 'U' => '([0-9]*)',

View File

@ -313,7 +313,7 @@ class Translator extends Translation\Translator
*/ */
public function setLocale($locale) public function setLocale($locale)
{ {
$locale = preg_replace_callback('/[-_]([a-z]{2,})/', function ($matches) { $locale = preg_replace_callback('/[-_]([a-z]{2,}|[0-9]{2,})/', function ($matches) {
// _2-letters or YUE is a region, _3+-letters is a variant // _2-letters or YUE is a region, _3+-letters is a variant
$upper = strtoupper($matches[1]); $upper = strtoupper($matches[1]);

View File

@ -134,7 +134,7 @@ class XliffFileLoader implements LoaderInterface
private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain) private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain)
{ {
$xml = simplexml_import_dom($dom); $xml = simplexml_import_dom($dom);
$encoding = strtoupper($dom->encoding); $encoding = $dom->encoding ? strtoupper($dom->encoding) : null;
$xml->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:2.0'); $xml->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:2.0');

View File

@ -446,7 +446,7 @@ EOF
*/ */
protected function assertValidLocale(string $locale) protected function assertValidLocale(string $locale)
{ {
if (1 !== preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) { if (null !== $locale && 1 !== preg_match('/^[a-z0-9@_\\.\\-]*$/i', $locale)) {
throw new InvalidArgumentException(sprintf('Invalid "%s" locale.', $locale)); throw new InvalidArgumentException(sprintf('Invalid "%s" locale.', $locale));
} }
} }

View File

@ -166,7 +166,6 @@ class VarCloner extends AbstractCloner
break; break;
case \is_object($v): case \is_object($v):
case $v instanceof \__PHP_Incomplete_Class:
if (empty($objRefs[$h = spl_object_id($v)])) { if (empty($objRefs[$h = spl_object_id($v)])) {
$stub = new Stub(); $stub = new Stub();
$stub->type = Stub::TYPE_OBJECT; $stub->type = Stub::TYPE_OBJECT;