Skip to content

Commit 10285c8

Browse files
committed
Fix PHPStan
1 parent 86fac15 commit 10285c8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Model/Behavior/ResetBehavior.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ public function resetRecords(array $params = []) {
132132
}
133133

134134
$modified = 0;
135-
while (($records = $this->_table->find('all', ...$params)->toArray())) {
135+
while (($records = $this->_table->find('all', ...$params)->all()->toArray())) {
136+
/** @var \Cake\Datasource\EntityInterface $record */
136137
foreach ($records as $record) {
137138
$fields = (array)$params['fields'];
138139
if ($this->getConfig('updateFields')) {
@@ -148,8 +149,10 @@ public function resetRecords(array $params = []) {
148149
if ($this->_config['callback']) {
149150
if (is_callable($this->_config['callback'])) {
150151
$parameters = [$record, &$fields];
152+
/** @var \Cake\Datasource\EntityInterface $record */
151153
$record = call_user_func_array($this->_config['callback'], $parameters);
152154
} else {
155+
/** @var \Cake\Datasource\EntityInterface $record */
153156
$record = $this->_table->{$this->_config['callback']}($record, $fields);
154157
}
155158
if (!$record) {

src/Model/Behavior/TypographicBehavior.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ public function beforeSave(EventInterface $event, EntityInterface $entity, Array
163163
public function updateTypography($dryRun = false) {
164164
$options = ['limit' => 100, 'offset' => 0];
165165
$count = 0;
166-
while ($records = $this->table()->find('all', ...$options)->toArray()) {
166+
while ($records = $this->table()->find('all', ...$options)->all()->toArray()) {
167+
/** @var \Cake\Datasource\EntityInterface $record */
167168
foreach ($records as $record) {
168169
$changed = false;
169170
foreach ($this->_config['fields'] as $field) {

0 commit comments

Comments
 (0)