Skip to content

Commit aa99a94

Browse files
authored
tv bump 2 (#2)
* misc * cleanup * fixup! cleanup
1 parent 4c297bc commit aa99a94

File tree

41 files changed

+104
-132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+104
-132
lines changed

.github/workflows/code_analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup PHP
1515
uses: shivammathur/setup-php@v2
1616
with:
17-
php-version: 8.0
17+
php-version: 8.1
1818

1919
- name: Validate composer
2020
run: composer validate

.phpunit.cache/test-results

Lines changed: 0 additions & 1 deletion
This file was deleted.

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"classmap": [
2727
"stubs",
28-
"tests/Feature/classes"
28+
"tests/Source"
2929
]
3030
},
3131
"extra": {
@@ -35,6 +35,11 @@
3535
]
3636
}
3737
},
38+
"scripts": {
39+
"fix-cs": "vendor/bin/ecs check src tests --fix",
40+
"check-cs": "vendor/bin/ecs check src tests",
41+
"phpstan": "vendor/bin/phpstan"
42+
},
3843
"config": {
3944
"allow-plugins": {
4045
"phpstan/extension-installer": true,

config/extension.neon

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ parameters:
1616
- ../stubs/Utility.stub
1717

1818
services:
19-
# checked
2019
-
2120
class: PHPStanCakePHP2\ClassPropertyExtension\ClassComponentPropertyExtension
2221
tags:
@@ -27,32 +26,29 @@ services:
2726
tags:
2827
- phpstan.broker.propertiesClassReflectionExtension
2928

30-
# checked
3129
-
3230
class: PHPStanCakePHP2\ReturnTypeExtension\ClassRegistryInitExtension
3331
tags:
3432
- phpstan.broker.dynamicStaticMethodReturnTypeExtension
3533

36-
# checked
3734
-
3835
class: PHPStanCakePHP2\ClassPropertyExtension\ShellClassPropertyExtension
3936
tags:
4037
- phpstan.broker.propertiesClassReflectionExtension
4138

4239
-
43-
class: PHPStanCakePHP2\ModelBehaviorsExtension
40+
class: PHPStanCakePHP2\ClassMethodExtension\ModelMethodExtension
4441
arguments:
4542
behaviorPaths: %behaviorPaths%
4643
tags:
4744
- phpstan.broker.methodsClassReflectionExtension
4845

4946
-
50-
class: PHPStanCakePHP2\Service\SchemaService
51-
arguments:
52-
schemaPaths: %schemaPaths%
53-
54-
-
55-
class: PHPStanCakePHP2\LoadComponentOnFlyMethodReturnTypeExtension
47+
class: PHPStanCakePHP2\ReturnTypeExtension\LoadComponentOnFlyMethodReturnTypeExtension
5648
tags:
5749
- phpstan.broker.dynamicMethodReturnTypeExtension
5850

51+
-
52+
class: PHPStanCakePHP2\Service\SchemaService
53+
arguments:
54+
schemaPaths: %schemaPaths%

src/ModelBehaviorsExtension.php renamed to src/ClassMethodExtension/ModelMethodExtension.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
declare(strict_types=1);
44

5-
namespace PHPStanCakePHP2;
5+
namespace PHPStanCakePHP2\ClassMethodExtension;
66

77
use Exception;
88
use PHPStan\Reflection\ClassReflection;
99
use PHPStan\Reflection\MethodReflection;
1010
use PHPStan\Reflection\MethodsClassReflectionExtension;
1111
use PHPStan\Reflection\ReflectionProvider;
12+
use PHPStanCakePHP2\ModelBehaviorMethodExtractor;
1213
use PHPStanCakePHP2\Reflection\ClassReflectionFinder;
1314

1415
/**
1516
* Adds methods to {@link Model}s from {@link ModelBehavior} classes.
1617
*/
17-
final class ModelBehaviorsExtension implements MethodsClassReflectionExtension
18+
final class ModelMethodExtension implements MethodsClassReflectionExtension
1819
{
1920
private ReflectionProvider $reflectionProvider;
2021

src/ClassPropertyExtension/ClassComponentPropertyExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use PHPStanCakePHP2\Reflection\PublicReadOnlyPropertyReflection;
1616

1717
/**
18-
* @see \ClassPropertyExtension\ClassComponentPropertyExtension\ClassComponentPropertyExtensionTest
18+
* @see \PHPStanCakePHP2\Tests\ClassPropertyExtension\ClassComponentPropertyExtension\ClassComponentPropertyExtensionTest
1919
*/
2020
final class ClassComponentPropertyExtension implements PropertiesClassReflectionExtension
2121
{
@@ -32,8 +32,6 @@ public function hasProperty(ClassReflection $classReflection, string $propertyNa
3232
return false;
3333
}
3434

35-
36-
3735
$isDefinedInComponentsProperty = (bool) array_filter(
3836
$this->getDefinedComponentsAsList($classReflection),
3937
static fn (string $componentName): bool => $componentName === $propertyName

src/ModelBehaviorMethodExtractor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use PHPStan\Reflection\ParameterReflection;
1212
use PHPStan\Reflection\ParametersAcceptor;
1313
use PHPStan\Type\ObjectType;
14+
use PHPStanCakePHP2\Reflection\ModelBehaviorMethodWrapper;
1415

1516
final class ModelBehaviorMethodExtractor
1617
{

src/ModelBehaviorMethodWrapper.php renamed to src/Reflection/ModelBehaviorMethodWrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace PHPStanCakePHP2;
5+
namespace PHPStanCakePHP2\Reflection;
66

77
use PHPStan\Reflection\ClassMemberReflection;
88
use PHPStan\Reflection\ClassReflection;

src/LoadComponentOnFlyMethodReturnTypeExtension.php renamed to src/ReturnTypeExtension/LoadComponentOnFlyMethodReturnTypeExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace PHPStanCakePHP2;
5+
namespace PHPStanCakePHP2\ReturnTypeExtension;
66

77
use PhpParser\Node\Expr\MethodCall;
88
use PhpParser\Node\Scalar\String_;
@@ -13,7 +13,7 @@
1313
use PHPStan\Type\ObjectType;
1414
use PHPStan\Type\Type;
1515

16-
class LoadComponentOnFlyMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension
16+
final class LoadComponentOnFlyMethodReturnTypeExtension implements DynamicMethodReturnTypeExtension
1717
{
1818
private ReflectionProvider $reflectionProvider;
1919

stubs/CakePHP/Controller.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,14 @@
22

33
class Controller
44
{
5+
public $components = [];
56

7+
public function __get(string $name)
8+
{
9+
if (isset($this->{$name})) {
10+
return $this->{$name};
11+
}
12+
13+
return 'some value';
14+
}
615
}

0 commit comments

Comments
 (0)