Browse Source

Restore previous return value on write().

This is a breaking change that isn't adding much for us our the
community.
Mark Story 7 years ago
parent
commit
feaf13b59d
2 changed files with 6 additions and 4 deletions
  1. 4 2
      src/Core/Configure.php
  2. 2 2
      tests/TestCase/Core/ConfigureTest.php

+ 4 - 2
src/Core/Configure.php

@@ -78,10 +78,10 @@ class Configure
      * @param string|array $config The key to write, can be a dot notation value.
      * Alternatively can be an array containing key(s) and value(s).
      * @param mixed $value Value to set for var
-     * @return void
+     * @return bool
      * @link https://book.cakephp.org/3.0/en/development/configuration.html#writing-configuration-data
      */
-    public static function write($config, $value = null): void
+    public static function write($config, $value = null): bool
     {
         if (!is_array($config)) {
             $config = [$config => $value];
@@ -99,6 +99,8 @@ class Configure
                 ini_set('display_errors', $config['debug'] ? '1' : '0');
             }
         }
+
+        return true;
     }
 
     /**

+ 2 - 2
tests/TestCase/Core/ConfigureTest.php

@@ -135,11 +135,11 @@ class ConfigureTest extends TestCase
      */
     public function testWrite()
     {
-        Configure::write('SomeName.someKey', 'myvalue');
+        $this->assertTrue(Configure::write('SomeName.someKey', 'myvalue'));
         $result = Configure::read('SomeName.someKey');
         $this->assertEquals('myvalue', $result);
 
-        Configure::write('SomeName.someKey', null);
+        $this->assertTrue(Configure::write('SomeName.someKey', null));
         $result = Configure::read('SomeName.someKey');
         $this->assertNull($result);