Browse Source

Merge remote-tracking branch 'origin/master' into 4.next

# Conflicts:
#	src/Utility/Hash.php
mscherer 6 years ago
parent
commit
2b5fa823b3

+ 2 - 1
src/Datasource/QueryInterface.php

@@ -21,6 +21,7 @@ namespace Cake\Datasource;
  * The basis for every query object
  *
  * @method $this andWhere($conditions, array $types = [])
+ * @method \Cake\Datasource\EntityInterface|array firstOrFail()
  */
 interface QueryInterface
 {
@@ -145,7 +146,7 @@ interface QueryInterface
      * $singleUser = $query->select(['id', 'username'])->first();
      * ```
      *
-     * @return mixed the first result from the ResultSet
+     * @return \Cake\Datasource\EntityInterface|array|null the first result from the ResultSet
      */
     public function first();
 

+ 5 - 5
src/Utility/Hash.php

@@ -39,7 +39,7 @@ class Hash
      *
      * @param array|\ArrayAccess $data Array of data or object implementing
      *   \ArrayAccess interface to operate on.
-     * @param string|int|array|null $path The path being searched for. Either a dot
+     * @param string|int|string[]|null $path The path being searched for. Either a dot
      *   separated string, or an array of path segments.
      * @param mixed $default The return value when the path does not exist
      * @throws \InvalidArgumentException
@@ -355,7 +355,7 @@ class Hash
      *
      * @param string $op The operation to do.
      * @param array $data The data to operate on.
-     * @param array $path The path to work on.
+     * @param string[] $path The path to work on.
      * @param mixed $values The values to insert when doing inserts.
      * @return array data.
      */
@@ -461,8 +461,8 @@ class Hash
      * following the path specified in `$groupPath`.
      *
      * @param array $data Array from where to extract keys and values
-     * @param string|array|null $keyPath A dot-separated string. If null the output will be numerically indexed.
-     * @param string|array|null $valuePath A dot-separated string.
+     * @param string|string[]|null $keyPath A dot-separated string.
+     * @param string|string[]|null $valuePath A dot-separated string.
      * @param string|null $groupPath A dot-separated string.
      * @return array Combined array
      * @link https://book.cakephp.org/4/en/core-libraries/hash.html#Cake\Utility\Hash::combine
@@ -549,7 +549,7 @@ class Hash
      * The `$format` string can use any format options that `vsprintf()` and `sprintf()` do.
      *
      * @param array $data Source array from which to extract the data
-     * @param array $paths An array containing one or more Hash::extract()-style key paths
+     * @param string[] $paths An array containing one or more Hash::extract()-style key paths
      * @param string $format Format string into which values will be inserted, see sprintf()
      * @return string[]|null An array of strings extracted from `$path` and formatted with `$format`
      * @link https://book.cakephp.org/4/en/core-libraries/hash.html#Cake\Utility\Hash::format

+ 1 - 1
src/View/Form/EntityContext.php

@@ -325,7 +325,7 @@ class EntityContext implements ContextInterface
      * primary key column is guessed out of the provided $path array
      *
      * @param mixed $values The list from which to extract primary keys from
-     * @param array $path Each one of the parts in a path for a field name
+     * @param string[] $path Each one of the parts in a path for a field name
      * @return array|null
      */
     protected function _extractMultiple($values, array $path): ?array

+ 15 - 1
templates/layout/dev_error.php

@@ -59,6 +59,12 @@ use Cake\Error\Debugger;
     .header-title code {
         margin: 0 10px;
     }
+    .header-description {
+        display: block;
+        font-size: 18px;
+        line-height: 1.2;
+        margin-bottom: 16px;
+    }
     .header-type {
         display: block;
         font-size: 16px;
@@ -256,10 +262,18 @@ use Cake\Error\Debugger;
 </head>
 <body>
     <header>
+        <?php
+        $title = explode("\n", trim($this->fetch('title')));
+        $errorTitle = array_shift($title);
+        $errorDescription = implode("\n", $title);
+        ?>
         <h1 class="header-title">
-            <?= Debugger::formatHtmlMessage($this->fetch('title')) ?>
+            <span><?= Debugger::formatHtmlMessage($errorTitle) ?></span>
             <a>&#128203</a>
         </h1>
+        <?php if (strlen($errorDescription)) : ?>
+            <span class="header-description"><?= Debugger::formatHtmlMessage($errorDescription) ?></span>
+        <?php endif ?>
         <span class="header-type"><?= get_class($error) ?></span>
     </header>
     <div class="error-content">