# Google API Common Protos Client - Class PreconditionFailure (4.14.0)

4.14.0 (latest) 4.13.0 4.12.5 4.11.0 4.10.0 4.9.0 4.8.3 Reference documentation and code samples for the Google API Common Protos Client class PreconditionFailure.

Describes what preconditions have failed.

For example, if an RPC failed because it required the Terms of Service to be
acknowledged, it could list the terms of service violation in the
PreconditionFailure message.

Generated from protobuf message `google.rpc.PreconditionFailure`

## Namespace

Google \\ Rpc

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ violations` | `array<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.PreconditionFailure.Violation>` Describes all precondition violations. |

### getViolations

Describes all precondition violations.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.PreconditionFailure.Violation>` |   |

### setViolations

Describes all precondition violations.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.PreconditionFailure.Violation>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |