1
0
Fork 0

Merge branch '1.6'

pull/6995/merge
Jordi Boggiano 2018-01-21 17:40:29 +01:00
commit 4dc81db069
1 changed files with 12 additions and 11 deletions

View File

@ -92,6 +92,17 @@ class ValidatingArrayLoader implements LoaderInterface
$this->validateUrl('homepage');
$this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
$releaseDate = null;
$this->validateString('time');
if (!empty($this->config['time'])) {
try {
$releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
} catch (\Exception $e) {
$this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
unset($this->config['time']);
}
}
if (isset($this->config['license'])) {
if (is_string($this->config['license'])) {
$this->validateRegex('license', '[A-Za-z0-9+. ()-]+');
@ -121,7 +132,7 @@ class ValidatingArrayLoader implements LoaderInterface
'If the software is closed-source, you may use "proprietary" as license.',
json_encode($this->config['license'])
);
} else {
} else if (!$releaseDate || $releaseDate->format('Y-m-d H:i:s') >= '2018-01-20 00:00:00') { // only warn for deprecations for releases/branches that follow the introduction of deprecated licenses
foreach ($licenses as $license) {
$spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
if ($spdxLicense && $spdxLicense[3]) {
@ -147,16 +158,6 @@ class ValidatingArrayLoader implements LoaderInterface
}
}
$this->validateString('time');
if (!empty($this->config['time'])) {
try {
$date = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
} catch (\Exception $e) {
$this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
unset($this->config['time']);
}
}
if ($this->validateArray('authors') && !empty($this->config['authors'])) {
foreach ($this->config['authors'] as $key => $author) {
if (!is_array($author)) {