@@ -48,10 +48,7 @@ public function getParameters(): array
4848 foreach ($ this ->getProperties (\ReflectionProperty::IS_PUBLIC ) as $ prop ) {
4949 if ($ prop ->isStatic ()) {
5050 continue ;
51- } elseif (
52- self ::parseAnnotation ($ prop , 'persistent ' )
53- || $ prop ->getAttributes (Attributes \Persistent::class)
54- ) {
51+ } elseif ($ prop ->getAttributes (Attributes \Persistent::class)) {
5552 $ params [$ prop ->getName ()] = [
5653 'def ' => $ prop ->hasDefaultValue () ? $ prop ->getDefaultValue () : null ,
5754 'type ' => ParameterConverter::getType ($ prop ),
@@ -92,7 +89,7 @@ public function getPersistentParams(): array
9289
9390 /**
9491 * Returns array of persistent components. They are tagged with class-level attribute
95- * #[Persistent] or annotation @persistent or returned by Presenter::getPersistentComponents().
92+ * #[Persistent] or returned by Presenter::getPersistentComponents().
9693 * @return array<string, array{since: class-string}>
9794 */
9895 public function getPersistentComponents (): array
@@ -104,9 +101,7 @@ public function getPersistentComponents(): array
104101 }
105102
106103 $ attrs = $ this ->getAttributes (Attributes \Persistent::class);
107- $ names = $ attrs
108- ? $ attrs [0 ]->getArguments ()
109- : (array ) self ::parseAnnotation ($ this , 'persistent ' );
104+ $ names = $ attrs ? $ attrs [0 ]->getArguments () : [];
110105 $ names = array_merge ($ names , $ class ::getPersistentComponents ());
111106 $ components = array_fill_keys ($ names , ['since ' => $ class ]);
112107
@@ -174,77 +169,6 @@ public function getSignalMethod(string $signal): ?\ReflectionMethod
174169 }
175170
176171
177- /**
178- * Returns an annotation value.
179- * @deprecated
180- * @return ?list<mixed>
181- */
182- public static function parseAnnotation (\Reflector $ ref , string $ name ): ?array
183- {
184- if (!preg_match_all ('#[\s*]@ ' . preg_quote ($ name , '# ' ) . '(?:\(\s*([^)]*)\s*\)|\s|$)# ' , (string ) $ ref ->getDocComment (), $ m )) {
185- return null ;
186- }
187-
188- $ tokens = ['true ' => true , 'false ' => false , 'null ' => null ];
189- $ res = [];
190- foreach ($ m [1 ] as $ s ) {
191- foreach (preg_split ('#\s*,\s*# ' , $ s , -1 , PREG_SPLIT_NO_EMPTY ) ?: ['true ' ] as $ item ) {
192- $ res [] = array_key_exists ($ tmp = strtolower ($ item ), $ tokens )
193- ? $ tokens [$ tmp ]
194- : $ item ;
195- }
196- }
197-
198- $ alt = match ($ name ) {
199- 'persistent ' => '#[Nette\Application\Attributes\Persistent] ' ,
200- 'deprecated ' => '#[Nette\Application\Attributes\Deprecated] ' ,
201- 'crossOrigin ' => '#[Nette\Application\Attributes\Request(sameOrigin: false)] ' ,
202- default => 'alternative '
203- };
204- trigger_error ("Annotation @ $ name is deprecated, use $ alt (used in " . Reflection::toString ($ ref ) . ') ' , E_USER_DEPRECATED );
205- return $ res ;
206- }
207-
208-
209- #[\Deprecated]
210- public function hasAnnotation (string $ name ): bool
211- {
212- return (bool ) self ::parseAnnotation ($ this , $ name );
213- }
214-
215-
216- #[\Deprecated]
217- public function getAnnotation (string $ name ): mixed
218- {
219- $ res = self ::parseAnnotation ($ this , $ name );
220- return $ res ? end ($ res ) : null ;
221- }
222-
223-
224- public function getMethod ($ name ): MethodReflection
225- {
226- return new MethodReflection ($ this ->getName (), $ name );
227- }
228-
229-
230- /**
231- * @return list<MethodReflection>
232- */
233- public function getMethods ($ filter = -1 ): array
234- {
235- foreach ($ res = parent ::getMethods ($ filter ) as $ key => $ val ) {
236- $ res [$ key ] = new MethodReflection ($ this ->getName (), $ val ->getName ());
237- }
238-
239- return $ res ;
240- }
241-
242-
243- /**
244- * @deprecated
245- * @param array<string, mixed> $args
246- * @return list<mixed>
247- */
248172 #[\Deprecated]
249173 public static function combineArgs (\ReflectionFunctionAbstract $ method , array $ args ): array
250174 {
0 commit comments