Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
namespace core\fixtures;
18
 
19
use core\attribute\deprecated;
20
 
21
/**
22
 * A file containing a variety of fixturs for deprecated attribute tests.
23
 *
24
 * @package    core
25
 * @copyright  2024 Andrew Lyons <andrew@nicols.co.uk>
26
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27
 */
28
 
29
#[deprecated('not_deprecated_class')]
30
class deprecated_class {
31
    protected string $notdeprecatedproperty = 'Not deprecated property';
32
 
33
    #[deprecated('$this->notdeprecatedproperty')]
34
    protected string $deprecatedproperty = 'Deprecated property';
35
 
36
    const NOT_DEPRECATED_CONST = 'Not deprecated const';
37
 
38
    #[deprecated('not_deprecated_class::NEW_CONSTANT')]
39
    const DEPRECATED_CONST = 'Deprecated const';
40
 
41
    public function not_deprecated_method() {
42
    }
43
 
44
    #[deprecated(replacement: null, mdl: 'MDL-80677')]
45
    public function deprecated_method() {
46
    }
47
}
48
 
49
class not_deprecated_class {
50
    protected string $notdeprecatedproperty = 'Not deprecated property';
51
 
52
    #[deprecated('$this->notdeprecatedproperty')]
53
    protected string $deprecatedproperty = 'Deprecated property';
54
 
55
    const NOT_DEPRECATED_CONST = 'Not deprecated const';
56
 
57
    #[deprecated('self::NOT_DEPRECATED_CONST')]
58
    const DEPRECATED_CONST = 'Deprecated const';
59
 
60
    public function not_deprecated_method() {
61
    }
62
 
63
    #[deprecated('$this->not_deprecated_method()')]
64
    public function deprecated_method() {
65
    }
66
}
67
 
68
function not_deprecated_function() {
69
}
70
 
71
#[deprecated('not_deprecated_class::not_deprecated_method()')]
72
function deprecated_function() {
73
}
74
 
75
interface not_deprecated_interface {
76
    const NOT_DEPRECATED_CONST = 'Not deprecated const';
77
 
78
    #[deprecated('self::NOT_DEPRECATED_CONST')]
79
    const DEPRECATED_CONST = 'Deprecated const';
80
 
81
    // Note: It does not make sense to deprecate methods in an _interface_ as the interface itself should be deprecated.
82
}
83
 
84
#[deprecated('not_deprecated_interface')]
85
interface deprecated_interface {
86
    const DEPRECATED_CONST = 'Deprecated const';
87
 
88
    public function not_deprecated_method();
89
}
90
 
91
trait not_deprecated_trait {
92
    protected string $notdeprecatedproperty = 'Not deprecated property';
93
 
94
    #[deprecated('$this->notdeprecatedproperty')]
95
    protected string $deprecatedproperty = 'Deprecated property';
96
 
97
    public function not_deprecated_method() {
98
    }
99
 
100
    #[deprecated('$this->not_deprecated_method()')]
101
    public function deprecated_method() {
102
    }
103
}
104
 
105
#[deprecated(not_deprecated_trait::class)]
106
trait deprecated_trait {
107
    protected string $notdeprecatedproperty = 'Not deprecated property';
108
 
109
    #[deprecated('$this->notdeprecatedproperty')]
110
    protected string $deprecatedproperty = 'Deprecated property';
111
 
112
    public function not_deprecated_method() {
113
    }
114
 
115
    #[deprecated(replacement: null, mdl: 'MDL-80677')]
116
    public function deprecated_method() {
117
    }
118
}
119
 
120
class not_deprecated_class_using_deprecated_trait_features {
121
    use deprecated_trait;
122
}
123
 
124
class not_deprecated_class_implementing_deprecated_interface implements deprecated_interface {
125
    public function not_deprecated_method() {
126
    }
127
}
128
 
129
class not_deprecated_class_using_not_deprecated_trait_features {
130
    use not_deprecated_trait;
131
}
132
 
133
class not_deprecated_class_implementing_not_deprecated_interface implements not_deprecated_interface {
134
    public function not_deprecated_method() {
135
    }
136
}