@@ -33,6 +33,8 @@ class ClassMap
33
33
private $ psrViolations = [];
34
34
35
35
/**
36
+ * Returns the class map, which is a list of paths indexed by class name
37
+ *
36
38
* @return array<class-string, non-empty-string>
37
39
*/
38
40
public function getMap (): array
@@ -41,6 +43,14 @@ public function getMap(): array
41
43
}
42
44
43
45
/**
46
+ * Returns warning strings containing details about PSR-0/4 violations that were detected
47
+ *
48
+ * Violations are for ex a class which is in the wrong file/directory and thus should not be
49
+ * found using psr-0/psr-4 autoloading but was found by the ClassMapGenerator as it scans all files.
50
+ *
51
+ * This is only happening when scanning paths using psr-0/psr-4 autoload type. Classmap type
52
+ * always accepts every class as it finds it.
53
+ *
44
54
* @return string[]
45
55
*/
46
56
public function getPsrViolations (): array
@@ -51,6 +61,8 @@ public function getPsrViolations(): array
51
61
/**
52
62
* A map of class names to their list of ambiguous paths
53
63
*
64
+ * This occurs when the same class can be found in several files
65
+ *
54
66
* To get the path the class is being mapped to, call getClassPath
55
67
*
56
68
* @return array<class-string, array<non-empty-string>>
@@ -60,6 +72,14 @@ public function getAmbiguousClasses(): array
60
72
return $ this ->ambiguousClasses ;
61
73
}
62
74
75
+ /**
76
+ * Sorts the class map alphabetically by class names
77
+ */
78
+ public function sort (): void
79
+ {
80
+ ksort ($ this ->map );
81
+ }
82
+
63
83
/**
64
84
* @param class-string $className
65
85
* @param non-empty-string $path
0 commit comments