uuf6429

uuf6429

Member Since 11 years ago

@Yumpu @personio @newsletter2go @rocket-internet-berlin @GlobalCapital-MT, Dorbirn, AT

Experience Points
16
follower
Lessons Completed
9
follow
Lessons Completed
22
stars
Best Reply Awards
45
repos

81 contributions in the last year

Pinned
⚡ Cook your own recipes..!
⚡ Apache Realtime Logfile Monitor
⚡ PHP Rule Engine
⚡ :raised_hand: Provides various ways to break/block scenarios.
⚡ A state engine/machine for PHP.
Activity
Sep
30
4 weeks ago
Activity icon
issue

uuf6429 issue comment neovov/Fullscreen-API-Polyfill

uuf6429
uuf6429

promise always pending, never update it's status

chorme 69

I think maybe you forgot to register the event of w3.events.change. Because I can see only "dispatch w3.events.change" but none of "addEventListener w3.events.change" in your source code.

My solution is modify your code as follow:

Modify your function which called resolver. Replace all "api.events" as "w3.events" under this function

function createResolver(method) {
    return function resolver(resolve, reject) {
        // Reject the promise if asked to exitFullscreen and there is no element currently in fullscreen
        if (method === w3.exit && !doc[api.element]) {
            setTimeout(function () {
                reject(new TypeError());
            }, 1);
            return;
        }

        // When receiving an internal fullscreenchange event, fulfill the promise
        function change() {
            resolve();
            doc.removeEventListener(w3.events.change, change, false);
        }

        // When receiving an internal fullscreenerror event, reject the promise
        function error() {
            reject(new TypeError());
            doc.removeEventListener(w3.events.error, error, false);
        }

        doc.addEventListener(w3.events.change, change, false);
        doc.addEventListener(w3.events.error, error, false);
    };
}
uuf6429
uuf6429

Same problem on safari 14.1.1 (OSX). The code above fixes it. 👍

Sep
2
1 month ago
Activity icon
issue

uuf6429 issue barryvdh/laravel-ide-helper

uuf6429
uuf6429

Generate mixin for requests (by analysing rules)

Summary

Consider the following code:

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Routing\Controller;

class CreateProductRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'name' => 'string|min:3|max:30',
            'gtin' => 'string|min:8|max:14|unique:products,gtin',
            'tags' => 'array|required',
            'tags.*' => 'string|min:2|distinct',
            'prices' => 'array|required',
            'prices.*.currency' => 'string|required|exists:EUR,USD',
            'prices.*.amount' => 'integer|required',
        ];
    }
}

class CreateProductEndpoint extends Controller
{
    public function __invoke(CreateProductRequest $request)
    {
//                     vvvv
        echo $request->name . '\'s first price is: ';
        echo $request->prices[0]['amount'];
//                     ^^^^^^^^^^^^^^^^^^^--- no autocompletion
    }
}

My proposal would be to generate:

/**
 * MyApp\Http\Requests\CreateProductRequest
 *
 * @mixin IdeHelperCreateProductRequest
 * @property string $name
 * @property string $gtin
 * @property string[] $tags
 * @property array[] $prices
 */
class IdeHelperCreateProductRequest extends \Illuminate\Foundation\Http\FormRequest {}

Sadly, PHPDoc doesn't seem to support array shapes (nor phpstan supporting properties, so $prices ends up as a simple array of arrays).

Activity icon
issue

uuf6429 issue comment barryvdh/laravel-ide-helper

uuf6429
uuf6429

Laravel IDE Helper not working Sublime Text

Note: You do need CodeComplice for Sublime Text: https://github.com/spectacles/CodeComplice

CodeComplice error! when installing Code Complice, it missing "Package Control"

How to Laravel IDE Helper working on sublime text? Thanks, Guys!!

uuf6429
uuf6429

Anyway, sublime text is more of an editor than an ide... hence laravel-ide-helper is perhaps not applicable...

Aug
30
1 month ago
Activity icon
issue

uuf6429 issue comment laravel/framework

uuf6429
uuf6429

hasArgument on Commands returns true instead of false

  • Laravel Version: 5.4.19
  • PHP Version: 5.6.15, 7.1.2
  • Database Driver & Version: MySQL

Description:

Calling hasArgument() on a command returns true, even if the argument is missing. This obviously only happens for optional arguments.

Steps To Reproduce:

Create fresh Laravel Project. run php artisan make:command testCommand change signature of command to test:testCommand {argument1?} {argument2?} add command to Kernel.php add code below to handle method.

        if ($this->hasArgument('argument1')) {
            echo "Hsa Argument1: " . $this->argument('argument1') . "\n";
        }
        if ($this->hasArgument('argument2')) {
            echo "Hsa Argument2: " . $this->argument('argument2') . "\n";
        }

Command: php artisan test:testCommand arg1 arg2 Result:

Hsa Argument1: arg1
Hsa Argument2: arg2

Expected:

Hsa Argument1: arg1
Hsa Argument2: arg2

Command: php artisan test:testCommand arg1 Result:

Hsa Argument1: arg1
Hsa Argument2:

Expected:

Hsa Argument1: arg1

Command: php artisan test:testCommand Result:

Hsa Argument1:
Hsa Argument2:

Expected:


uuf6429
uuf6429

The symfony documentation clearly states that it checks the definition:

Returns true if an InputArgument object exists by name or position.

whereas the laravel documentation says otherwise:

Determine if the given argument is present.

I'd say either the laravel code is wrong (considering the PHPDoc) or at least the documentation is wrong. There's nothing to ask on the symfony side...

Aug
2
2 months ago
Activity icon
issue

uuf6429 issue comment laravel/framework

uuf6429
uuf6429

[6.x] Fix required_if boolean validation

Re-send of https://github.com/laravel/framework/pull/36967

This should fix some regressions for the changed behavior introduced in https://github.com/laravel/framework/pull/36504. The PR now takes into account the boolean validation rule when combining rules like required_if. As reported in https://github.com/laravel/framework/issues/36952 atm the validator will incorrectly return incorrect error messages when a boolean value of 0 is used. By first checking if the rules for the subject of required_if contains boolean we can safely know that it should be converted to a boolean. This doesn't breaks previous tests and all tests introduced by @jessarcher still pass.

I'd appreciate a second pair of eyes on this @jessarcher @timacdonald @SjorsO @taylorotwell.

Fixes https://github.com/laravel/framework/issues/36952

uuf6429
uuf6429

I don't like posting "me too" replies, but I agree with @oprypkhantc, we also have this problem and it's fixed by changing 1 to true.

Jul
30
2 months ago
Activity icon
issue

uuf6429 issue uuf6429/state-engine-php

uuf6429
uuf6429

Support "wildcard" transitions

There are quite a few cases where some state can be reached through any other state, for example closing a ticket in jira is typically allowed from any state.

The idea is to design a simple mechanism to define such "generic" / "wildcard" transitions because:

  1. We are lazy 😆
  2. Definitions should be concise and readable.
  3. It automates handling new states without having to add a new transition for each new state.
  4. It provides more context: "this is a bulk transition" vs "these transitions are separate but practically related"
  5. Such context can be used to customize some behaviour

Concerns:

  1. Should it be based on a special string, like * or a special class/interface?
  2. In any case, should it be bi-directional? (from: *, to: * vs from: * is not allowed)
  3. Should it act as a filter (eg: *,except:x,y), pattern (^/(?!not-this-state|or-this-other-state)$/) or just *