Explorar o código

removing uses of depricated function create_function()

George Appleton %!s(int64=7) %!d(string=hai) anos
pai
achega
b1377041af

+ 1 - 1
documentation/manual/de/module_specs/Zend_View-Helpers-Navigation.xml

@@ -756,7 +756,7 @@ echo $this->navigation()->breadcrumbs()
 
             <programlisting language="php"><![CDATA[
 echo implode(', ', array_map(
-        create_function('$a', 'return $a->getLabel();'),
+        function ($a) { return $a->getLabel(); },
         $this->pages));
 ]]></programlisting>
 

+ 9 - 9
documentation/manual/en/module_specs/Zend_View-Helpers-Navigation.xml

@@ -762,7 +762,7 @@ echo $this->navigation()->breadcrumbs()
 
             <programlisting language="php"><![CDATA[
 echo implode(', ', array_map(
-        create_function('$a', 'return $a->getLabel();'),
+        function ($a) { return $a->getLabel(); },
         $this->pages));
 ]]></programlisting>
 
@@ -1261,10 +1261,10 @@ Output:
                     should be rendered.
                 </para>
             </listitem>
-            
+
             <listitem>
                 <para>
-                    <code>{get|set}ExpandSiblingNodesOfActiveBranch()</code> 
+                    <code>{get|set}ExpandSiblingNodesOfActiveBranch()</code>
                     gets/sets a flag specifying whether the sibling nodes of all
                     nodes in the active branch should also be expanded and rendered.
                 </para>
@@ -1380,8 +1380,8 @@ Output:
 
                     <listitem>
                         <para>
-                            <code>expandSiblingNodesOfActiveBranch</code>; 
-                            whether the sibling nodes of nodes in the active 
+                            <code>expandSiblingNodesOfActiveBranch</code>;
+                            whether the sibling nodes of nodes in the active
                             branch should be expanded and rendered. Expects
                             a <type>Boolean</type> value.
                         </para>
@@ -1823,7 +1823,7 @@ Output:
 </ul>
 ]]></programlisting>
         </example>
-        
+
         <example id="zend.view.helpers.initial.navigation.menu.example10">
             <title>Rendering a custom menu using a partial view script</title>
 
@@ -1862,10 +1862,10 @@ foreach ($this->container as $page) {
 <a href="/community">Community</a>
 ]]></programlisting>
         </example>
-        
+
         <example id="zend.view.helpers.initial.navigation.menu.example11">
             <title>
-                Rendering only the active branch and all siblings of the active branch 
+                Rendering only the active branch and all siblings of the active branch
             </title>
 
             <programlisting language="php"><![CDATA[
@@ -1911,7 +1911,7 @@ echo $this->navigation()
     </li>
 </ul>
 ]]></programlisting>
-        </example>        
+        </example>
     </sect4>
 
     <sect4 id="zend.view.helpers.initial.navigation.sitemap">

+ 1 - 1
library/Zend/Feed/Element.php

@@ -193,7 +193,7 @@ class Zend_Feed_Element implements ArrayAccess
         if ($length == 1) {
             return new Zend_Feed_Element($nodes[0]);
         } elseif ($length > 1) {
-            return array_map(create_function('$e', 'return new Zend_Feed_Element($e);'), $nodes);
+            return array_map(function ($e) { return new Zend_Feed_Element($e); }, $nodes);
         } else {
             // When creating anonymous nodes for __set chaining, don't
             // call appendChild() on them. Instead we pass the current

+ 16 - 16
tests/Zend/Form/FormTest.php

@@ -2790,9 +2790,9 @@ class Zend_Form_FormTest extends PHPUnit_Framework_TestCase
     */
     public function _setup9697()
     {
-        $callback = create_function('$value, $options',
-                                    'return (isset($options["bar"]["quo"]["foo"]) &&
-                                             "foo Value" === $options["bar"]["quo"]["foo"]);');
+        $callback = function($value, $options) {
+          return (isset($options["bar"]["quo"]["foo"]) && "foo Value" === $options["bar"]["quo"]["foo"]);
+        };
 
         $this->form->addElement('text', 'foo')
                    ->foo->setBelongsTo('bar[quo]');
@@ -4596,7 +4596,7 @@ class Zend_Form_FormTest extends PHPUnit_Framework_TestCase
         }
         $this->assertNotEquals($result,'');
     }
-    
+
     /**
      * @group ZF-11088
      */
@@ -4608,7 +4608,7 @@ class Zend_Form_FormTest extends PHPUnit_Framework_TestCase
         $errorMessages = $element->getErrorMessages();
         $this->assertSame(1, count($errorMessages));
         $this->assertSame($errorString, $errorMessages[0]);
-        
+
         $element2 = new Zend_Form_Element_Text('bar');
         $this->form->addElement($element2);
         $this->form->getElement('bar')->addError($errorString);
@@ -4616,7 +4616,7 @@ class Zend_Form_FormTest extends PHPUnit_Framework_TestCase
         $this->assertSame(1, count($errorMessages2));
         $this->assertSame($errorString, $errorMessages2[0]);
     }
-    
+
     /**
      * @group ZF-10865
      * @expectedException Zend_Form_Exception
@@ -4644,7 +4644,7 @@ class Zend_Form_FormTest extends PHPUnit_Framework_TestCase
         $count = substr_count($html, 'randomelementname-element');
         $this->assertEquals(1, $count, $html);
     }
-    
+
     /**
      * @group ZF-11831
      */
@@ -4659,7 +4659,7 @@ class Zend_Form_FormTest extends PHPUnit_Framework_TestCase
             'locale' => 'en'
         ));
         Zend_Registry::set('Zend_Translate', $trDefault);
-        
+
         // Translator to use for elements
         $trElement = new Zend_Translate(array(
             'adapter' => 'array',
@@ -4669,14 +4669,14 @@ class Zend_Form_FormTest extends PHPUnit_Framework_TestCase
             'locale' => 'en'
         ));
         Zend_Validate_Abstract::setDefaultTranslator($trElement);
-        
+
         // Change the form's translator
         $form = new Zend_Form();
         $form->addElement(new Zend_Form_Element_Text('foo', array(
             'required'   => true,
             'validators' => array('NotEmpty')
         )));
-        
+
         // Create a subform with it's own validator
         $sf1 = new Zend_Form_SubForm();
         $sf1->addElement(new Zend_Form_Element_Text('foosub', array(
@@ -4684,20 +4684,20 @@ class Zend_Form_FormTest extends PHPUnit_Framework_TestCase
             'validators' => array('NotEmpty')
         )));
         $form->addSubForm($sf1, 'Test1');
-        
+
         $form->isValid(array());
 
         $messages = $form->getMessages();
         $this->assertEquals(
-            'Element', 
-            @$messages['foo'][Zend_Validate_NotEmpty::IS_EMPTY], 
+            'Element',
+            @$messages['foo'][Zend_Validate_NotEmpty::IS_EMPTY],
             'Form element received wrong validator'
         );
         $this->assertEquals(
-            'Element', 
-            @$messages['Test1']['foosub'][Zend_Validate_NotEmpty::IS_EMPTY], 
+            'Element',
+            @$messages['Test1']['foosub'][Zend_Validate_NotEmpty::IS_EMPTY],
             'SubForm element received wrong validator'
-        );        
+        );
     }
 
     /**

+ 4 - 4
tests/Zend/Gdata/AppTest.php

@@ -598,8 +598,8 @@ class Zend_Gdata_AppTest extends PHPUnit_Framework_TestCase
 
     /**
      * When error handler is overridden to throw an ErrorException, the extension loader
-     * in Zend_Gdata will throw an ErrorException when the class doesn't exist in the 
-     * first extension directory even if it exists in subsequent ones.  This test 
+     * in Zend_Gdata will throw an ErrorException when the class doesn't exist in the
+     * first extension directory even if it exists in subsequent ones.  This test
      * enforces a fix that keeps this from happening
      *
      * @group ZF-12268
@@ -608,8 +608,8 @@ class Zend_Gdata_AppTest extends PHPUnit_Framework_TestCase
     public function testLoadExtensionCausesFatalErrorWhenErrorHandlerIsOverridden()
     {
         // Override the error handler to throw an ErrorException
-        set_error_handler(create_function('$a, $b, $c, $d', 'throw new ErrorException($b, 0, $a, $c, $d);'), E_ALL);
-        try { 
+        set_error_handler(function($a, $b, $c, $d) { throw new ErrorException($b, 0, $a, $c, $d); }, E_ALL);
+        try {
             $eq = $this->service->newEventQuery();
             restore_error_handler();
             $this->assertTrue($eq instanceof Zend_Gdata_Calendar_EventQuery);

+ 2 - 2
tests/Zend/View/Helper/Navigation/_files/mvc/views/bc.phtml

@@ -1,4 +1,4 @@
 <?php
 echo implode(', ', array_map(
-        create_function('$a', 'return $a->getLabel();'),
-        $this->pages));
+        function($a) { return $a->getLabel(); },
+        $this->pages));