Test for emacs-php/phpstan.el#10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Short | |
$fix=fn($f)=>(fn($x)=>$f(fn(...$as)=>($x($x)(...$as))))(fn($x)=>$f(fn(...$as)=>($x($x)(...$as)))); | |
// Long | |
$fix = fn (callable $f) => call_user_func( | |
(fn (callable $x) => $f(fn (...$as) => ($x($x)(...$as)))), | |
(fn (callable $x) => $f(fn (...$as) => ($x($x)(...$as)))) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright 2019 USAMI Kenta <[email protected]> | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/global/index.php b/global/index.php | |
index 956a254..e3dd049 100644 | |
--- a/global/index.php | |
+++ b/global/index.php | |
@@ -9,8 +9,7 @@ | |
require_once('./auth.php'); | |
$auth = new Auth(); | |
$secret_token = $auth->generateToken(); | |
- extract($_POST); | |
- $auth->render($token, $secret_token); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait Fizz { function __toString() { return "Fizz"; } } | |
trait Buzz { function __toString() { return "Buzz"; } } | |
trait FizzBuzz { function __toString() { return "FizzBuzz"; } } | |
trait N { function __toString() { return ltrim(__CLASS__, @_); } } | |
spl_autoload_register(function ($class) { | |
$n = ltrim($class, @_); | |
$trait = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?= implode(PHP_EOL, array_map(function ($n) { | |
return [0 => 'FizzBuzz', 3 => 'Fizz', 5 => 'Buzz', 6 => 'Fizz', | |
9 => 'Fizz', 10 => 'Buzz', 12 => 'Fizz'][$n%15] ?? $n; | |
}, range(0, 100))) . PHP_EOL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php declare(strict_types=1); | |
/** | |
* プロジェクト内の全PHPファイルに対して文法チェックを実施する | |
* | |
* @author USAMI Kenta <[email protected]> | |
* @copyright 2019 USAMI Kenta | |
* @license https://opensource.org/licenses/MIT MIT | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
const X = 100; | |
const FB = ['FizzBuzz', null, null, 'Fizz', null, 'Buzz', 'Fizz', | |
null, null, 'Fizz', 'Buzz', null, 'Fizz', null, null]; | |
call_user_func(new class { | |
function __invoke() | |
{ | |
if (X-count(debug_backtrace())-1) call_user_func(__METHOD__); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php declare(strict_types=1); | |
global $succ; | |
$succ = function ($n) { | |
return function ($f) use ($n) { | |
return function ($x) use ($n, $f) { | |
// ^n. ^f. ^x. f (n f x) | |
return $f($n($f)($x)); | |
}; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /** @license WTFPL | by USAMI Kenta */ | |
$クソ関数 = function() { | |
kuso(); | |
var_dump('うんこ'); | |
}; | |
suppress_kuso(); | |
$クソ関数(); |