File tree Expand file tree Collapse file tree 5 files changed +33
-30
lines changed Expand file tree Collapse file tree 5 files changed +33
-30
lines changed Original file line number Diff line number Diff line change 8
8
use PHPStan \Reflection \PropertiesClassReflectionExtension ;
9
9
use PHPStan \Reflection \PropertyReflection ;
10
10
use PHPStan \Reflection \ReflectionProvider ;
11
+ use PHPStanCakePHP2 \Contract \PropertyNameExtensionInterface ;
11
12
use PHPStanCakePHP2 \Reflection \PublicReadOnlyPropertyReflection ;
12
13
13
- abstract class AbstractClassPropertyExtension implements PropertiesClassReflectionExtension
14
+ abstract class AbstractClassPropertyExtension implements PropertiesClassReflectionExtension, PropertyNameExtensionInterface
14
15
{
15
16
private ReflectionProvider $ reflectionProvider ;
16
17
@@ -42,26 +43,4 @@ public function getProperty(
42
43
43
44
return new PublicReadOnlyPropertyReflection ($ correctedPropertyName , $ classReflection );
44
45
}
45
-
46
- /**
47
- * @todo use constract instead to separate
48
- * Get the class name of the type of property.
49
- */
50
- abstract protected function getPropertyParentClassName (): string ;
51
-
52
- /**
53
- * @todo use constract instead to separate
54
- * Get the class names which can contain the property.
55
- *
56
- * @return array<string>
57
- */
58
- abstract protected function getContainingClassNames (): array ;
59
-
60
- /**
61
- * @todo use constract instead to separate
62
- * Return the class name from the property name.
63
- */
64
- abstract protected function getClassNameFromPropertyName (
65
- string $ propertyName
66
- ): string ;
67
46
}
Original file line number Diff line number Diff line change 9
9
*/
10
10
final class ClassModelsPropertyExtension extends AbstractClassPropertyExtension
11
11
{
12
- protected function getPropertyParentClassName (): string
12
+ public function getPropertyParentClassName (): string
13
13
{
14
14
return 'Model ' ;
15
15
}
16
16
17
17
/**
18
18
* @return array<string>
19
19
*/
20
- protected function getContainingClassNames (): array
20
+ public function getContainingClassNames (): array
21
21
{
22
22
return [
23
23
'Controller ' ,
@@ -26,7 +26,7 @@ protected function getContainingClassNames(): array
26
26
];
27
27
}
28
28
29
- protected function getClassNameFromPropertyName (
29
+ public function getClassNameFromPropertyName (
30
30
string $ propertyName
31
31
): string {
32
32
return $ propertyName ;
Original file line number Diff line number Diff line change 11
11
*/
12
12
final class ShellClassPropertyExtension extends AbstractClassPropertyExtension
13
13
{
14
- protected function getPropertyParentClassName (): string
14
+ public function getPropertyParentClassName (): string
15
15
{
16
16
return 'Shell ' ;
17
17
}
18
18
19
19
/**
20
20
* @return array<string>
21
21
*/
22
- protected function getContainingClassNames (): array
22
+ public function getContainingClassNames (): array
23
23
{
24
24
return ['Shell ' ];
25
25
}
26
26
27
- protected function getClassNameFromPropertyName (
27
+ public function getClassNameFromPropertyName (
28
28
string $ propertyName
29
29
): string {
30
30
return $ propertyName . 'Task ' ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace PHPStanCakePHP2 \Contract ;
6
+
7
+ interface PropertyNameExtensionInterface
8
+ {
9
+ /**
10
+ * Get the class name of the type of property.
11
+ */
12
+ public function getPropertyParentClassName (): string ;
13
+
14
+ /**
15
+ * Get the class names which can contain the property.
16
+ *
17
+ * @return string[]
18
+ */
19
+ public function getContainingClassNames (): array ;
20
+
21
+ /**
22
+ * Return the class name from the property name.
23
+ */
24
+ public function getClassNameFromPropertyName (string $ propertyName ): string ;
25
+ }
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ parameters:
2
2
behaviorPaths :
3
3
- tests/Source/Model/Behavior/*.php
4
4
5
- # @todo add exists validatoin to avoid misspaths
6
5
schemaPaths :
7
6
- tests/Source/Config/Schema/*.php
8
7
You can’t perform that action at this time.
0 commit comments