1 | <?php |
||
28 | class FileNode extends File implements FileNodeInterface, FormatAwareInterface, CompressionAwareInterface, EncodingAwareInterface |
||
29 | { |
||
30 | use FormatAwareTrait; |
||
31 | use CompressionAwareTrait; |
||
32 | use EncodingAwareTrait; |
||
33 | |||
34 | /** @var FilesystemWrapperInterface */ |
||
35 | private $wrapper; |
||
36 | |||
37 | /** |
||
38 | * FileNode constructor. |
||
39 | * |
||
40 | * @param FilesystemInterface $filesystem |
||
41 | * @param null|string $path |
||
42 | */ |
||
43 | 113 | public function __construct(FilesystemInterface $filesystem, $path) |
|
48 | |||
49 | /** |
||
50 | * @return string |
||
51 | */ |
||
52 | 14 | public function __toString() |
|
56 | |||
57 | /** |
||
58 | * @return mixed |
||
59 | */ |
||
60 | 10 | public function getDirectory() |
|
64 | |||
65 | /** |
||
66 | * @return string |
||
67 | */ |
||
68 | 18 | public function getFilename() |
|
72 | |||
73 | /** |
||
74 | * Returns the contents of the file as an array. |
||
75 | * |
||
76 | * @return array |
||
77 | */ |
||
78 | 21 | public function getContents() |
|
86 | |||
87 | /** |
||
88 | * @param string|null $newPath |
||
89 | * |
||
90 | * @return static |
||
91 | * @throws CopyFailedException When it is unable to copy the file |
||
92 | */ |
||
93 | 4 | public function copy($newPath = null) |
|
94 | { |
||
95 | 4 | if (is_null($newPath)) { |
|
96 | 1 | $newPath = $this->path . '-copy'; |
|
97 | } |
||
98 | |||
99 | 4 | if (@$this->filesystem->copy($this->path, $newPath)) { |
|
100 | 3 | return $this->getClone()->setPath($newPath); |
|
101 | } else { |
||
102 | 1 | $lastError = error_get_last(); |
|
103 | 1 | throw new CopyFailedException($this, $newPath, $lastError['message']); |
|
104 | } |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * @return FilesystemWrapperInterface |
||
109 | */ |
||
110 | 17 | public function getFilesystem() |
|
114 | |||
115 | /** |
||
116 | * @param FilesystemInterface $filesystem |
||
117 | * |
||
118 | * @return $this |
||
119 | */ |
||
120 | 1 | public function setFilesystem(FilesystemInterface $filesystem) |
|
125 | |||
126 | /** |
||
127 | * Return a clone of this object |
||
128 | * |
||
129 | * @return static |
||
130 | */ |
||
131 | 57 | public function getClone() |
|
135 | |||
136 | /** |
||
137 | * Clone sub objects |
||
138 | */ |
||
139 | 57 | public function __clone() |
|
145 | } |
||
146 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..