@@ -246,24 +246,6 @@ class ObjectShapeType
246246
247247 zv::Val otherPropertyType = pt_type_call (Z_OBJ_P (otherProperty.raw ()), PT_LC (" getreadabletype" ), 0 , NULL );
248248 if (UNEXPECTED (otherPropertyType.isUndef ())) return zv::Val ();
249- /* $acceptsValue = $propertyType->accepts($otherPropertyType, $strictTypes) */
250- zend_object *propertyTypeObj = propertyTypeObject (propertyType, " accepts" );
251- if (UNEXPECTED (propertyTypeObj == NULL )) return zv::Val ();
252- zv::Args acceptsArgs{otherPropertyType.raw (), strictTypes};
253- zv::Val acceptsValue = pt_type_op (propertyTypeObj, PT_OP_ACCEPTS , 2 , acceptsArgs);
254- if (UNEXPECTED (acceptsValue.isUndef ())) return zv::Val ();
255- if (UNEXPECTED (!zv::Ref (acceptsValue.raw ()).isObject ())) {
256- zend_type_error (" phpstan_turbo: accepts() must return %s" , ZSTR_VAL (pt_ce_accepts_result->name ));
257- return zv::Val ();
258- }
259- /* $acceptsValue->yes() && count($acceptsValue->reasons) === 0: continue */
260- zend_long acceptsValueBefore = pt_type_result_trinary (acceptsValue.raw ());
261- if (UNEXPECTED (acceptsValueBefore < 0 )) return zv::Val ();
262- if (acceptsValueBefore == PT_TRI_YES ) {
263- bool noReasonsBefore;
264- if (UNEXPECTED (!hasNoReasons (acceptsValue.raw (), noReasonsBefore))) return zv::Val ();
265- if (noReasonsBefore) continue ;
266- }
267249 /* $verbosity = VerbosityLevel::getRecommendedLevelByType($propertyType, $otherPropertyType),
268250 * whose `Type $acceptingType` parameter is the first to see the property type */
269251 bool propertyIsType;
@@ -274,7 +256,14 @@ class ObjectShapeType
274256 }
275257 zv::Val verbosity = pt_type_verbosity_recommended (propertyType, otherPropertyType.raw ());
276258 if (UNEXPECTED (verbosity.isUndef ())) return zv::Val ();
277- /* ->decorateReasons(...) */
259+ /* $propertyType->accepts($otherPropertyType, $strictTypes)->decorateReasons(...) */
260+ zv::Args acceptsArgs{otherPropertyType.raw (), strictTypes};
261+ zv::Val acceptsValue = pt_type_op (Z_OBJ_P (propertyType), PT_OP_ACCEPTS , 2 , acceptsArgs);
262+ if (UNEXPECTED (acceptsValue.isUndef ())) return zv::Val ();
263+ if (UNEXPECTED (!zv::Ref (acceptsValue.raw ()).isObject ())) {
264+ zend_type_error (" phpstan_turbo: accepts() must return %s" , ZSTR_VAL (pt_ce_accepts_result->name ));
265+ return zv::Val ();
266+ }
278267 zv::Val decorator = reasonDecorator (&propertyName, propertyType, otherPropertyType.raw (), verbosity.raw ());
279268 acceptsValue = pt_type_call (Z_OBJ_P (acceptsValue.raw ()), PT_LC (" decoratereasons" ), 1 , decorator.raw ());
280269 if (UNEXPECTED (acceptsValue.isUndef ())) return zv::Val ();
0 commit comments