From bb5f630270a3c16f84c05b98cd88ba4febbe6390 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 20 Mar 2018 13:17:14 +0200 Subject: [PATCH 1/2] PHP 7.2 - deprecated "each" calls PHP 7.2 - deprecated "each" calls remove tab --- lib/Doctrine/Connection/UnitOfWork.php | 4 ++-- lib/Doctrine/Hydrator/Graph.php | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/Doctrine/Connection/UnitOfWork.php b/lib/Doctrine/Connection/UnitOfWork.php index 25b34bcfe..9627d6d19 100644 --- a/lib/Doctrine/Connection/UnitOfWork.php +++ b/lib/Doctrine/Connection/UnitOfWork.php @@ -237,7 +237,7 @@ private function _executeDeletions(array $deletions) $params = array(); $columnNames = array(); foreach ($identifierMaps as $idMap) { - while (list($fieldName, $value) = each($idMap)) { + foreach($idMap as $fieldName => $value) { $params[] = $value; $columnNames[] = $table->getColumnName($fieldName); } @@ -957,4 +957,4 @@ protected function _assignIdentifier(Doctrine_Record $record) $record->assignIdentifier(true); } } -} \ No newline at end of file +} diff --git a/lib/Doctrine/Hydrator/Graph.php b/lib/Doctrine/Hydrator/Graph.php index 726aed31f..6dbf0af3b 100644 --- a/lib/Doctrine/Hydrator/Graph.php +++ b/lib/Doctrine/Hydrator/Graph.php @@ -256,7 +256,7 @@ public function hydrateResultSet($stmt) } else if ( ! isset($prev[$parent][$relationAlias])) { $element = $this->getElement($data, $componentName); - // [FIX] Tickets #1205 and #1237 + // [FIX] Tickets #1205 and #1237 $event->set('data', $element); $listeners[$componentName]->postHydrate($event); $instances[$componentName]->postHydrate($event); @@ -417,13 +417,14 @@ protected function _getClassnameToReturn(array &$data, $component) $matchedComponents[] = $table->getComponentName(); } } else { - list($key, $value) = each($inheritanceMap); - $key = $this->_tables[$component]->getFieldName($key); - if ( ! isset($data[$key]) || $data[$key] != $value) { - continue; - } else { - $matchedComponents[] = $table->getComponentName(); - } + foreach($inheritanceMap as $key => $value) { + $key = $this->_tables[$component]->getFieldName($key); + if ( ! isset($data[$key]) || $data[$key] != $value) { + continue; + } else { + $matchedComponents[] = $table->getComponentName(); + } + } } } From 23c6c40e1c11fac59b5cc7bd113c157ba8a93d6d Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 20 Mar 2018 13:22:41 +0200 Subject: [PATCH 2/2] travis php 7.2 --- .travis.yml | 1 + lib/Doctrine/Hydrator/Graph.php | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4eba528ca..bb2741623 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ php: - 5.6 - 7.0 - 7.1 + - 7.2 - hhvm - nightly diff --git a/lib/Doctrine/Hydrator/Graph.php b/lib/Doctrine/Hydrator/Graph.php index 6dbf0af3b..3c4b845e7 100644 --- a/lib/Doctrine/Hydrator/Graph.php +++ b/lib/Doctrine/Hydrator/Graph.php @@ -409,7 +409,7 @@ protected function _getClassnameToReturn(array &$data, $component) $needMatches = count($inheritanceMap); foreach ($inheritanceMap as $key => $value) { $key = $this->_tables[$component]->getFieldName($key); - if ( isset($data[$key]) && $data[$key] == $value) { + if (isset($data[$key]) && $data[$key] == $value) { --$needMatches; } } @@ -417,14 +417,14 @@ protected function _getClassnameToReturn(array &$data, $component) $matchedComponents[] = $table->getComponentName(); } } else { - foreach($inheritanceMap as $key => $value) { - $key = $this->_tables[$component]->getFieldName($key); - if ( ! isset($data[$key]) || $data[$key] != $value) { - continue; - } else { - $matchedComponents[] = $table->getComponentName(); - } - } + foreach ($inheritanceMap as $key => $value) { + $key = $this->_tables[$component]->getFieldName($key); + if (!isset($data[$key]) || $data[$key] != $value) { + continue; + } else { + $matchedComponents[] = $table->getComponentName(); + } + } } }