File tree Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ matrix:
2727before_script :
2828 - if [[ $TRAVIS_PHP_VERSION != 7.0 ]]; then phpenv config-rm xdebug.ini; fi
2929
30- - if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan; fi
30+ - if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.9 ; fi
3131 - if [[ $PHPSTAN != 1 ]]; then composer install --no-interaction; fi
3232
3333script :
Original file line number Diff line number Diff line change @@ -106,22 +106,23 @@ public function one(array $data, array $options = [])
106106 */
107107 protected function _validate ($ data , $ options , $ isNew )
108108 {
109- if (!$ options ['validate ' ]) {
110- return [];
111- }
109+ $ validator = null ;
110+
112111 if ($ options ['validate ' ] === true ) {
113- $ options ['validate ' ] = $ this ->_endpoint ->getValidator ('default ' );
112+ $ validator = $ this ->_endpoint ->getValidator ('default ' );
113+ } elseif (is_string ($ options ['validate ' ])) {
114+ $ validator = $ this ->_endpoint ->getValidator ($ options ['validate ' ]);
115+ } elseif (is_object ($ options ['validate ' ])) {
116+ $ validator = $ options ['validate ' ];
114117 }
115- if (is_string ($ options ['validate ' ])) {
116- $ options ['validate ' ] = $ this ->_endpoint ->getValidator ($ options ['validate ' ]);
117- }
118- if (!is_object ($ options ['validate ' ])) {
118+
119+ if ($ validator === null ) {
119120 throw new RuntimeException (
120121 sprintf ('validate must be a boolean, a string or an object. Got %s. ' , gettype ($ options ['validate ' ]))
121122 );
122123 }
123124
124- return $ options [ ' validate ' ] ->errors ($ data , $ isNew );
125+ return $ validator ->errors ($ data , $ isNew );
125126 }
126127
127128 /**
Original file line number Diff line number Diff line change 1414use Cake \Event \EventDispatcherTrait ;
1515use Cake \Event \EventListenerInterface ;
1616use Cake \Event \EventManager ;
17- use Cake \Network \Exception \NotImplementedException ;
1817use Cake \Utility \Inflector ;
1918use Cake \Validation \ValidatorAwareTrait ;
2019use Muffin \Webservice \Exception \MissingResourceClassException ;
2120use Muffin \Webservice \Exception \UnexpectedDriverException ;
2221use Muffin \Webservice \Marshaller ;
2322use Muffin \Webservice \Query ;
2423use Muffin \Webservice \Schema ;
25- use Muffin \Webservice \StreamQuery ;
2624
2725/**
2826 * The table equivalent of a webservice endpoint
You can’t perform that action at this time.
0 commit comments