Skip to content

Commit 1d6f9bd

Browse files
mbabkerphansys
authored andcommitted
Upgrade to PHPStan 2.0
1 parent 16ab390 commit 1d6f9bd

File tree

83 files changed

+932
-530
lines changed

Some content is hidden

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

83 files changed

+932
-530
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@
6060
"doctrine/orm": "^2.14.0 || ^3.0",
6161
"friendsofphp/php-cs-fixer": "^3.14.0",
6262
"nesbot/carbon": "^2.71 || ^3.0",
63-
"phpstan/phpstan": "^1.11",
64-
"phpstan/phpstan-doctrine": "^1.4",
65-
"phpstan/phpstan-phpunit": "^1.4",
63+
"phpstan/phpstan": "^2.1.1",
64+
"phpstan/phpstan-doctrine": "^2.0.1",
65+
"phpstan/phpstan-phpunit": "^2.0.3",
6666
"phpunit/phpunit": "^9.6",
67-
"rector/rector": "^1.1",
67+
"rector/rector": "^2.0.6",
6868
"symfony/console": "^5.4 || ^6.0 || ^7.0",
6969
"symfony/doctrine-bridge": "^5.4 || ^6.0 || ^7.0",
7070
"symfony/phpunit-bridge": "^6.0 || ^7.0",

phpstan-baseline.neon

Lines changed: 548 additions & 214 deletions
Large diffs are not rendered by default.

phpstan.neon.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ parameters:
1212
- tests/bootstrap.php
1313
treatPhpDocTypesAsCertain: false
1414
ignoreErrors:
15+
-
16+
identifier: trait.unused
1517
- '#^Property Gedmo\\Tests\\.+\\Fixture\\[^:]+::\$\w+ is never written, only read\.$#'
1618
- '#^Property Gedmo\\Tests\\.+\\Fixture\\[^:]+::\$\w+ is never read, only written\.$#'
1719
- '#^Property Gedmo\\Tests\\.+\\Fixture\\[^:]+::\$\w+ is unused\.$#'
1820
- '#^Method Gedmo\\(?:[^\\]+\\)*Mapping\\Driver[^:]+::readExtendedMetadata\(\) with return type void returns [\w\|<>\s,]+ but should not return anything\.$#'
19-
- '#^Method Gedmo\\Uploadable\\Mapping\\Validator::validateConfiguration\(\) with return type void returns array<string, mixed> but should not return anything\.$#'
20-
- '#^Result of static method Gedmo\\Uploadable\\Mapping\\Validator::validateConfiguration\(\) \(void\) is used\.$#'
2121
- '#^Result of method Gedmo\\Mapping\\Driver::readExtendedMetadata\(\) \(void\) is used\.$#'
2222
excludePaths:
2323
# Deprecated and unused class, interface does not exist as of 4.0

src/AbstractTrackingListener.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
/**
2929
* The AbstractTrackingListener provides generic functions for all listeners.
3030
*
31-
* @phpstan-template TConfig of array
32-
* @phpstan-template TEventAdapter of AdapterInterface
31+
* @template TConfig of array
32+
* @template TEventAdapter of AdapterInterface
3333
*
34-
* @phpstan-extends MappedEventSubscriber<TConfig, TEventAdapter>
34+
* @template-extends MappedEventSubscriber<TConfig, TEventAdapter>
3535
*
3636
* @author Gediminas Morkevicius <[email protected]>
3737
*/
@@ -207,9 +207,9 @@ public function prePersist(EventArgs $args)
207207
/**
208208
* Get the value for an updated field.
209209
*
210-
* @param ClassMetadata $meta
211-
* @param string $field
212-
* @param AdapterInterface $eventAdapter
210+
* @param ClassMetadata<object> $meta
211+
* @param string $field
212+
* @param TEventAdapter $eventAdapter
213213
*
214214
* @return mixed
215215
*/
@@ -218,10 +218,10 @@ abstract protected function getFieldValue($meta, $field, $eventAdapter);
218218
/**
219219
* Updates a field.
220220
*
221-
* @param object $object
222-
* @param AdapterInterface $eventAdapter
223-
* @param ClassMetadata $meta
224-
* @param string $field
221+
* @param object $object
222+
* @param TEventAdapter $eventAdapter
223+
* @param ClassMetadata<object> $meta
224+
* @param string $field
225225
*
226226
* @return void
227227
*/

src/Blameable/BlameableListener.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ class BlameableListener extends AbstractTrackingListener
3434
/**
3535
* Get the user value to set on a blameable field
3636
*
37-
* @param ClassMetadata $meta
38-
* @param string $field
37+
* @param ClassMetadata<object> $meta
38+
* @param string $field
39+
* @param BlameableAdapter $eventAdapter
3940
*
4041
* @return mixed
4142
*/

src/Blameable/Mapping/Driver/Xml.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ public function readExtendedMetadata($meta, array &$config)
119119
/**
120120
* Checks if $field type is valid
121121
*
122-
* @param ClassMetadata $meta
123-
* @param string $field
122+
* @param ClassMetadata<object> $meta
123+
* @param string $field
124124
*
125125
* @return bool
126126
*/

src/Blameable/Mapping/Driver/Yaml.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ protected function _loadMappingFile($file)
125125
/**
126126
* Checks if $field type is valid
127127
*
128-
* @param ClassMetadata $meta
129-
* @param string $field
128+
* @param ClassMetadata<object> $meta
129+
* @param string $field
130130
*
131131
* @return bool
132132
*/

src/IpTraceable/IpTraceableListener.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Gedmo\AbstractTrackingListener;
1414
use Gedmo\Exception\InvalidArgumentException;
1515
use Gedmo\IpTraceable\Mapping\Event\IpTraceableAdapter;
16-
use Gedmo\Mapping\Event\AdapterInterface;
1716

1817
/**
1918
* The IpTraceable listener handles the update of
@@ -35,9 +34,9 @@ class IpTraceableListener extends AbstractTrackingListener
3534
/**
3635
* Get the ipValue value to set on a ip field
3736
*
38-
* @param ClassMetadata $meta
39-
* @param string $field
40-
* @param AdapterInterface $eventAdapter
37+
* @param ClassMetadata<object> $meta
38+
* @param string $field
39+
* @param IpTraceableAdapter $eventAdapter
4140
*
4241
* @return string|null
4342
*/

src/IpTraceable/Mapping/Driver/Xml.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ public function readExtendedMetadata($meta, array &$config)
121121
/**
122122
* Checks if $field type is valid
123123
*
124-
* @param ClassMetadata $meta
125-
* @param string $field
124+
* @param ClassMetadata<object> $meta
125+
* @param string $field
126126
*
127127
* @return bool
128128
*/

src/IpTraceable/Mapping/Driver/Yaml.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ protected function _loadMappingFile($file)
121121
/**
122122
* Checks if $field type is valid
123123
*
124-
* @param ClassMetadata $meta
125-
* @param string $field
124+
* @param ClassMetadata<object> $meta
125+
* @param string $field
126126
*
127127
* @return bool
128128
*/

0 commit comments

Comments
 (0)