@@ -774,16 +774,13 @@ private function getTestNodeClass(TwigTest $test): string
774774 $ stream = $ this ->parser ->getStream ();
775775 $ message = \sprintf ('Twig Test "%s" is deprecated ' , $ test ->getName ());
776776
777- if ($ test ->getDeprecatedVersion ()) {
778- $ message .= \sprintf (' since version %s ' , $ test ->getDeprecatedVersion ());
779- }
780777 if ($ test ->getAlternative ()) {
781778 $ message .= \sprintf ('. Use "%s" instead ' , $ test ->getAlternative ());
782779 }
783780 $ src = $ stream ->getSourceContext ();
784781 $ message .= \sprintf (' in %s at line %d. ' , $ src ->getPath () ?: $ src ->getName (), $ stream ->getCurrent ()->getLine ());
785782
786- @ trigger_error ( $ message , \ E_USER_DEPRECATED );
783+ trigger_deprecation ( $ test -> getDeprecatingPackage (), $ test -> getDeprecatedVersion (), $ message );
787784 }
788785
789786 return $ test ->getNodeClass ();
@@ -800,16 +797,13 @@ private function getFunctionNodeClass(string $name, int $line): string
800797
801798 if ($ function ->isDeprecated ()) {
802799 $ message = \sprintf ('Twig Function "%s" is deprecated ' , $ function ->getName ());
803- if ($ function ->getDeprecatedVersion ()) {
804- $ message .= \sprintf (' since version %s ' , $ function ->getDeprecatedVersion ());
805- }
806800 if ($ function ->getAlternative ()) {
807801 $ message .= \sprintf ('. Use "%s" instead ' , $ function ->getAlternative ());
808802 }
809803 $ src = $ this ->parser ->getStream ()->getSourceContext ();
810804 $ message .= \sprintf (' in %s at line %d. ' , $ src ->getPath () ?: $ src ->getName (), $ line );
811805
812- @ trigger_error ( $ message , \ E_USER_DEPRECATED );
806+ trigger_deprecation ( $ function -> getDeprecatingPackage (), $ function -> getDeprecatedVersion (), $ message );
813807 }
814808
815809 return $ function ->getNodeClass ();
@@ -826,16 +820,13 @@ private function getFilterNodeClass(string $name, int $line): string
826820
827821 if ($ filter ->isDeprecated ()) {
828822 $ message = \sprintf ('Twig Filter "%s" is deprecated ' , $ filter ->getName ());
829- if ($ filter ->getDeprecatedVersion ()) {
830- $ message .= \sprintf (' since version %s ' , $ filter ->getDeprecatedVersion ());
831- }
832823 if ($ filter ->getAlternative ()) {
833824 $ message .= \sprintf ('. Use "%s" instead ' , $ filter ->getAlternative ());
834825 }
835826 $ src = $ this ->parser ->getStream ()->getSourceContext ();
836827 $ message .= \sprintf (' in %s at line %d. ' , $ src ->getPath () ?: $ src ->getName (), $ line );
837828
838- @ trigger_error ( $ message , \ E_USER_DEPRECATED );
829+ trigger_deprecation ( $ filter -> getDeprecatingPackage (), $ filter -> getDeprecatedVersion (), $ message );
839830 }
840831
841832 return $ filter ->getNodeClass ();
0 commit comments