Skip to content

Commit d573d26

Browse files
committed
Apply "strict_param" CS rule
1 parent fd7c527 commit d573d26

File tree

45 files changed

+88
-86
lines changed

Some content is hidden

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

45 files changed

+88
-86
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
'random_api_migration' => true,
6565
'self_accessor' => true,
6666
'static_lambda' => true,
67+
'strict_param' => true,
6768
'ternary_to_null_coalescing' => true,
6869
])
6970
->setFinder($finder)

src/AbstractTrackingListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function onFlush(EventArgs $args)
137137
$value = $changes[1];
138138
}
139139

140-
if (($singleField && in_array($value, (array) $options['value'])) || null === $options['value']) {
140+
if (null === $options['value'] || ($singleField && in_array($value, (array) $options['value'], true))) {
141141
$needChanges = true;
142142
$this->updateField($object, $ea, $meta, $options['field']);
143143
}

src/Blameable/Mapping/Driver/Annotation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function readExtendedMetadata($meta, array &$config)
6969
throw new InvalidMappingException("Association - [{$field}] is not valid, it must be a one-to-many relation or a string field - {$meta->getName()}");
7070
}
7171
}
72-
if (!in_array($blameable->on, ['update', 'create', 'change'])) {
72+
if (!in_array($blameable->on, ['update', 'create', 'change'], true)) {
7373
throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->getName()}");
7474
}
7575
if ('change' == $blameable->on) {

src/Blameable/Mapping/Driver/Xml.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function readExtendedMetadata($meta, array &$config)
6060
if (!$this->isValidField($meta, $field)) {
6161
throw new InvalidMappingException("Field - [{$field}] type is not valid and must be 'string' or a reference in class - {$meta->getName()}");
6262
}
63-
if (!$this->_isAttributeSet($data, 'on') || !in_array($this->_getAttribute($data, 'on'), ['update', 'create', 'change'])) {
63+
if (!$this->_isAttributeSet($data, 'on') || !in_array($this->_getAttribute($data, 'on'), ['update', 'create', 'change'], true)) {
6464
throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->getName()}");
6565
}
6666

@@ -93,7 +93,7 @@ public function readExtendedMetadata($meta, array &$config)
9393
if (!$meta->isSingleValuedAssociation($field)) {
9494
throw new InvalidMappingException("Association - [{$field}] is not valid, it must be a one-to-many relation or a string field - {$meta->getName()}");
9595
}
96-
if (!$this->_isAttributeSet($data, 'on') || !in_array($this->_getAttribute($data, 'on'), ['update', 'create', 'change'])) {
96+
if (!$this->_isAttributeSet($data, 'on') || !in_array($this->_getAttribute($data, 'on'), ['update', 'create', 'change'], true)) {
9797
throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->getName()}");
9898
}
9999

@@ -130,6 +130,6 @@ protected function isValidField($meta, $field)
130130
{
131131
$mapping = $meta->getFieldMapping($field);
132132

133-
return $mapping && in_array($mapping['type'], $this->validTypes);
133+
return $mapping && in_array($mapping['type'], $this->validTypes, true);
134134
}
135135
}

src/Blameable/Mapping/Driver/Yaml.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function readExtendedMetadata($meta, array &$config)
5555
if (!$this->isValidField($meta, $field)) {
5656
throw new InvalidMappingException("Field - [{$field}] type is not valid and must be 'string' or a reference in class - {$meta->getName()}");
5757
}
58-
if (!isset($mappingProperty['on']) || !in_array($mappingProperty['on'], ['update', 'create', 'change'])) {
58+
if (!isset($mappingProperty['on']) || !in_array($mappingProperty['on'], ['update', 'create', 'change'], true)) {
5959
throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->getName()}");
6060
}
6161

@@ -86,7 +86,7 @@ public function readExtendedMetadata($meta, array &$config)
8686
if (!$meta->isSingleValuedAssociation($field)) {
8787
throw new InvalidMappingException("Association - [{$field}] is not valid, it must be a one-to-many relation or a string field - {$meta->getName()}");
8888
}
89-
if (!isset($mappingProperty['on']) || !in_array($mappingProperty['on'], ['update', 'create', 'change'])) {
89+
if (!isset($mappingProperty['on']) || !in_array($mappingProperty['on'], ['update', 'create', 'change'], true)) {
9090
throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->getName()}");
9191
}
9292

@@ -131,6 +131,6 @@ protected function isValidField($meta, $field)
131131
{
132132
$mapping = $meta->getFieldMapping($field);
133133

134-
return $mapping && in_array($mapping['type'], $this->validTypes);
134+
return $mapping && in_array($mapping['type'], $this->validTypes, true);
135135
}
136136
}

src/IpTraceable/Mapping/Driver/Annotation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function readExtendedMetadata($meta, array &$config)
6060
if ($meta->hasField($field) && !$this->isValidField($meta, $field)) {
6161
throw new InvalidMappingException("Field - [{$field}] type is not valid and must be 'string' - {$meta->getName()}");
6262
}
63-
if (!in_array($ipTraceable->on, ['update', 'create', 'change'])) {
63+
if (!in_array($ipTraceable->on, ['update', 'create', 'change'], true)) {
6464
throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->getName()}");
6565
}
6666
if ('change' == $ipTraceable->on) {

src/IpTraceable/Mapping/Driver/Xml.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function readExtendedMetadata($meta, array &$config)
6060
if (!$this->isValidField($meta, $field)) {
6161
throw new InvalidMappingException("Field - [{$field}] type is not valid and must be 'string' in class - {$meta->getName()}");
6262
}
63-
if (!$this->_isAttributeSet($data, 'on') || !in_array($this->_getAttribute($data, 'on'), ['update', 'create', 'change'])) {
63+
if (!$this->_isAttributeSet($data, 'on') || !in_array($this->_getAttribute($data, 'on'), ['update', 'create', 'change'], true)) {
6464
throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->getName()}");
6565
}
6666

@@ -97,7 +97,7 @@ public function readExtendedMetadata($meta, array &$config)
9797
if (!$meta->isSingleValuedAssociation($field)) {
9898
throw new InvalidMappingException("Association - [{$field}] is not valid, it must be a one-to-many relation or a string field - {$meta->getName()}");
9999
}
100-
if (!$this->_isAttributeSet($data, 'on') || !in_array($this->_getAttribute($data, 'on'), ['update', 'create', 'change'])) {
100+
if (!$this->_isAttributeSet($data, 'on') || !in_array($this->_getAttribute($data, 'on'), ['update', 'create', 'change'], true)) {
101101
throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->getName()}");
102102
}
103103

@@ -134,6 +134,6 @@ protected function isValidField($meta, $field)
134134
{
135135
$mapping = $meta->getFieldMapping($field);
136136

137-
return $mapping && in_array($mapping['type'], $this->validTypes);
137+
return $mapping && in_array($mapping['type'], $this->validTypes, true);
138138
}
139139
}

src/IpTraceable/Mapping/Driver/Yaml.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function readExtendedMetadata($meta, array &$config)
5353
if (!$this->isValidField($meta, $field)) {
5454
throw new InvalidMappingException("Field - [{$field}] type is not valid and must be 'string' in class - {$meta->getName()}");
5555
}
56-
if (!isset($mappingProperty['on']) || !in_array($mappingProperty['on'], ['update', 'create', 'change'])) {
56+
if (!isset($mappingProperty['on']) || !in_array($mappingProperty['on'], ['update', 'create', 'change'], true)) {
5757
throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->getName()}");
5858
}
5959

@@ -84,7 +84,7 @@ public function readExtendedMetadata($meta, array &$config)
8484
if (!$meta->isSingleValuedAssociation($field)) {
8585
throw new InvalidMappingException("Association - [{$field}] is not valid, it must be a one-to-many relation or a string field - {$meta->getName()}");
8686
}
87-
if (!isset($mappingProperty['on']) || !in_array($mappingProperty['on'], ['update', 'create', 'change'])) {
87+
if (!isset($mappingProperty['on']) || !in_array($mappingProperty['on'], ['update', 'create', 'change'], true)) {
8888
throw new InvalidMappingException("Field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$meta->getName()}");
8989
}
9090

@@ -129,6 +129,6 @@ protected function isValidField($meta, $field)
129129
{
130130
$mapping = $meta->getFieldMapping($field);
131131

132-
return $mapping && in_array($mapping['type'], $this->validTypes);
132+
return $mapping && in_array($mapping['type'], $this->validTypes, true);
133133
}
134134
}

src/Loggable/Document/Repository/LogEntryRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ protected function fillDocument($document, array $data)
110110
$config = $this->getLoggableListener()->getConfiguration($this->dm, $objectMeta->getName());
111111
$fields = $config['versioned'];
112112
foreach ($data as $field => $value) {
113-
if (!in_array($field, $fields)) {
113+
if (!in_array($field, $fields, true)) {
114114
continue;
115115
}
116116
$mapping = $objectMeta->getFieldMapping($field);

src/Loggable/Entity/Repository/LogEntryRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ public function revert($entity, $version = 1)
106106
while (($log = array_pop($logs)) && !$filled) {
107107
if ($data = $log->getData()) {
108108
foreach ($data as $field => $value) {
109-
if (in_array($field, $fields)) {
109+
if (in_array($field, $fields, true)) {
110110
$this->mapValue($objectMeta, $field, $value);
111111
$wrapped->setPropertyValue($field, $value);
112-
unset($fields[array_search($field, $fields)]);
112+
unset($fields[array_search($field, $fields, true)]);
113113
}
114114
}
115115
}

0 commit comments

Comments
 (0)