@@ -24,14 +24,14 @@ class AbstractSnapshot extends Snapshot
2424    /** 
2525     * Keeps a counter for each class, function and data-set combination. 
2626     * 
27-      * @var array 
27+      * @var array<string,array>  
2828     */ 
2929    protected  static  $ counters
3030
3131    /** 
3232     * A list of method names provided by the SnapshotAssertions trait. 
3333     * 
34-      * @var array 
34+      * @var array<string>  
3535     */ 
3636    protected  static  $ traitMethods
3737
@@ -95,6 +95,11 @@ static function (array $backtraceEntry) use ($traitMethods) {
9595            $ classFragsexplode ('\\' , $ class
9696            $ classBasenamearray_pop ($ classFrags
9797            $ classFilenew  \ReflectionClass ($ classgetFileName ();
98+ 
99+             if  ($ classFilefalse ) {
100+                 throw  new  \RuntimeException ('Cannot get the filename of the class  '  . $ class
101+             }
102+ 
98103            $ classDirdirname ($ classFile
99104            $ function$ backtrace0 ]['function ' ];
100105            $ dataSetFrag'' ;
@@ -121,12 +126,11 @@ static function (array $backtraceEntry) use ($traitMethods) {
121126    }
122127
123128    /** 
129+      * Returns an array of the trait method names. 
124130     * 
131+      * @return array<string> An array of the trait method names. 
125132     * 
126-      * @return array 
127-      * @throws \ReflectionException 
128-      * @since TBD 
129-      * 
133+      * @throws \ReflectionException If a reflection cannot be done on a trait method. 
130134     */ 
131135    protected  static  function  getTraitMethods ()
132136    {
@@ -177,7 +181,11 @@ public function fileExtension()
177181     * 
178182     * This method is useful to create, or overwrite, the contents of the snapshot during tests. 
179183     * 
180-      * @param  mixed  $contents  The snapshot contents. 
184+      * @param mixed $contents The snapshot contents. 
185+      * 
186+      * @throws \ReflectionException 
187+      * 
188+      * @return void 
181189     */ 
182190    public  function  snapshotPutContents ($ contents
183191    {
@@ -189,17 +197,18 @@ public function snapshotPutContents($contents)
189197
190198    /** 
191199     * Saves the snapshot contents to the snapshot file. 
192-      * @throws \RejectionException If there's an issue while building the snapshot filename. 
193-      * @throws \RuntimeException If the snapshots folder cannot be created. 
194-      * @throws \ReflectionException If there's an issue building the file name from the test case. 
200+      * 
201+      * @throws \Exception If there's an issue reading or saving the snapshot. 
202+      * 
203+      * @return void 
195204     */ 
196205    protected  function  save ()
197206    {
198207        $ fileName$ this getFileName ();
199208        $ snapshotsDirdirname ($ fileName
200209
201210        if  (!is_dir ($ snapshotsDirmkdir ($ snapshotsDir0777 , true ) && !is_dir ($ snapshotsDir
202-             throw  new  RuntimeException (sprintf ('Snapshots directory "%s" was not created ' , $ snapshotsDir
211+             throw  new  \ RuntimeException (sprintf ('Snapshots directory "%s" was not created ' , $ snapshotsDir
203212        }
204213
205214        file_put_contents ($ fileName$ this prepareSnapshotForDump ());
@@ -217,6 +226,10 @@ public function prepareSnapshotForDump()
217226
218227    /** 
219228     * Asserts the current contents match the contents of the snapshot. 
229+      * 
230+      * @return void 
231+      * 
232+      * @throws \ReflectionException If there's an issue building the snapshot file name. 
220233     */ 
221234    public  function  assert ()
222235    {
@@ -285,6 +298,13 @@ protected function isEmptyData($data)
285298        return  !$ data
286299    }
287300
301+     /** 
302+      * Loads the data set from the snapshot. 
303+      * 
304+      * @return void 
305+      * 
306+      * @throws \ReflectionException 
307+      */ 
288308    protected  function  load ()
289309    {
290310        if  (!file_exists ($ this getFileName ())) {
@@ -301,6 +321,8 @@ protected function load()
301321     * Copy and paste of the bae method to allow for easier debug. 
302322     * 
303323     * @param  string  $message  The message to print in debug. 
324+      * 
325+      * @return void 
304326     */ 
305327    protected  function  printDebug ($ message
306328    {
@@ -309,7 +331,7 @@ protected function printDebug($message)
309331    /** 
310332 * Returns the data name taking care of doing so in a way that is compatible with different PHPUnit versions. 
311333 * 
312-  * @param  TestCase|\PHPUnit_Framework_TestCase   $testCase The current test case. 
334+  * @param  TestCase  $testCase The current test case. 
313335 * 
314336 * @return string The data name if available or an empty string if not available. 
315337 */ 
@@ -322,21 +344,25 @@ protected function getDataName(TestCase $testCase)
322344        $ candidatesarray_reverse (class_parents ($ testCase
323345        $ testCaseClassget_class ($ testCase
324346        $ candidates$ testCaseClass$ testCaseClass
347+         $ read'' ;
325348        foreach  (array_reverse ($ candidatesas  $ class
326349            try  {
327350                $ readstring )ReflectionHelper::readPrivateProperty ($ testCase'dataName ' , $ class
328351            } catch  (\ReflectionException   $ e
329352                continue ;
330353            }
331- 
332-             return  $ read
354+             break ;
333355        }
356+ 
357+         return  $ read
334358    }
335359
336360    /** 
337361     * Overrides the base implementation to add a pre-assertion data handler. 
338362     * 
339-      * {@inheritDoc} 
363+      * @param mixed $data The data to check. 
364+      * 
365+      * @return void 
340366     */ 
341367    protected  function  assertData ($ data
342368    {
@@ -354,6 +380,8 @@ protected function assertData($data)
354380     * @param callable $dataVisitor The data visitor that will be called on each visit of a snapshot "node". 
355381     *                              The parameters passed to the visitor will be different for each snapshot; usually 
356382     *                              the expected data and the current data. 
383+      * 
384+      * @return void 
357385     */ 
358386    public  function  setDataVisitor (callable  $ dataVisitor
359387    {
@@ -366,6 +394,8 @@ public function setDataVisitor(callable $dataVisitor)
366394     * @param string $snapshotFileName The absolute path to the file the snapshot file should use. 
367395     *                                 This value is, usually, the one produced by another snapshot `snapshotFileName()` 
368396     *                                 method. 
397+      * 
398+      * @return void 
369399     */ 
370400    public  function  setSnapshotFileName ($ snapshotFileName
371401    {
0 commit comments