Skip to content

Commit e2914b4

Browse files
committed
Merge pull request symfony#70 from stof/validate_package_consistency
Add a consistency validation for the composer reference
2 parents 1eed792 + 790df5e commit e2914b4

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed
File renamed without changes.

validator.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
continue;
4040
}
4141

42-
$path = str_replace(__DIR__.'/', '', $file->getPathname());
42+
$path = str_replace(__DIR__.DIRECTORY_SEPARATOR, '', $file->getPathname());
4343

4444
if ('yaml' !== $file->getExtension()) {
4545
$messages[$path][] = 'The file extension should be ".yaml".';
@@ -63,8 +63,16 @@
6363
}
6464
}
6565

66-
if (isset($data['reference']) && 0 !== strpos($data['reference'], 'composer://')) {
67-
$messages[$path][] = 'Reference must start with "composer://"';
66+
if (isset($data['reference'])) {
67+
if (0 !== strpos($data['reference'], 'composer://')) {
68+
$messages[$path][] = 'Reference must start with "composer://"';
69+
} else {
70+
$composerPackage = substr($data['reference'], 11);
71+
72+
if (str_replace(DIRECTORY_SEPARATOR, '/', dirname($path)) !== $composerPackage) {
73+
$messages[$path][] = 'Reference composer package must match the folder name';
74+
}
75+
}
6876
}
6977

7078
if (!isset($data['branches'])) {

zendframework/zend-validator/ZF2015-03.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ branches:
55
2.3.x:
66
time: 2015-03-12 13:58:47
77
versions: [>=2.3.0,<2.3.6]
8-
reference: composer://zendframework/validator
8+
reference: composer://zendframework/zend-validator

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy