@@ 116-122 (lines=7) @@ | ||
113 | * |
|
114 | * @return ClassEnsurance |
|
115 | */ |
|
116 | public function isParentOf(string $class): ClassEnsurance |
|
117 | { |
|
118 | $this->enforce(array_key_exists($this->class, class_parents($class, true))) |
|
119 | ->orThrow('"%s" is not a parent of "%s"', $this->class, $class); |
|
120 | ||
121 | return $this; |
|
122 | } |
|
123 | ||
124 | /** |
|
125 | * @param string $class |
|
@@ 129-135 (lines=7) @@ | ||
126 | * |
|
127 | * @return ClassEnsurance |
|
128 | */ |
|
129 | public function isNotParentOf(string $class): ClassEnsurance |
|
130 | { |
|
131 | $this->enforce(!array_key_exists($this->class, class_parents($class, true))) |
|
132 | ->orThrow('"%s" is a parent of "%s"', $this->class, $class); |
|
133 | ||
134 | return $this; |
|
135 | } |
|
136 | ||
137 | /** |
|
138 | * @param string $trait |
|
@@ 142-148 (lines=7) @@ | ||
139 | * |
|
140 | * @return ClassEnsurance |
|
141 | */ |
|
142 | public function uses(string $trait): ClassEnsurance |
|
143 | { |
|
144 | $this->enforce(array_key_exists($trait, class_uses($this->class))) |
|
145 | ->orThrow('"%s" does not use trait "%s"', $this->class, $trait); |
|
146 | ||
147 | return $this; |
|
148 | } |
|
149 | ||
150 | /** |
|
151 | * @param string $property |