Skip to content

Commit

Permalink
Merge pull request #1502 from phalcon/4.0.x
Browse files Browse the repository at this point in the history
v4.0.7
  • Loading branch information
Jeckerson authored Apr 4, 2021
2 parents ad7a6eb + c288f71 commit b4bee99
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# [4.0.7](https://github.com/phalcon/cphalcon/releases/tag/v4.0.7)
## Fixed
- Fixed not found error on webtools [#1500](https://github.com/phalcon/phalcon-devtools/issues/1500)


# [4.0.6](https://github.com/phalcon/cphalcon/releases/tag/v4.0.6) (2021-03-22)
## Fixed
- Fixed model findFirst return type error [#1478](https://github.com/phalcon/phalcon-devtools/issues/1478)
Expand Down
44 changes: 24 additions & 20 deletions src/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function __construct(array $parameters = [])
*/
public function run()
{
if (PHP_SAPI == 'cli') {
if (PHP_SAPI === 'cli') {
set_time_limit(0);
}

Expand All @@ -219,7 +219,7 @@ public function run()
*
* @return string
*/
public function getOutput()
public function getOutput(): string
{
return $this->app->handle($this->getCurrentUri())->getContent();
}
Expand All @@ -231,7 +231,7 @@ public function getOutput()
*
* @return $this
*/
public function setPtoolsPath($path)
public function setPtoolsPath(string $path): Bootstrap
{
$this->ptoolsPath = rtrim($path, '\\/');

Expand All @@ -243,7 +243,7 @@ public function setPtoolsPath($path)
*
* @return string
*/
public function getPtoolsPath()
public function getPtoolsPath(): string
{
return $this->ptoolsPath;
}
Expand All @@ -255,7 +255,7 @@ public function getPtoolsPath()
*
* @return $this
*/
public function setPtoolsIp($ip)
public function setPtoolsIp(string $ip): Bootstrap
{
$this->ptoolsIp = trim($ip);

Expand All @@ -267,7 +267,7 @@ public function setPtoolsIp($ip)
*
* @return string
*/
public function getPtoolsIp()
public function getPtoolsIp(): string
{
return $this->ptoolsIp;
}
Expand All @@ -279,7 +279,7 @@ public function getPtoolsIp()
*
* @return $this
*/
public function setBasePath($path)
public function setBasePath(string $path): Bootstrap
{
$this->basePath = rtrim($path, '\\/');

Expand All @@ -291,7 +291,7 @@ public function setBasePath($path)
*
* @return string
*/
public function getBasePath()
public function getBasePath(): string
{
return $this->basePath;
}
Expand All @@ -303,7 +303,7 @@ public function getBasePath()
*
* @return $this
*/
public function setTemplatesPath($path)
public function setTemplatesPath(string $path): Bootstrap
{
$this->templatesPath = rtrim($path, '\\/');

Expand All @@ -315,7 +315,7 @@ public function setTemplatesPath($path)
*
* @return string
*/
public function getTemplatesPath()
public function getTemplatesPath(): string
{
return $this->templatesPath;
}
Expand All @@ -327,7 +327,7 @@ public function getTemplatesPath()
*
* @return $this
*/
public function setMode($mode)
public function setMode(string $mode): Bootstrap
{
$mode = strtolower(trim($mode));

Expand All @@ -345,7 +345,7 @@ public function setMode($mode)
*
* @return string
*/
public function getMode()
public function getMode(): string
{
return $this->mode;
}
Expand All @@ -357,7 +357,7 @@ public function getMode()
*
* @return $this
*/
public function setHostName($name)
public function setHostName(string $name): Bootstrap
{
$this->hostName = trim($name);

Expand All @@ -369,7 +369,7 @@ public function setHostName($name)
*
* @return string
*/
public function getHostName()
public function getHostName(): string
{
return $this->hostName;
}
Expand All @@ -381,7 +381,7 @@ public function getHostName()
* @return $this
* @throws InvalidArgumentException
*/
public function setParameters(array $parameters)
public function setParameters(array $parameters): Bootstrap
{
foreach ($this->configurable as $param) {
if (!isset($parameters[$param])) {
Expand All @@ -401,7 +401,7 @@ public function setParameters(array $parameters)
* @param mixed $value The value
* @return $this
*/
public function setParameter(string $parameter, $value)
public function setParameter(string $parameter, $value): Bootstrap
{
$method = 'set' . Text::camelize($parameter);

Expand All @@ -417,10 +417,10 @@ public function setParameter(string $parameter, $value)
*
* @return $this
*/
public function initFromConstants()
public function initFromConstants(): Bootstrap
{
foreach ($this->defines as $const => $property) {
if (defined($const) && in_array($property, $this->configurable)) {
if (defined($const) && in_array($property, $this->configurable, true)) {
$this->setParameter($property, constant($const));
}
}
Expand All @@ -430,8 +430,12 @@ public function initFromConstants()

public function getCurrentUri(): string
{
$webToolsFileName = basename($_SERVER['SCRIPT_FILENAME']);
$baseUrl = $this->di->getShared('url')->getBaseUri();

return str_replace($webToolsFileName . '/', '', $_SERVER['REQUEST_URI']);
return str_replace(
basename($_SERVER['SCRIPT_FILENAME']),
'',
substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], $baseUrl) + strlen($baseUrl))
);
}
}
2 changes: 1 addition & 1 deletion src/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Version extends PhVersion
// phpcs:disable
protected static function _getVersion(): array
{
return [4, 0, 5, 0, 0];
return [4, 0, 7, 0, 0];
}
// phpcs:enable
}

0 comments on commit b4bee99

Please sign in to comment.