Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

Commit

Permalink
Merge branch 'feature/php7-changes' into develop
Browse files Browse the repository at this point in the history
Close #1456
  • Loading branch information
weierophinney committed Mar 26, 2015
2 parents 2610707 + cd8b766 commit 66d283b
Show file tree
Hide file tree
Showing 10 changed files with 144 additions and 39 deletions.
3 changes: 3 additions & 0 deletions docs/languages/en/modules/zend.db.sql.ddl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ In alphabetical order:
| Decimal | ``$name, $precision, $scale = null`` |
+------------------+----------------------------------------------------------------------------------+
| Float | ``$name, $digits, $decimal`` |
| | (Note: this class is deprecated as of 2.4.0; use Floating instead |
+------------------+----------------------------------------------------------------------------------+
| Floating | ``$name, $digits, $decimal`` |
+------------------+----------------------------------------------------------------------------------+
| Integer | ``$name, $nullable = false, $default = null, array $options = array()`` |
+------------------+----------------------------------------------------------------------------------+
Expand Down
19 changes: 14 additions & 5 deletions docs/languages/en/modules/zend.filter.int.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

.. _zend.filter.set.int:

Int
---
ToInt
-----

``Zend\Filter\Int`` allows you to transform a scalar value which contains into an integer.
``Zend\Filter\ToInt`` allows you to transform a scalar value which contains into an integer.

.. _zend.filter.set.int.options:

Supported Options
^^^^^^^^^^^^^^^^^

There are no additional options for ``Zend\Filter\Int``.
There are no additional options for ``Zend\Filter\ToInt``.

.. _zend.filter.set.int.basic:

Expand All @@ -24,10 +24,19 @@ A basic example of usage is below:
.. code-block:: php
:linenos:
$filter = new Zend\Filter\Int();
$filter = new Zend\Filter\ToInt();
print $filter->filter('-4 is less than 0');
This will return '-4'.

Migration from 2.0-2.3 to 2.4+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Version 2.4 adds support for PHP 7. In PHP 7, ``int`` is a reserved keyword,
which required renaming the ``Int`` filter. If you were using the ``Int`` filter
directly previously, you will now receive an ``E_USER_DEPRECATED`` notice on
instantiation. Please update your code to refer to the ``ToInt`` class instead.

Users pulling their ``Int`` filter instance from the filter plugin manager
receive a ``ToInt`` instance instead starting in 2.4.0.
35 changes: 22 additions & 13 deletions docs/languages/en/modules/zend.filter.null.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

.. _zend.filter.set.null:

Null
----
ToNull
------

This filter will change the given input to be ``NULL`` if it meets specific criteria. This is often necessary when
you work with databases and want to have a ``NULL`` value instead of a boolean or any other type.
Expand All @@ -13,7 +13,7 @@ you work with databases and want to have a ``NULL`` value instead of a boolean o
Supported Options
^^^^^^^^^^^^^^^^^

The following options are supported for ``Zend\Filter\Null``:
The following options are supported for ``Zend\Filter\ToNull``:

- **type**: The variable type which should be supported.

Expand All @@ -28,12 +28,12 @@ Per default this filter works like *PHP*'s ``empty()`` method; in other words, i
.. code-block:: php
:linenos:
$filter = new Zend\Filter\Null();
$filter = new Zend\Filter\ToNull();
$value = '';
$result = $filter->filter($value);
// returns null instead of the empty string
This means that without providing any configuration, ``Zend\Filter\Null`` will accept all input types and return
This means that without providing any configuration, ``Zend\Filter\ToNull`` will accept all input types and return
``NULL`` in the same cases as ``empty()``.

Any other value will be returned as is, without any changes.
Expand All @@ -43,7 +43,7 @@ Any other value will be returned as is, without any changes.
Changing the Default Behavior
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sometimes it's not enough to filter based on ``empty()``. Therefor ``Zend\Filter\Null`` allows you to configure
Sometimes it's not enough to filter based on ``empty()``. Therefor ``Zend\Filter\ToNull`` allows you to configure
which type will be converted and which not.

The following types can be handled:
Expand All @@ -69,26 +69,35 @@ them, you can give an array, you can use constants, or you can give a textual st
:linenos:
// converts false to null
$filter = new Zend\Filter\Null(Zend\Filter\Null::BOOLEAN);
$filter = new Zend\Filter\ToNull(Zend\Filter\ToNull::BOOLEAN);
// converts false and 0 to null
$filter = new Zend\Filter\Null(
Zend\Filter\Null::BOOLEAN + Zend\Filter\Null::INTEGER
$filter = new Zend\Filter\ToNull(
Zend\Filter\ToNull::BOOLEAN + Zend\Filter\ToNull::INTEGER
);
// converts false and 0 to null
$filter = new Zend\Filter\Null( array(
Zend\Filter\Null::BOOLEAN,
Zend\Filter\Null::INTEGER
$filter = new Zend\Filter\ToNull( array(
Zend\Filter\ToNull::BOOLEAN,
Zend\Filter\ToNull::INTEGER
));
// converts false and 0 to null
$filter = new Zend\Filter\Null(array(
$filter = new Zend\Filter\ToNull(array(
'boolean',
'integer',
));
You can also give a Traversable or an array to set the wished types. To set types afterwards use
``setType()``.

Migration from 2.0-2.3 to 2.4+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Version 2.4 adds support for PHP 7. In PHP 7, ``null`` is a reserved keyword,
which required renaming the ``Null`` filter. If you were using the ``Null`` filter
directly previously, you will now receive an ``E_USER_DEPRECATED`` notice on
instantiation. Please update your code to refer to the ``ToNull`` class instead.

Users pulling their ``Null`` filter instance from the filter plugin manager
receive a ``ToNull`` instance instead starting in 2.4.0.
5 changes: 5 additions & 0 deletions docs/languages/en/modules/zend.form.quick-start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -923,8 +923,13 @@ Annotations allow us to solve this problem. You can define the following behavio

- *Input*: specify the input class to use for this given element. A string value is expected.

- *Instance*: specify an object class instance to bind to the form or fieldset.

- *Name*: specify the name of the current element, fieldset, or form. A string value is expected.

- *Object*: specify an object class instance to bind to the form or fieldset.
(Note: this is deprecated in 2.4.0; use *Instance* instead.)

- *Options*: options to pass to the fieldset or form that are used to inform behavior -- things that are not
attributes; e.g. labels, CAPTCHA adapters, etc. The annotation expects an associative array: ``@Options({"label":
"Username:"})``.
Expand Down
27 changes: 18 additions & 9 deletions docs/languages/en/modules/zend.i18n.validator.float.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

.. _zend.i18n.validator.float:

Float
=====
IsFloat
=======

``Zend\I18n\Validator\Float`` allows you to validate if a given value contains a floating-point value. This validator
``Zend\I18n\Validator\IsFloat`` allows you to validate if a given value contains a floating-point value. This validator
validates also localized input.

.. _zend.i18n.validator.float.options:

Supported options for Zend\\I18n\\Validator\\Float
--------------------------------------------------
Supported options for Zend\\I18n\\Validator\\IsFloat
----------------------------------------------------

The following options are supported for ``Zend\I18n\Validator\Float``:
The following options are supported for ``Zend\I18n\Validator\IsFloat``:

- **locale**: Sets the locale which will be used to validate localized float values.

Expand All @@ -28,7 +28,7 @@ locale is used for validation:
.. code-block:: php
:linenos:
$validator = new Zend\I18n\Validator\Float();
$validator = new Zend\I18n\Validator\IsFloat();
$validator->isValid(1234.5); // returns true
$validator->isValid('10a01'); // returns false
Expand All @@ -45,13 +45,13 @@ Often it's useful to be able to validate also localized values. Float values are
countries. For example using english you will write "1.5". In german you may write "1,5" and in other languages you
may use grouping.

``Zend\I18n\Validator\Float`` is able to validate such notations. However,it is limited to the locale you set. See the
``Zend\I18n\Validator\IsFloat`` is able to validate such notations. However,it is limited to the locale you set. See the
following code:

.. code-block:: php
:linenos:
$validator = new Zend\I18n\Validator\Float(array('locale' => 'de'));
$validator = new Zend\I18n\Validator\IsFloat(array('locale' => 'de'));
$validator->isValid(1234.5); // returns true
$validator->isValid("1 234,5"); // returns false
Expand All @@ -62,5 +62,14 @@ As you can see, by using a locale, your input is validated localized. Using a di

The locale can also be set afterwards by using ``setLocale()`` and retrieved by using ``getLocale()``.

Migration from 2.0-2.3 to 2.4+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Version 2.4 adds support for PHP 7. In PHP 7, ``float`` is a reserved keyword,
which required renaming the ``Float`` validator. If you were using the ``Float`` validator
directly previously, you will now receive an ``E_USER_DEPRECATED`` notice on
instantiation. Please update your code to refer to the ``IsFloat`` class instead.

Users pulling their ``Float`` validator instance from the validator plugin manager
receive an ``IsFloat`` instance instead starting in 2.4.0.

24 changes: 17 additions & 7 deletions docs/languages/en/modules/zend.i18n.validator.int.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

.. _zend.validator.set.int:

Int
---
IsInt
-----

``Zend\I18n\Validator\Int`` validates if a given value is an integer. Also localized integer values are recognised and
``Zend\I18n\Validator\IsInt`` validates if a given value is an integer. Also localized integer values are recognised and
can be validated.

.. _zend.i18n.validator.int.options:

Supported Options
^^^^^^^^^^^^^^^^^

The following options are supported for ``Zend\I18n\Validator\Int``:
The following options are supported for ``Zend\I18n\Validator\IsInt``:

- **locale**: Sets the locale which will be used to validate localized integers.

Expand All @@ -28,7 +28,7 @@ locale is used for validation:
.. code-block:: php
:linenos:
$validator = new Zend\I18n\Validator\Int();
$validator = new Zend\I18n\Validator\IsInt();
$validator->isValid(1234); // returns true
$validator->isValid(1234.5); // returns false
Expand All @@ -46,13 +46,13 @@ Often it's useful to be able to validate also localized values. Integer values a
countries. For example using english you can write "1234" or "1,234". Both are integer values but the grouping is
optional. In german for example you may write "1.234" and in french "1 234".

``Zend\I18n\Validator\Int`` is able to validate such notations. But it is limited to the locale you set. This means that
``Zend\I18n\Validator\IsInt`` is able to validate such notations. But it is limited to the locale you set. This means that
it not simply strips off the separator, it validates if the correct separator is used. See the following code:

.. code-block:: php
:linenos:
$validator = new Zend\I18n\Validator\Int(array('locale' => 'de'));
$validator = new Zend\I18n\Validator\IsInt(array('locale' => 'de'));
$validator->isValid(1234); // returns true
$validator->isValid("1,234"); // returns false
Expand All @@ -63,4 +63,14 @@ As you can see, by using a locale, your input is validated localized. Using the

The locale can also be set afterwards by using ``setLocale()`` and retrieved by using ``getLocale()``.

Migration from 2.0-2.3 to 2.4+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Version 2.4 adds support for PHP 7. In PHP 7, ``int`` is a reserved keyword,
which required renaming the ``Int`` validator. If you were using the ``Int`` validator
directly previously, you will now receive an ``E_USER_DEPRECATED`` notice on
instantiation. Please update your code to refer to the ``IsInt`` class instead.

Users pulling their ``Int`` validator instance from the validator plugin manager
receive an ``IsInt`` instance instead starting in 2.4.0.

15 changes: 13 additions & 2 deletions docs/languages/en/modules/zend.log.writers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,30 @@ Writing to Zend Monitor
Stubbing Out the Writer
-----------------------

The ``Zend\Log\Writer\Null`` is a stub that does not write log data to anything. It is useful for disabling logging
The ``Zend\Log\Writer\Noop`` is a stub that does not write log data to anything. It is useful for disabling logging
or stubbing out logging during tests:

.. code-block:: php
:linenos:
$writer = new Zend\Log\Writer\Null;
$writer = new Zend\Log\Writer\Noop;
$logger = new Zend\Log\Logger();
$logger->addWriter($writer);
// goes nowhere
$logger->info('Informational message');
Migration from 2.0-2.3 to 2.4+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Version 2.4 adds support for PHP 7. In PHP 7, ``null`` is a reserved keyword,
which required renaming the ``Null`` log writer. If you were using the ``Null`` writer
directly previously, you will now receive an ``E_USER_DEPRECATED`` notice on
instantiation. Please update your code to refer to the ``Noop`` class instead.

Users pulling their ``Null`` writer instance from the writer plugin manager
receive a ``Noop`` instance instead starting in 2.4.0.

.. _zend.log.writers.mock:

Testing with the Mock
Expand Down
39 changes: 39 additions & 0 deletions docs/languages/en/modules/zend.mail.transport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,45 @@ File Transport Usage
$transport->setOptions($options);
$transport->send($message);
.. _zend.mail.transport.quick-start.inmemory-usage:

InMemory Transport Usage
^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: php
:linenos:
use Zend\Mail\Message;
use Zend\Mail\Transport\InMemory as InMemoryTransport;
$message = new Message();
$message->addTo('matthew@zend.com')
->addFrom('ralph.schindler@zend.com')
->setSubject('Greetings and Salutations!')
->setBody("Sorry, I'm going to be late today!");
// Setup InMemory transport
$transport = new InMemoryTransport();
$transport->send($message);
// Verify the message:
$received = $transport->getLastMessage();
The InMemory transport is primarily of interest when in development or when
testing.

Migration from 2.0-2.3 to 2.4+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Version 2.4 adds support for PHP 7. In PHP 7, ``null`` is a reserved keyword,
which required renaming the ``Null`` transport. If you were using the ``Null`` transport
directly previously, you will now receive an ``E_USER_DEPRECATED`` notice on
instantiation. Please update your code to refer to the ``InMemory`` class instead.

Users pulling their ``Null`` transport instance from the transport factory
(``Zend\Mail\Transport\Factory``) receive an ``InMemory`` instance instead
starting in 2.4.0.

.. _zend.mail.transport.options:

Configuration Options
Expand Down
14 changes: 12 additions & 2 deletions docs/languages/en/modules/zend.paginator.usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,32 @@ default:
+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|Iterator |Accepts an Iterator instance |
+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|Null |Does not use Zend\\Paginator to manage data pagination. You can still take advantage of the pagination control feature. |
|NullFill |Does not use Zend\\Paginator to manage data pagination. You can still take advantage of the pagination control feature. |
+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

.. note::

Instead of selecting every matching row of a given query, the DbSelect adapter retrieves only
the smallest amount of data necessary for displaying the current page. Because of this, a second query is dynamically generated to determine the total number of matching rows.

.. note:
Version 2.4 adds support for PHP 7. In PHP 7, ``null`` is a reserved keyword,
which required renaming the ``Null`` adapter. If you were using the ``Null`` adapter
directly previously, you will now receive an ``E_USER_DEPRECATED`` notice on
instantiation. Please update your code to refer to the ``NullFill`` class instead.
Users pulling their ``Null`` adapter instance from the adapter plugin manager
receive a ``NullFill`` instance instead starting in 2.4.0.
To create an instance of ``Zend\Paginator``, you must supply an adapter to the constructor:

.. code-block:: php
:linenos:
$paginator = new \Zend\Paginator\Paginator(new \Zend\Paginator\Adapter\ArrayAdapter($array));
In the case of the ``Null`` adapter, in lieu of a data collection you must supply an item count to its
In the case of the ``NullFill`` adapter, in lieu of a data collection you must supply an item count to its
constructor.

Although the instance is technically usable in this state, in your controller action you'll need to tell the
Expand Down

0 comments on commit 66d283b

Please sign in to comment.