@@ -44,10 +44,7 @@ public function getParameters(): array
4444 foreach ($ this ->getProperties (\ReflectionProperty::IS_PUBLIC ) as $ prop ) {
4545 if ($ prop ->isStatic ()) {
4646 continue ;
47- } elseif (
48- self ::parseAnnotation ($ prop , 'persistent ' )
49- || $ prop ->getAttributes (Attributes \Persistent::class)
50- ) {
47+ } elseif ($ prop ->getAttributes (Attributes \Persistent::class)) {
5148 $ params [$ prop ->getName ()] = [
5249 'def ' => $ prop ->hasDefaultValue () ? $ prop ->getDefaultValue () : null ,
5350 'type ' => ParameterConverter::getType ($ prop ),
@@ -88,7 +85,7 @@ public function getPersistentParams(): array
8885
8986 /**
9087 * Returns array of persistent components. They are tagged with class-level attribute
91- * #[Persistent] or annotation @persistent or returned by Presenter::getPersistentComponents().
88+ * #[Persistent] or returned by Presenter::getPersistentComponents().
9289 * @return array<string, array{since: class-string}>
9390 */
9491 public function getPersistentComponents (): array
@@ -100,9 +97,7 @@ public function getPersistentComponents(): array
10097 }
10198
10299 $ attrs = $ this ->getAttributes (Attributes \Persistent::class);
103- $ names = $ attrs
104- ? $ attrs [0 ]->getArguments ()
105- : (array ) self ::parseAnnotation ($ this , 'persistent ' );
100+ $ names = $ attrs ? $ attrs [0 ]->getArguments () : [];
106101 $ names = array_merge ($ names , $ class ::getPersistentComponents ());
107102 $ components = array_fill_keys ($ names , ['since ' => $ class ]);
108103
@@ -167,71 +162,6 @@ public function getSignalMethod(string $signal): ?\ReflectionMethod
167162 }
168163
169164
170- /**
171- * Returns an annotation value.
172- * @deprecated
173- */
174- public static function parseAnnotation (\Reflector $ ref , string $ name ): ?array
175- {
176- if (!preg_match_all ('#[\s*]@ ' . preg_quote ($ name , '# ' ) . '(?:\(\s*([^)]*)\s*\)|\s|$)# ' , (string ) $ ref ->getDocComment (), $ m )) {
177- return null ;
178- }
179-
180- $ tokens = ['true ' => true , 'false ' => false , 'null ' => null ];
181- $ res = [];
182- foreach ($ m [1 ] as $ s ) {
183- foreach (preg_split ('#\s*,\s*# ' , $ s , -1 , PREG_SPLIT_NO_EMPTY ) ?: ['true ' ] as $ item ) {
184- $ res [] = array_key_exists ($ tmp = strtolower ($ item ), $ tokens )
185- ? $ tokens [$ tmp ]
186- : $ item ;
187- }
188- }
189-
190- $ alt = match ($ name ) {
191- 'persistent ' => '#[Nette\Application\Attributes\Persistent] ' ,
192- 'deprecated ' => '#[Nette\Application\Attributes\Deprecated] ' ,
193- 'crossOrigin ' => '#[Nette\Application\Attributes\Request(sameOrigin: false)] ' ,
194- default => 'alternative '
195- };
196- trigger_error ("Annotation @ $ name is deprecated, use $ alt (used in " . Reflection::toString ($ ref ) . ') ' , E_USER_DEPRECATED );
197- return $ res ;
198- }
199-
200-
201- #[\Deprecated]
202- public function hasAnnotation (string $ name ): bool
203- {
204- return (bool ) self ::parseAnnotation ($ this , $ name );
205- }
206-
207-
208- #[\Deprecated]
209- public function getAnnotation (string $ name ): mixed
210- {
211- $ res = self ::parseAnnotation ($ this , $ name );
212- return $ res ? end ($ res ) : null ;
213- }
214-
215-
216- public function getMethod ($ name ): MethodReflection
217- {
218- return new MethodReflection ($ this ->getName (), $ name );
219- }
220-
221-
222- /**
223- * @return MethodReflection[]
224- */
225- public function getMethods ($ filter = -1 ): array
226- {
227- foreach ($ res = parent ::getMethods ($ filter ) as $ key => $ val ) {
228- $ res [$ key ] = new MethodReflection ($ this ->getName (), $ val ->getName ());
229- }
230-
231- return $ res ;
232- }
233-
234-
235165 #[\Deprecated]
236166 public static function combineArgs (\ReflectionFunctionAbstract $ method , array $ args ): array
237167 {
0 commit comments