8000 Merge branch '3.4' into 4.2 · symfony/symfony-docs@c831443 · GitHub
[go: up one dir, main page]

Skip to content

Commit c831443

Browse files
committed
Merge branch '3.4' into 4.2
* 3.4: rename $fileSystem to $filesystem add namespace, to be able to reuse class in following examples removed part from xml which is not available in yaml and php code-blocks
2 parents 688939f + e523833 commit c831443

File tree

3 files changed

+37
-34
lines changed

3 files changed

+37
-34
lines changed

components/config/resources.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ defined. Each loader should implement
4040
abstract :class:`Symfony\\Component\\Config\\Loader\\FileLoader` class,
4141
which allows for recursively importing other resources::
4242

43+
namespace Acme\Config\Loader;
44+
4345
use Symfony\Component\Config\Loader\FileLoader;
4446
use Symfony\Component\Yaml\Yaml;
4547

@@ -81,8 +83,9 @@ When it is asked to load a resource, it delegates this question to the
8183
resolver has found a suitable loader, this loader will be asked to load
8284
the resource::
8385

84-
use Symfony\Component\Config\Loader\LoaderResolver;
86+
use Acme\Config\Loader\YamlUserLoader;
8587
use Symfony\Component\Config\Loader\DelegatingLoader;
88+
use Symfony\Component\Config\Loader\LoaderResolver;
8689

8790
$loaderResolver = new LoaderResolver([new YamlUserLoader($fileLocator)]);
8891
$delegatingLoader = new DelegatingLoader($loaderResolver);

components/filesystem.rst

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ endpoint for filesystem operations::
2626
use Symfony\Component\Filesystem\Filesystem;
2727
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
2828

29-
$fileSystem = new Filesystem();
29+
$filesystem = new Filesystem();
3030

3131
try {
32-
$fileSystem->mkdir(sys_get_temp_dir().'/'.random_int(0, 1000));
32+
$filesystem->mkdir(sys_get_temp_dir().'/'.random_int(0, 1000));
3333
} catch (IOExceptionInterface $exception) {
3434
echo "An error occurred while creating your directory at ".$exception->getPath();
3535
}
@@ -53,7 +53,7 @@ mkdir
5353
On POSIX filesystems, directories are created with a default mode value
5454
`0777`. You can use the second argument to set your own mode::
5555

56-
$fileSystem->mkdir('/tmp/photos', 0700);
56+
$filesystem->mkdir('/tmp/photos', 0700);
5757

5858
.. note::
5959

@@ -79,11 +79,11 @@ presence of one or more files or directories and returns ``false`` if any of
7979
them is missing::
8080

8181
// if this absolute directory exists, returns true
82-
$fileSystem->exists('/tmp/photos');
82+
$filesystem->exists('/tmp/photos');
8383

8484
// if rabbit.jpg exists and bottle.png does not exist, returns false
8585
// non-absolute paths are relative to the directory where the running PHP script is stored
86-
$fileSystem->exists(['rabbit.jpg', 'bottle.png']);
86+
$filesystem->exists(['rabbit.jpg', 'bottle.png']);
8787

8888
.. note::
8989

@@ -100,10 +100,10 @@ source modification date is later than the target. This behavior can be overridd
100100
by the third boolean argument::
101101

102102
// works only if image-ICC has been modified after image.jpg
103-
$fileSystem->copy('image-ICC.jpg', 'image.jpg');
103+
$filesystem->copy('image-ICC.jpg', 'image.jpg');
104104

105105
// image.jpg will be overridden
106-
$fileSystem->copy('image-ICC.jpg', 'image.jpg', true);
106+
$filesystem->copy('image-ICC.jpg', 'image.jpg', true);
107107

108108
touch
109109
~~~~~
@@ -113,11 +113,11 @@ modification time for a file. The current time is used by default. You can set
113113
your own with the second argument. The third argument is the access time::
114114

115115
// sets modification time to the current timestamp
116-
$fileSystem->touch('file.txt');
116+
$filesystem->touch('file.txt');
117117
// sets modification time 10 seconds in the future
118-
$fileSystem->touch('file.txt', time() + 10);
118+
$filesystem->touch('file.txt', time() + 10);
119119
// sets access time 10 seconds in the past
120-
$fileSystem->touch('file.txt', time(), time() - 10);
120+
$filesystem->touch('file.txt', time(), time() - 10);
121121

122122
.. note::
123123

@@ -131,9 +131,9 @@ chown
131131
a file. The third argument is a boolean recursive option::
132132

133133
// sets the owner of the lolcat video to www-data
134-
$fileSystem->chown('lolcat.mp4', 'www-data');
134+
$filesystem->chown('lolcat.mp4', 'www-data');
135135
// changes the owner of the video directory recursively
136-
$fileSystem->chown('/video', 'www-data', true);
136+
$filesystem->chown('/video', 'www-data', true);
137137

138138
.. note::
139139

@@ -147,9 +147,9 @@ chgrp
147147
a file. The third argument is a boolean recursive option::
148148

149149
// sets the group of the lolcat video to nginx
150-
$fileSystem->chgrp('lolcat.mp4', 'nginx');
150+
$filesystem->chgrp('lolcat.mp4', 'nginx');
151151
// changes the group of the video directory recursively
152-
$fileSystem->chgrp('/video', 'nginx', true);
152+
$filesystem->chgrp('/video', 'nginx', true);
153153

154154
.. note::
155155

@@ -163,9 +163,9 @@ chmod
163163
permissions of a file. The fourth argument is a boolean recursive option::
164164

165165
// sets the mode of the video to 0600
166-
$fileSystem->chmod('video.ogg', 0600);
166+
$filesystem->chmod('video.ogg', 0600);
167167
// changes the mod of the src directory recursively
168-
$fileSystem->chmod('src', 0700, 0000, true);
168+
$filesystem->chmod('src', 0700, 0000, true);
169169

170170
.. note::
171171

@@ -178,7 +178,7 @@ remove
178178
:method:`Symfony\\Component\\Filesystem\\Filesystem::remove` deletes files,
179179
directories and symlinks::
180180

181-
$fileSystem->remove(['symlink', '/path/to/directory', 'activity.log']);
181+
$filesystem->remove(['symlink', '/path/to/directory', 'activity.log']);
182182

183183
.. note::
184184

@@ -192,9 +192,9 @@ rename
192192
of a single file or directory::
193193

194194
// renames a file
195-
$fileSystem->rename('/tmp/processed_video.ogg', '/path/to/store/video_647.ogg');
195+
$filesystem->rename('/tmp/processed_video.ogg', '/path/to/store/video_647.ogg');
196196
// renames a directory
197-
$fileSystem->rename('/tmp/files', '/path/to/store/files');
197+
$filesystem->rename('/tmp/files', '/path/to/store/files');
198198

199199
symlink
200200
~~~~~~~
@@ -204,10 +204,10 @@ symbolic link from the target to the destination. If the filesystem does not
204204
support symbolic links, a third boolean argument is available::
205205

206206
// creates a symbolic link
207-
$fileSystem->symlink('/path/to/source', '/path/to/destination');
207+
$filesystem->symlink('/path/to/source', '/path/to/destination');
208208
// duplicates the source directory if the filesystem
209209
// does not support symbolic links
210-
$fileSystem->symlink('/path/to/source', '/path/to/destination', true);
210+
$filesystem->symlink('/path/to/source', '/path/to/destination', true);
211211

212212
readlink
213213
~~~~~~~~
@@ -223,10 +223,10 @@ The :method:`Symfony\\Component\\Filesystem\\Filesystem::readlink` method provid
223223
by the Filesystem component always behaves in the same way::
224224

225225
// returns the next direct target of the link without considering the existence of the target
226-
$fileSystem->readlink('/path/to/link');
226+
$filesystem->readlink('/path/to/link');
227227

228228
// returns its absolute fully resolved final version of the target (if there are nested links, they are resolved)
229-
$fileSystem->readlink('/path/to/link', true);
229+
$filesystem->readlink('/path/to/link', true);
230230

231231
Its behavior is the following::
232232

@@ -247,12 +247,12 @@ makePathRelative
247247
absolute paths and returns the relative path from the second path to the first one::
248248

249249
// returns '../'
250-
$fileSystem->makePathRelative(
250+
$filesystem->makePathRelative(
251251
'/var/lib/symfony/src/Symfony/',
252252
'/var/lib/symfony/src/Symfony/Component'
253253
);
254254
// returns 'videos/'
255-
$fileSystem->makePathRelative('/tmp/videos', '/tmp')
255+
$filesystem->makePathRelative('/tmp/videos', '/tmp')
256256

257257
mirror
258258
~~~~~~
@@ -262,7 +262,7 @@ contents of the source directory into the target one (use the
262262
:method:`Symfony\\Component\\Filesystem\\Filesystem::copy` method to copy single
263263
files)::
264264

265-
$fileSystem->mirror('/path/to/source', '/path/to/target');
265+
$filesystem->mirror('/path/to/source', '/path/to/target');
266266

267267
isAbsolutePath
268268
~~~~~~~~~~~~~~
@@ -271,13 +271,13 @@ isAbsolutePath
271271
``true`` if the given path is absolute, ``false`` otherwise::
272272

273273
// returns true
274-
$fileSystem->isAbsolutePath('/tmp');
274+
$filesystem->isAbsolutePath('/tmp');
275275
// returns true
276-
$fileSystem->isAbsolutePath('c:\\Windows');
276+
$filesystem->isAbsolutePath('c:\\Windows');
277277
// returns false
278-
$fileSystem->isAbsolutePath('tmp');
278+
$filesystem->isAbsolutePath('tmp');
279279
// returns false
280-
$fileSystem->isAbsolutePath('../dir');
280+
$filesystem->isAbsolutePath('../dir');
281281

282282
tempnam
283283
~~~~~~~
@@ -296,7 +296,7 @@ file first and then moves it to the new file location when it's finished.
296296
This means that the user will always see either the complete old file or
297297
complete new file (but never a partially-written file)::
298298

299-
$fileSystem->dumpFile('file.txt', 'Hello World');
299+
$filesystem->dumpFile('file.txt', 'Hello World');
300300

301301
The ``file.txt`` file contains ``Hello World`` now.
302302

@@ -306,7 +306,7 @@ appendToFile
306306
:method:`Symfony\\Component\\Filesystem\\Filesystem::appendToFile` adds new
307307
contents at the end of some file::
308308

309-
$fileSystem->appendToFile('logs.txt', 'Email sent to user@example.com');
309+
$filesystem->appendToFile('logs.txt', 'Email sent to user@example.com');
310310

311311
If either the file or its containing directory doesn't exist, this method
312312
creates them before appending the contents.

security/multiple_guard_authenticators.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ This is how your security configuration can look in action:
7171
'entry_point' => '',
7272
'authenticators' => [
7373
LoginFormAuthenticator::class,
74-
FacebookConnectAuthenticator::class'
74+
FacebookConnectAuthenticator::class,
7575
],
7676
],
7777
],

0 commit comments

Comments
 (0)
0