Skip to content

Commit c70a9ec

Browse files
committed
Remove explicit code blocks
1 parent 847cdef commit c70a9ec

File tree

3 files changed

+27
-61
lines changed

3 files changed

+27
-61
lines changed

docs/decoding.rst

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
Decoding
22
########
33

4+
.. highlight:: php
45
.. versionchanged:: 2.0 options array is replaced with named parameters
56
.. note:: Parameter order is not guaranteed for options, use named parameters
67

78
Scalars
89
=======
910

10-
Scalars will be converted to their respective types.
11-
12-
.. code-block:: php
11+
Scalars will be converted to their respective types::
1312

1413
<?php
1514

@@ -40,9 +39,7 @@ Lists and Dictionaries
4039

4140
Dictionaries and lists will be arrays by default.
4241
You can change this behavior with options.
43-
Use ``Collection`` enum for built in behaviors:
44-
45-
.. code-block:: php
42+
Use ``Collection`` enum for built in behaviors::
4643

4744
<?php
4845

@@ -60,9 +57,7 @@ Use ``Collection`` enum for built in behaviors:
6057
// dictType: Bencode\Collection::STDCLASS,
6158
);
6259

63-
Or use advanced control with callbacks:
64-
65-
.. code-block:: php
60+
Or use advanced control with callbacks::
6661

6762
<?php
6863

@@ -105,7 +100,7 @@ Supported libraries:
105100
* `brick/math`_
106101
* PEAR's `Math_BigInteger`_
107102

108-
.. code-block:: php
103+
::
109104

110105
<?php
111106

@@ -148,9 +143,7 @@ Internal Type
148143
.. versionadded:: 1.6/2.6
149144

150145
The library also has built in ``BigIntType``.
151-
It does not require any external dependencies but also does not allow any manipulation.
152-
153-
.. code-block:: php
146+
It does not require any external dependencies but also does not allow any manipulation::
154147

155148
<?php
156149

@@ -164,9 +157,7 @@ It does not require any external dependencies but also does not allow any manipu
164157
// '79228162514264337593543950336'
165158
// )]
166159

167-
BigIntType is a value object with several getters:
168-
169-
.. code-block:: php
160+
BigIntType is a value object with several getters::
170161

171162
<?php
172163

@@ -185,9 +176,7 @@ Custom Handling
185176
.. versionadded:: 1.6/2.6
186177
.. versionchanged:: 4.0 Passing class names as handlers was removed
187178

188-
Like listType and dictType you can use a callable:
189-
190-
.. code-block:: php
179+
Like listType and dictType you can use a callable::
191180

192181
<?php
193182

@@ -201,9 +190,7 @@ Like listType and dictType you can use a callable:
201190
Working with files
202191
==================
203192

204-
Load data from a file:
205-
206-
.. code-block:: php
193+
Load data from a file::
207194

208195
<?php
209196

@@ -216,9 +203,7 @@ Working with streams
216203

217204
.. versionadded:: 1.5/2.5
218205

219-
Load data from a seekable readable stream:
220-
221-
.. code-block:: php
206+
Load data from a seekable readable stream::
222207

223208
<?php
224209

@@ -231,9 +216,7 @@ Decoder object
231216

232217
.. versionadded:: 1.7/2.7/3.0
233218

234-
Decoder object can be configured on creation and used multiple times:
235-
236-
.. code-block:: php
219+
Decoder object can be configured on creation and used multiple times::
237220

238221
<?php
239222

docs/encoding.rst

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Encoding
22
########
33

4+
.. highlight:: php
45
.. versionchanged:: 2.0 options array is replaced with named parameters
56
.. note:: Parameter order is not guaranteed for options, use named parameters
67

@@ -9,7 +10,7 @@ Scalars and arrays
910

1011
.. versionchanged:: 4.1 floats now throw an exception instead of becoming strings
1112

12-
.. code-block:: php
13+
::
1314

1415
<?php
1516

@@ -43,9 +44,7 @@ ArrayObject and stdClass
4344

4445
.. versionchanged:: 3.0 ``Traversable`` objects no longer become dictionaries automatically
4546

46-
ArrayObject and stdClass become dictionaries:
47-
48-
.. code-block:: php
47+
ArrayObject and stdClass become dictionaries::
4948

5049
<?php
5150

@@ -70,9 +69,7 @@ Big integer support
7069
.. note:: More in the :ref:`decoding section <bencode_decoding_bigint>`
7170

7271
GMP object, Pear's Math_BigInteger, brick/math BigInteger, and internal type BigIntType (simple numeric string wrapper)
73-
will become integers:
74-
75-
.. code-block:: php
72+
will become integers::
7673

7774
<?php
7875

@@ -92,9 +89,7 @@ Stringable
9289

9390
.. versionchanged:: 3.0 ``Stringable`` objects no longer become strings automatically
9491

95-
You can convert ``Stringable`` objects to strings using ``useStringable`` option:
96-
97-
.. code-block:: php
92+
You can convert ``Stringable`` objects to strings using ``useStringable`` option::
9893

9994
<?php
10095

@@ -119,9 +114,7 @@ Object Wrappers
119114
.. versionadded:: 1.7/2.7/3.0 ``DictType``
120115

121116
You can use any traversable as a list by wrapping it with ``ListType``.
122-
Keys will be discarded in that case.
123-
124-
.. code-block:: php
117+
Keys will be discarded in that case::
125118

126119
<?php
127120

@@ -133,9 +126,7 @@ Keys will be discarded in that case.
133126
); // "li1ei2ei3ee"
134127

135128
You can use any traversable as a dictionary by wrapping it with ``DictType``.
136-
Keys will be cast to string and must be unique.
137-
138-
.. code-block:: php
129+
Keys will be cast to string and must be unique::
139130

140131
<?php
141132

@@ -156,9 +147,7 @@ BencodeSerializable
156147
.. versionadded:: 1.7/2.7/3.0 ``JsonSerializable`` handling
157148

158149
You can also force object representation by implementing BencodeSerializable interface.
159-
This will work exactly like JsonSerializable_ interface.
160-
161-
.. code-block:: php
150+
This will work exactly like JsonSerializable_ interface::
162151

163152
<?php
164153

@@ -182,9 +171,7 @@ This will work exactly like JsonSerializable_ interface.
182171
$encoded = Bencode::encode($file);
183172
// "d5:class6:MyFile4:name14:myfile.torrent4:sizei5242880ee"
184173

185-
Optionally you can use JsonSerializable_ itself too:
186-
187-
.. code-block:: php
174+
Optionally you can use JsonSerializable_ itself too::
188175

189176
<?php
190177

@@ -214,9 +201,7 @@ Working with files
214201

215202
.. versionchanged:: 3.0 ``($filename, $data)`` → ``($data, $filename)``
216203

217-
Save data to file:
218-
219-
.. code-block:: php
204+
Save data to file::
220205

221206
<?php
222207

@@ -229,9 +214,7 @@ Working with streams
229214

230215
.. versionadded:: 1.5/2.5
231216

232-
Save data to a writable stream or to a new php://temp if no stream is specified
233-
234-
.. code-block:: php
217+
Save data to a writable stream or to a new php://temp if no stream is specified::
235218

236219
<?php
237220

@@ -244,9 +227,7 @@ Encoder object
244227

245228
.. versionadded:: 1.7/2.7/3.0
246229

247-
Encoder object can be configured on creation and used multiple times.
248-
249-
.. code-block:: php
230+
Encoder object can be configured on creation and used multiple times::
250231

251232
<?php
252233

docs/upgrade.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Upgrade Notes
22
#############
33

4+
.. highlight:: php
5+
46
Upgrade from 3.x to 4.x
57
=======================
68

@@ -13,7 +15,7 @@ Upgrade from 3.x to 4.x
1315
* Closures passed to ``listType``, ``dictType``, and ``bigInt`` must handle iterables instead of arrays now
1416
* Class names can no longer be passed to ``listType``, ``dictType``, and ``bigInt``
1517

16-
.. code-block:: php
18+
::
1719

1820
<?php
1921

@@ -53,7 +55,7 @@ Main breaking changes:
5355
Use ``useStringable: true`` to return old behavior.
5456
* ``Bencode::dump($filename, $data)`` became ``Bencode::dump($data, $filename)`` for consistency with streams.
5557

56-
.. code-block:: php
58+
::
5759

5860
<?php
5961

0 commit comments

Comments
 (0)