Skip to content

Commit d9ea4a5

Browse files
authored
Merge pull request #1022 from toniperic/3.4.x
Add doctrine/persistence v4 support
2 parents 71540bc + c94a583 commit d9ea4a5

10 files changed

+145
-145
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
],
2020
"require": {
2121
"php": "^7.1 || ^8.0",
22-
"doctrine/persistence": "^2.0 || ^3.0"
22+
"doctrine/persistence": "^2.0 || ^3.0 || ^4.0"
2323
},
2424
"require-dev": {
2525
"doctrine/collections": "^1",

tests/Common/Proxy/LazyLoadableObjectClassMetadata.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ class LazyLoadableObjectClassMetadata implements ClassMetadata
3838
/**
3939
* {@inheritDoc}
4040
*/
41-
public function getName()
41+
public function getName(): string
4242
{
4343
return $this->getReflectionClass()->getName();
4444
}
4545

4646
/**
4747
* {@inheritDoc}
4848
*/
49-
public function getIdentifier()
49+
public function getIdentifier(): array
5050
{
5151
return array_keys($this->identifier);
5252
}
5353

5454
/**
5555
* {@inheritDoc}
5656
*/
57-
public function getReflectionClass()
57+
public function getReflectionClass(): ReflectionClass
5858
{
5959
if ($this->reflectionClass === null) {
6060
$this->reflectionClass = new ReflectionClass(__NAMESPACE__ . '\LazyLoadableObject');
@@ -66,103 +66,103 @@ public function getReflectionClass()
6666
/**
6767
* {@inheritDoc}
6868
*/
69-
public function isIdentifier($fieldName)
69+
public function isIdentifier($fieldName): bool
7070
{
7171
return isset($this->identifier[$fieldName]);
7272
}
7373

7474
/**
7575
* {@inheritDoc}
7676
*/
77-
public function hasField($fieldName)
77+
public function hasField($fieldName): bool
7878
{
7979
return isset($this->fields[$fieldName]);
8080
}
8181

8282
/**
8383
* {@inheritDoc}
8484
*/
85-
public function hasAssociation($fieldName)
85+
public function hasAssociation($fieldName): bool
8686
{
8787
return isset($this->associations[$fieldName]);
8888
}
8989

9090
/**
9191
* {@inheritDoc}
9292
*/
93-
public function isSingleValuedAssociation($fieldName)
93+
public function isSingleValuedAssociation($fieldName): bool
9494
{
9595
throw new BadMethodCallException('not implemented');
9696
}
9797

9898
/**
9999
* {@inheritDoc}
100100
*/
101-
public function isCollectionValuedAssociation($fieldName)
101+
public function isCollectionValuedAssociation($fieldName): bool
102102
{
103103
throw new BadMethodCallException('not implemented');
104104
}
105105

106106
/**
107107
* {@inheritDoc}
108108
*/
109-
public function getFieldNames()
109+
public function getFieldNames(): array
110110
{
111111
return array_keys($this->fields);
112112
}
113113

114114
/**
115115
* {@inheritDoc}
116116
*/
117-
public function getIdentifierFieldNames()
117+
public function getIdentifierFieldNames(): array
118118
{
119119
return $this->getIdentifier();
120120
}
121121

122122
/**
123123
* {@inheritDoc}
124124
*/
125-
public function getAssociationNames()
125+
public function getAssociationNames(): array
126126
{
127127
return array_keys($this->associations);
128128
}
129129

130130
/**
131131
* {@inheritDoc}
132132
*/
133-
public function getTypeOfField($fieldName)
133+
public function getTypeOfField($fieldName): ?string
134134
{
135135
return 'string';
136136
}
137137

138138
/**
139139
* {@inheritDoc}
140140
*/
141-
public function getAssociationTargetClass($assocName)
141+
public function getAssociationTargetClass($assocName): ?string
142142
{
143143
throw new BadMethodCallException('not implemented');
144144
}
145145

146146
/**
147147
* {@inheritDoc}
148148
*/
149-
public function isAssociationInverseSide($assocName)
149+
public function isAssociationInverseSide($assocName): bool
150150
{
151151
throw new BadMethodCallException('not implemented');
152152
}
153153

154154
/**
155155
* {@inheritDoc}
156156
*/
157-
public function getAssociationMappedByTargetField($assocName)
157+
public function getAssociationMappedByTargetField($assocName): string
158158
{
159159
throw new BadMethodCallException('not implemented');
160160
}
161161

162162
/**
163163
* {@inheritDoc}
164164
*/
165-
public function getIdentifierValues($object)
165+
public function getIdentifierValues($object): array
166166
{
167167
throw new BadMethodCallException('not implemented');
168168
}

tests/Common/Proxy/LazyLoadableObjectWithNullableTypehintsClassMetadata.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ class LazyLoadableObjectWithNullableTypehintsClassMetadata implements ClassMetad
3030
/**
3131
* {@inheritDoc}
3232
*/
33-
public function getName()
33+
public function getName(): string
3434
{
3535
return $this->getReflectionClass()->getName();
3636
}
3737

3838
/**
3939
* {@inheritDoc}
4040
*/
41-
public function getIdentifier()
41+
public function getIdentifier(): array
4242
{
4343
return array_keys($this->identifier);
4444
}
4545

4646
/**
4747
* {@inheritDoc}
4848
*/
49-
public function getReflectionClass()
49+
public function getReflectionClass(): ReflectionClass
5050
{
5151
if ($this->reflectionClass === null) {
5252
$this->reflectionClass = new ReflectionClass(__NAMESPACE__ . '\LazyLoadableObjectWithNullableTypehints');
@@ -58,103 +58,103 @@ public function getReflectionClass()
5858
/**
5959
* {@inheritDoc}
6060
*/
61-
public function isIdentifier($fieldName)
61+
public function isIdentifier($fieldName): bool
6262
{
6363
return isset($this->identifier[$fieldName]);
6464
}
6565

6666
/**
6767
* {@inheritDoc}
6868
*/
69-
public function hasField($fieldName)
69+
public function hasField($fieldName): bool
7070
{
7171
return isset($this->fields[$fieldName]);
7272
}
7373

7474
/**
7575
* {@inheritDoc}
7676
*/
77-
public function hasAssociation($fieldName)
77+
public function hasAssociation($fieldName): bool
7878
{
7979
return false;
8080
}
8181

8282
/**
8383
* {@inheritDoc}
8484
*/
85-
public function isSingleValuedAssociation($fieldName)
85+
public function isSingleValuedAssociation($fieldName): bool
8686
{
8787
throw new BadMethodCallException('not implemented');
8888
}
8989

9090
/**
9191
* {@inheritDoc}
9292
*/
93-
public function isCollectionValuedAssociation($fieldName)
93+
public function isCollectionValuedAssociation($fieldName): bool
9494
{
9595
throw new BadMethodCallException('not implemented');
9696
}
9797

9898
/**
9999
* {@inheritDoc}
100100
*/
101-
public function getFieldNames()
101+
public function getFieldNames(): array
102102
{
103103
return array_keys($this->fields);
104104
}
105105

106106
/**
107107
* {@inheritDoc}
108108
*/
109-
public function getIdentifierFieldNames()
109+
public function getIdentifierFieldNames(): array
110110
{
111111
return $this->getIdentifier();
112112
}
113113

114114
/**
115115
* {@inheritDoc}
116116
*/
117-
public function getAssociationNames()
117+
public function getAssociationNames(): array
118118
{
119119
return [];
120120
}
121121

122122
/**
123123
* {@inheritDoc}
124124
*/
125-
public function getTypeOfField($fieldName)
125+
public function getTypeOfField($fieldName): ?string
126126
{
127127
return 'string';
128128
}
129129

130130
/**
131131
* {@inheritDoc}
132132
*/
133-
public function getAssociationTargetClass($assocName)
133+
public function getAssociationTargetClass($assocName): ?string
134134
{
135135
throw new BadMethodCallException('not implemented');
136136
}
137137

138138
/**
139139
* {@inheritDoc}
140140
*/
141-
public function isAssociationInverseSide($assocName)
141+
public function isAssociationInverseSide($assocName): bool
142142
{
143143
throw new BadMethodCallException('not implemented');
144144
}
145145

146146
/**
147147
* {@inheritDoc}
148148
*/
149-
public function getAssociationMappedByTargetField($assocName)
149+
public function getAssociationMappedByTargetField($assocName): string
150150
{
151151
throw new BadMethodCallException('not implemented');
152152
}
153153

154154
/**
155155
* {@inheritDoc}
156156
*/
157-
public function getIdentifierValues($object)
157+
public function getIdentifierValues($object): array
158158
{
159159
throw new BadMethodCallException('not implemented');
160160
}

0 commit comments

Comments
 (0)