propelorm / Propel2

Propel2 is an open-source high-performance Object-Relational Mapping (ORM) for modern PHP
http://propelorm.org/
MIT License
1.26k stars 399 forks source link

Remove outdated & on method #1794

Closed dereuromark closed 2 years ago

dereuromark commented 3 years ago

Refs https://github.com/propelorm/Propel2/issues/972

Lets see if that breaks something

Result:

There was 1 error:

1) Propel\Tests\Runtime\Collection\ArrayCollectionTest::testSave
Indirect modification of overloaded element of Propel\Runtime\Collection\ArrayCollection has no effect

/home/runner/work/Propel2/Propel2/tests/Propel/Tests/Runtime/Collection/ArrayCollectionTest.php:49
dereuromark commented 2 years ago

Anyone wants to help out here?

dereuromark commented 2 years ago

The code should also be fixed up to

      */
     public function &offsetGet($offset)
     {
-        if (isset($this->data[$offset])) {
-            return $this->data[$offset];
-        }
+        if (!isset($this->data[$offset])) {
+            return null;
+        }
+
+        return $this->data[$offset];
     }

     /**

But that is only possible if we can make this fix here happen first.

dereuromark commented 2 years ago

I guess we can just add

#[\ReturnTypeWillChange]

https://github.com/propelorm/Propel2/pull/1805/