Skip to content

Commit

Permalink
Update PR with PHP Stan by fixing some and baselining other violations.
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Dec 8, 2024
1 parent 238fb74 commit 5a22007
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
42 changes: 24 additions & 18 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -984,12 +984,6 @@ parameters:
count: 1
path: src/Mapping/ClassMetadata.php

-
message: '#^Parameter \#1 \$class of method Doctrine\\Persistence\\Mapping\\ReflectionService\:\:getAccessibleProperty\(\) expects class\-string, string given\.$#'
identifier: argument.type
count: 1
path: src/Mapping/ClassMetadata.php

-
message: '#^Parameter \#1 \$mapping of method Doctrine\\ORM\\Mapping\\ClassMetadata\<T of object\>\:\:validateAndCompleteTypedAssociationMapping\(\) expects array\{type\: 1\|2\|4\|8, fieldName\: string, targetEntity\?\: class\-string\}, non\-empty\-array\<string, mixed\> given\.$#'
identifier: argument.type
Expand Down Expand Up @@ -1032,18 +1026,6 @@ parameters:
count: 2
path: src/Mapping/ClassMetadata.php

-
message: '#^Parameter \#2 \$class of method Doctrine\\ORM\\Mapping\\ClassMetadata\<T of object\>\:\:getAccessibleProperty\(\) expects class\-string, string given\.$#'
identifier: argument.type
count: 1
path: src/Mapping/ClassMetadata.php

-
message: '#^Parameter \#3 \$embeddedClass of class Doctrine\\ORM\\Mapping\\ReflectionEmbeddedProperty constructor expects class\-string, string given\.$#'
identifier: argument.type
count: 1
path: src/Mapping/ClassMetadata.php

-
message: '#^Property Doctrine\\ORM\\Mapping\\ClassMetadata\:\:\$customRepositoryClassName with generic class Doctrine\\ORM\\EntityRepository does not specify its types\: T$#'
identifier: missingType.generics
Expand Down Expand Up @@ -1500,12 +1482,36 @@ parameters:
count: 1
path: src/Mapping/JoinTableMapping.php

-
message: '#^Method Doctrine\\ORM\\Mapping\\LegacyReflectionFields\:\:__construct\(\) has parameter \$classMetadata with generic class Doctrine\\ORM\\Mapping\\ClassMetadata but does not specify its types\: T$#'
identifier: missingType.generics
count: 1
path: src/Mapping/LegacyReflectionFields.php

-
message: '#^Parameter \#1 \$class of method Doctrine\\Persistence\\Mapping\\ReflectionService\:\:getAccessibleProperty\(\) expects class\-string, string given\.$#'
identifier: argument.type
count: 1
path: src/Mapping/LegacyReflectionFields.php

-
message: '#^Method Doctrine\\ORM\\Mapping\\MappedSuperclass\:\:__construct\(\) has parameter \$repositoryClass with generic class Doctrine\\ORM\\EntityRepository but does not specify its types\: T$#'
identifier: missingType.generics
count: 1
path: src/Mapping/MappedSuperclass.php

-
message: '#^Method Doctrine\\ORM\\Mapping\\PropertyAccessors\\EnumPropertyAccessor\:\:toEnum\(\) should return array\<BackedEnum\>\|BackedEnum but returns array\<BackedEnum\|int\|string\>\.$#'
identifier: return.type
count: 1
path: src/Mapping/PropertyAccessors/EnumPropertyAccessor.php

-
message: '#^Parameter \#1 \$callback of function array_map expects \(callable\(BackedEnum\|int\|string\)\: mixed\)\|null, array\{class\-string\<BackedEnum\>, ''from''\} given\.$#'
identifier: argument.type
count: 1
path: src/Mapping/PropertyAccessors/EnumPropertyAccessor.php

-
message: '#^Method Doctrine\\ORM\\Mapping\\QuoteStrategy\:\:getColumnAlias\(\) has parameter \$class with generic class Doctrine\\ORM\\Mapping\\ClassMetadata but does not specify its types\: T$#'
identifier: missingType.generics
Expand Down
2 changes: 1 addition & 1 deletion src/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -2688,7 +2688,7 @@ public function getSequencePrefix(AbstractPlatform $platform): string
return $sequencePrefix;
}

/** @phpstan-param class-string $class */
/** @phpstan-param class-string $className */
private function createPropertyAccessor(string $className, string $propertyName): PropertyAccessor
{
$reflectionProperty = new ReflectionProperty($className, $propertyName);
Expand Down
3 changes: 2 additions & 1 deletion src/Mapping/FieldMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ final class FieldMapping implements ArrayAccess
*/
public string|null $inherited = null;

/** @var class-string|null */
public string|null $originalClass = null;
public string|null $originalField = null;
public bool|null $quoted = null;
Expand Down Expand Up @@ -101,7 +102,7 @@ public function __construct(
* scale?: int|null,
* unique?: bool|null,
* inherited?: string|null,
* originalClass?: string|null,
* originalClass?: class-string|null,
* originalField?: string|null,
* quoted?: bool|null,
* declared?: string|null,
Expand Down

0 comments on commit 5a22007

Please sign in to comment.