Browse Source

Merge pull request #9875 from cakephp/static-analysis-fixes

Static analysis fixes
ADmad 9 years ago
parent
commit
cc1e2b508f

+ 1 - 3
src/Auth/DigestAuthenticate.php

@@ -83,8 +83,6 @@ class DigestAuthenticate extends BasicAuthenticate
      */
     public function __construct(ComponentRegistry $registry, array $config = [])
     {
-        $this->_registry = $registry;
-
         $this->config([
             'nonceLifetime' => 300,
             'secret' => Configure::read('Security.salt'),
@@ -93,7 +91,7 @@ class DigestAuthenticate extends BasicAuthenticate
             'opaque' => null,
         ]);
 
-        $this->config($config);
+        parent::__construct($registry, $config);
     }
 
     /**

+ 1 - 1
src/Datasource/EntityInterface.php

@@ -60,7 +60,7 @@ interface EntityInterface extends ArrayAccess, JsonSerializable
      * Removes a property or list of properties from this entity
      *
      * @param string|array $property The property to unset.
-     * @return \Cake\ORM\
+     * @return \Cake\Datasource\EntityInterface
      */
     public function unsetProperty($property);
 

+ 1 - 1
src/Datasource/RuleInvoker.php

@@ -104,7 +104,7 @@ class RuleInvoker
     /**
      * Invoke the rule.
      *
-     * @param \Cake\Datasouce\EntityInterface $entity The entity the rule
+     * @param \Cake\Datasource\EntityInterface $entity The entity the rule
      *   should apply to.
      * @param array $scope The rule's scope/options.
      * @return bool Whether or not the rule passed.

+ 7 - 0
src/Error/BaseErrorHandler.php

@@ -31,6 +31,13 @@ abstract class BaseErrorHandler
 {
 
     /**
+     * Options to use for the Error handling.
+     *
+     * @var array
+     */
+    protected $_options = [];
+
+    /**
      * Display an error message in an environment specific way.
      *
      * Subclasses should implement this method to display the error as

+ 0 - 8
src/Error/ErrorHandler.php

@@ -84,14 +84,6 @@ use Exception;
  */
 class ErrorHandler extends BaseErrorHandler
 {
-
-    /**
-     * Options to use for the Error handling.
-     *
-     * @var array
-     */
-    protected $_options = [];
-
     /**
      * Constructor
      *

+ 2 - 2
src/Form/Form.php

@@ -39,7 +39,7 @@ class Form
     /**
      * The schema used by this form.
      *
-     * @var \Cake\Form\Schema;
+     * @var \Cake\Form\Schema
      */
     protected $_schema;
 
@@ -53,7 +53,7 @@ class Form
     /**
      * The validator used by this form.
      *
-     * @var \Cake\Validation\Validator;
+     * @var \Cake\Validation\Validator
      */
     protected $_validator;
 

+ 1 - 1
src/Http/Client/Auth/Oauth.php

@@ -252,7 +252,7 @@ class Oauth
      *
      * Section 9.1.2. of the Oauth spec
      *
-     * @param Psr\Http\Message\UriInterface $uri Uri object to build a normalized version of.
+     * @param \Psr\Http\Message\UriInterface $uri Uri object to build a normalized version of.
      * @return string Normalized URL
      */
     protected function _normalizedUrl($uri)

+ 8 - 1
src/Http/ServerRequest.php

@@ -125,6 +125,13 @@ class ServerRequest implements ArrayAccess, ServerRequestInterface
     public $trustProxy = false;
 
     /**
+     * Contents of php://input
+     *
+     * @var string
+     */
+    protected $_input;
+
+    /**
      * The built in detectors used with `is()` can be modified with `addDetector()`.
      *
      * There are several ways to specify a detector, see \Cake\Http\ServerRequest::addDetector() for the
@@ -1885,7 +1892,7 @@ class ServerRequest implements ArrayAccess, ServerRequestInterface
      * Get the uploaded file from a dotted path.
      *
      * @param string $path The dot separated path to the file you want.
-     * @return null|Psr\Http\Message\UploadedFileInterface
+     * @return null|\Psr\Http\Message\UploadedFileInterface
      */
     public function getUploadedFile($path)
     {

+ 1 - 1
src/I18n/MessagesFileLoader.php

@@ -130,7 +130,7 @@ class MessagesFileLoader
         }
 
         $name = ucfirst($ext);
-        $class = App::classname($name, 'I18n\Parser', 'FileParser');
+        $class = App::className($name, 'I18n\Parser', 'FileParser');
 
         if (!$class) {
             throw new RuntimeException(sprintf('Could not find class %s', "{$name}FileParser"));

+ 1 - 1
src/ORM/Behavior/TimestampBehavior.php

@@ -83,7 +83,7 @@ class TimestampBehavior extends Behavior
      * @param \Cake\Event\Event $event Event instance.
      * @param \Cake\Datasource\EntityInterface $entity Entity instance.
      * @throws \UnexpectedValueException if a field's when value is misdefined
-     * @return true (irrespective of the behavior logic, the save will not be prevented)
+     * @return bool Returns true irrespective of the behavior logic, the save will not be prevented.
      * @throws \UnexpectedValueException When the value for an event is not 'always', 'new' or 'existing'
      */
     public function handleEvent(Event $event, EntityInterface $entity)

+ 1 - 1
src/ORM/PropertyMarshalInterface.php

@@ -25,7 +25,7 @@ interface PropertyMarshalInterface
     /**
      * Build a set of properties that should be included in the marshalling process.
      *
-     * @param \Cake\ORM\Marhshaller $marshaller The marhshaller of the table the behavior is attached to.
+     * @param \Cake\ORM\Marshaller $marshaller The marhshaller of the table the behavior is attached to.
      * @param array $map The property map being built.
      * @param array $options The options array used in the marshalling call.
      * @return array A map of `[property => callable]` of additional properties to marshal.

+ 5 - 1
src/ORM/RulesChecker.php

@@ -133,6 +133,10 @@ class RulesChecker extends BaseRulesChecker
 
         $errorField = $field;
 
-        return $this->_addError(new ValidCount($field, $count, $operator), '_validCount', compact('count', 'operator', 'errorField', 'message'));
+        return $this->_addError(
+            new ValidCount($field),
+            '_validCount',
+            compact('count', 'operator', 'errorField', 'message')
+        );
     }
 }

+ 1 - 1
src/ORM/SaveOptionsBuilder.php

@@ -40,7 +40,7 @@ class SaveOptionsBuilder extends ArrayObject
     /**
      * Table object.
      *
-     * @var \Cake\ORM\Table;
+     * @var \Cake\ORM\Table
      */
     protected $_table;
 

+ 1 - 1
src/Routing/Route/RedirectRoute.php

@@ -65,7 +65,7 @@ class RedirectRoute extends Route
      *
      * @param string $url The URL to parse.
      * @param string $method The HTTP method being used.
-     * @return false|null False on failure. An exception is raised on a successful match.
+     * @return bool|null False on failure. An exception is raised on a successful match.
      * @throws \Cake\Routing\Exception\RedirectException An exception is raised on successful match.
      *   This is used to halt route matching and signal to the middleware that a redirect should happen.
      */

+ 1 - 1
src/TestSuite/MiddlewareDispatcher.php

@@ -102,7 +102,7 @@ class MiddlewareDispatcher
      * Create a PSR7 request from the request spec.
      *
      * @param array $spec The request spec.
-     * @return Psr\Http\Message\RequestInterface
+     * @return \Psr\Http\Message\RequestInterface
      */
     protected function _createRequest($spec)
     {

+ 1 - 1
src/TestSuite/TestCase.php

@@ -324,7 +324,7 @@ abstract class TestCase extends PHPUnit_Framework_TestCase
             'assertTags() is deprecated, use assertHtml() instead.',
             E_USER_DEPRECATED
         );
-        static::assertHtml($expected, $string, $fullDebug);
+        $this->assertHtml($expected, $string, $fullDebug);
     }
 
     /**

+ 7 - 0
src/View/Form/EntityContext.php

@@ -82,6 +82,13 @@ class EntityContext implements ContextInterface
     protected $_tables = [];
 
     /**
+     * Dictionary of validators.
+     *
+     * @var \Cake\Validation\Validator[]
+     */
+    protected $_validator = [];
+
+    /**
      * Constructor.
      *
      * @param \Cake\Http\ServerRequest $request The request object.

+ 7 - 0
src/View/Form/FormContext.php

@@ -34,6 +34,13 @@ class FormContext implements ContextInterface
     protected $_request;
 
     /**
+     * The form object.
+     *
+     * @var \Cake\Form\Form
+     */
+    protected $_form;
+
+    /**
      * Constructor.
      *
      * @param \Cake\Http\ServerRequest $request The request object.

+ 10 - 1
src/View/SerializedView.php

@@ -22,7 +22,7 @@ use RuntimeException;
 /**
  * Parent class for view classes generating serialized outputs like JsonView and XmlView.
  */
-class SerializedView extends View
+abstract class SerializedView extends View
 {
 
     /**
@@ -66,6 +66,15 @@ class SerializedView extends View
     }
 
     /**
+     * Serialize view vars.
+     *
+     * @param array|string $serialize The name(s) of the view variable(s) that
+     *   need(s) to be serialized
+     * @return string The serialized data
+     */
+    abstract protected function _serialize($serialize);
+
+    /**
      * Render view template or return serialized data.
      *
      * ### Special parameters

+ 1 - 5
src/View/View.php

@@ -998,18 +998,14 @@ class View implements EventDispatcherInterface
      *
      * @param string $viewFile Filename of the view
      * @param array $dataForView Data to include in rendered view.
-     *    If empty the current View::$viewVars will be used.
      * @return string Rendered output
      */
     protected function _evaluate($viewFile, $dataForView)
     {
-        $this->__viewFile = $viewFile;
         extract($dataForView);
         ob_start();
 
-        include $this->__viewFile;
-
-        unset($this->__viewFile);
+        include func_get_arg(0);
 
         return ob_get_clean();
     }

+ 7 - 0
src/View/Widget/FileWidget.php

@@ -26,6 +26,13 @@ class FileWidget implements WidgetInterface
 {
 
     /**
+     * Templates
+     *
+     * @var \Cake\View\StringTemplate
+     */
+    protected $_templates;
+
+    /**
      * Constructor
      *
      * @param \Cake\View\StringTemplate $templates Templates list.