@@ -68,6 +68,9 @@ class ClassType
6868 */
6969 public static function from ($ class )
7070 {
71+ if ($ class instanceof \ReflectionClass) {
72+ trigger_error (__METHOD__ . '() accepts only class name or object. ' , E_USER_DEPRECATED );
73+ }
7174 return (new Factory )->fromClassReflection (
7275 $ class instanceof \ReflectionClass ? $ class : new \ReflectionClass ($ class )
7376 );
@@ -330,6 +333,7 @@ public function addTrait($trait, array $resolutions = [])
330333 */
331334 public function setConsts (array $ consts )
332335 {
336+ trigger_error (__METHOD__ . '() is deprecated, use setConstants() ' , E_USER_DEPRECATED );
333337 return $ this ->setConstants ($ consts );
334338 }
335339
@@ -340,6 +344,7 @@ public function setConsts(array $consts)
340344 */
341345 public function getConsts ()
342346 {
347+ trigger_error (__METHOD__ . '() is deprecated, use similar getConstants() ' , E_USER_DEPRECATED );
343348 return array_map (function ($ const ) { return $ const ->getValue (); }, $ this ->consts );
344349 }
345350
@@ -352,6 +357,7 @@ public function getConsts()
352357 */
353358 public function addConst ($ name , $ value )
354359 {
360+ trigger_error (__METHOD__ . '() is deprecated, use similar addConstant() ' , E_USER_DEPRECATED );
355361 $ this ->addConstant ($ name , $ value );
356362 return $ this ;
357363 }
0 commit comments